[pbs-devel] [PATCH v9 proxmox-backup 24/58] chunker: add method to reset chunker state

Christian Ebner c.ebner at proxmox.com
Wed Jun 5 12:53:42 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>
---
changes since version 8:
- no changes

 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