Skip to content

Commit

Permalink
Minor logging improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jendakol committed Oct 15, 2018
1 parent e4cf88f commit 031294c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,11 @@ pub fn remove_file_version(repo: &Repo, dao: &Dao, version_id: u64) -> Result<Re
})
}

pub fn remove_file(repo: &Repo, dao: &Dao, device_id: &str, file_id: u64) -> Result<RemoveFileResult, Error> {
pub fn remove_file(logger:&Logger, repo: &Repo, dao: &Dao, device_id: &str, file_id: u64) -> Result<RemoveFileResult, Error> {
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)
Expand All @@ -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)
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ fn remove_file(config: State<HandlerConfig>, 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)
})
})
}
Expand Down

0 comments on commit 031294c

Please sign in to comment.