summaryrefslogtreecommitdiff
path: root/src/backup_run.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/backup_run.rs')
-rw-r--r--src/backup_run.rs30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/backup_run.rs b/src/backup_run.rs
index ea5888a..c5d5382 100644
--- a/src/backup_run.rs
+++ b/src/backup_run.rs
@@ -48,7 +48,7 @@ impl<'a> InitialBackup<'a> {
}
pub fn drop(&self) {
- &self.progress.finish();
+ self.progress.finish();
}
pub fn backup(
@@ -65,7 +65,13 @@ impl<'a> InitialBackup<'a> {
let path = &entry.pathbuf();
info!("backup: {}", path.display());
self.progress.found_live_file(path);
- backup_file(&self.client, &entry, &path, self.buffer_size, Reason::IsNew)
+ Ok(backup_file(
+ &self.client,
+ &entry,
+ &path,
+ self.buffer_size,
+ Reason::IsNew,
+ ))
}
}
}
@@ -73,7 +79,7 @@ impl<'a> InitialBackup<'a> {
impl<'a> IncrementalBackup<'a> {
pub fn new(config: &ClientConfig, client: &'a BackupClient) -> BackupResult<Self> {
- let policy = BackupPolicy::new();
+ let policy = BackupPolicy::default();
Ok(Self {
client,
policy,
@@ -130,9 +136,13 @@ impl<'a> IncrementalBackup<'a> {
Reason::IsNew
| Reason::Changed
| Reason::GenerationLookupError
- | Reason::Unknown => {
- backup_file(&self.client, &entry, &path, self.buffer_size, reason)
- }
+ | Reason::Unknown => Ok(backup_file(
+ &self.client,
+ &entry,
+ &path,
+ self.buffer_size,
+ reason,
+ )),
Reason::Unchanged | Reason::Skipped | Reason::FileError => {
let fileno = old.get_fileno(&entry.pathbuf())?;
let ids = if let Some(fileno) = fileno {
@@ -140,7 +150,7 @@ impl<'a> IncrementalBackup<'a> {
} else {
vec![]
};
- Ok((entry.clone(), ids, reason))
+ Ok((entry, ids, reason))
}
}
}
@@ -166,13 +176,13 @@ fn backup_file(
path: &Path,
chunk_size: usize,
reason: Reason,
-) -> BackupResult<(FilesystemEntry, Vec<ChunkId>, Reason)> {
+) -> (FilesystemEntry, Vec<ChunkId>, Reason) {
let ids = client.upload_filesystem_entry(&entry, chunk_size);
match ids {
Err(err) => {
warn!("error backing up {}, skipping it: {}", path.display(), err);
- Ok((entry.clone(), vec![], Reason::FileError))
+ (entry.clone(), vec![], Reason::FileError)
}
- Ok(ids) => Ok((entry.clone(), ids, reason)),
+ Ok(ids) => (entry.clone(), ids, reason),
}
}