file fns return addresses

feat/vaults
Tomáš Mládek 2022-01-23 14:55:40 +01:00
parent dd16a96125
commit c1698061d5
No known key found for this signature in database
GPG Key ID: ED21612889E75EC5
1 changed files with 3 additions and 3 deletions

View File

@ -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()))
})
}