diff --git a/src/lib.rs b/src/lib.rs index 44a028f..423fee9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -298,11 +298,11 @@ pub fn remove_file_version(repo: &Repo, dao: &Dao, version_id: u64) -> Result Result { +pub fn remove_file(logger:&Logger, repo: &Repo, dao: &Dao, device_id: &str, file_id: u64) -> Result { dao.remove_file(device_id, file_id) .map(|opt| match opt { Some(storage_names) => { - let (_, failures): (Vec<_>, Vec<_>) = storage_names + let (_, failures): (Vec<_>, Vec<_>) = (&storage_names) .into_iter() .map(|storage_name| { repo.repo.rm(&storage_name) @@ -313,6 +313,8 @@ pub fn remove_file(repo: &Repo, dao: &Dao, device_id: &str, file_id: u64) -> Res if failures.is_empty() { RemoveFileResult::Success } else { + warn!(logger, "Failures while removing files from repository: {:?}", failures; "all_files" => ?&storage_names); + RemoveFileResult::PartialFailure(failures) } }, diff --git a/src/server.rs b/src/server.rs index f4ba7f4..64f768b 100644 --- a/src/server.rs +++ b/src/server.rs @@ -189,7 +189,7 @@ fn remove_file(config: State, headers: Headers, metadata: RemoveF with_authentication(&config.logger, "remove_file", &config.statsd_client, &config.dao, &config.encryptor, &headers.session_pass, |device| { Repo::new(&config.repo_root, &device.account_id, device.repo_pass.clone(), &config.logger) .and_then(|repo| { - rbackup::remove_file(&repo, &config.dao, &device.id, metadata.file_id) + rbackup::remove_file(&config.logger, &repo, &config.dao, &device.id, metadata.file_id) }) }) }