all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-backup-qemu v2 1/3] refactor incremental checks
Date: Fri, 24 Jul 2020 11:53:33 +0200	[thread overview]
Message-ID: <20200724095335.2869192-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20200724095335.2869192-1-f.gruenbichler@proxmox.com>

in preparation for adding more checks to check_incremental

Signed-off-by: Fabian Grünbichler <f.gruenbichler@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





  reply	other threads:[~2020-07-24  9:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-24  9:53 [pve-devel] [PATCH proxmox-backup-qemu v2 0/3] fix #2866: invalidate bitmap on crypt_mode change Fabian Grünbichler
2020-07-24  9:53 ` Fabian Grünbichler [this message]
2020-07-24  9:53 ` [pve-devel] [PATCH proxmox-backup-qemu v2 2/3] add archive_name helper Fabian Grünbichler
2020-07-24  9:53 ` [pve-devel] [PATCH proxmox-backup-qemu v2 3/3] fix #2866: invalidate bitmap on crypt_mode change Fabian Grünbichler
2020-08-13  7:35 ` [pve-devel] applied: [PATCH proxmox-backup-qemu v2 0/3] " Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200724095335.2869192-2-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal