[pbs-devel] [PATCH v6 proxmox-backup 41/65] chunker: add method to reset chunker state

Christian Ebner c.ebner at proxmox.com
Tue May 14 12:33:57 CEST 2024


When forcing a boundary, the internal chunker state is not in sync
with the chunk stream anymore. The reset method therefore allows
to reset the internal state.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 pbs-datastore/src/chunker.rs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pbs-datastore/src/chunker.rs b/pbs-datastore/src/chunker.rs
index 712751829..253d2cf4c 100644
--- a/pbs-datastore/src/chunker.rs
+++ b/pbs-datastore/src/chunker.rs
@@ -167,6 +167,12 @@ impl Chunker {
         0
     }
 
+    pub fn reset(&mut self) {
+        self.h = 0;
+        self.chunk_size = 0;
+        self.window_size = 0;
+    }
+
     // fast implementation avoiding modulo
     // #[inline(always)]
     fn shall_break(&self) -> bool {
-- 
2.39.2





More information about the pbs-devel mailing list