file fns return addresses
parent
dd16a96125
commit
c1698061d5
|
@ -337,7 +337,7 @@ fn process_directory_entry(
|
|||
})
|
||||
}
|
||||
|
||||
pub fn add_path(connection: &UpEndConnection, path: &Path, hash: Hash) -> Result<()> {
|
||||
pub fn add_file(connection: &UpEndConnection, path: &Path, hash: Hash) -> Result<Address> {
|
||||
let normalized_path = connection.normalize_path(path)?;
|
||||
let metadata = fs::metadata(&path)?;
|
||||
let size = metadata.len() as i64;
|
||||
|
@ -368,7 +368,7 @@ fn insert_file_with_metadata(
|
|||
mtime: Option<NaiveDateTime>,
|
||||
mime_type: Option<String>,
|
||||
resolve_cache: Option<&Arc<Mutex<ResolveCache>>>,
|
||||
) -> Result<()> {
|
||||
) -> Result<Address> {
|
||||
let new_file = models::NewFile {
|
||||
path: normalized_path
|
||||
.to_str()
|
||||
|
@ -442,7 +442,7 @@ fn insert_file_with_metadata(
|
|||
};
|
||||
connection.insert_entry(name_entry)?;
|
||||
|
||||
Ok(())
|
||||
Ok(Address::Hash(hash.clone()))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue