[pve-devel] [PATCH proxmox-backup-qemu v2 1/3] refactor incremental checks

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Jul 24 11:53:33 CEST 2020


in preparation for adding more checks to check_incremental

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 src/backup.rs   |  5 ++++-
 src/commands.rs | 11 +++--------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/backup.rs b/src/backup.rs
index 717e099..dab1da0 100644
--- a/src/backup.rs
+++ b/src/backup.rs
@@ -202,7 +202,10 @@ impl BackupTask {
         device_name: String,
         size: u64,
     ) -> bool {
-        check_last_incremental_csum(self.last_manifest(), device_name, size)
+        match self.last_manifest() {
+            Some(ref manifest) => check_last_incremental_csum(manifest.clone(), &device_name, size),
+            None => false,
+        }
     }
 
     pub async fn register_image(
diff --git a/src/commands.rs b/src/commands.rs
index 6f26324..dd00ca9 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -79,19 +79,14 @@ pub(crate) async fn add_config(
 }
 
 pub(crate) fn check_last_incremental_csum(
-    manifest: Option<Arc<BackupManifest>>,
-    device_name: String,
+    manifest: Arc<BackupManifest>,
+    device_name: &str,
     device_size: u64,
 ) -> bool {
 
-    let manifest = match manifest {
-        Some(ref manifest) => manifest,
-        None => return false,
-    };
-
     let archive_name = format!("{}.img.fidx", device_name);
 
-    match PREVIOUS_CSUMS.lock().unwrap().get(&device_name) {
+    match PREVIOUS_CSUMS.lock().unwrap().get(device_name) {
         Some(csum) => manifest.verify_file(&archive_name, &csum, device_size).is_ok(),
         None => false,
     }
-- 
2.20.1






More information about the pve-devel mailing list