From ff52dd74e739cbb8705ab34b62c0803966e9eefe Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Sat, 20 Nov 2021 10:58:49 +0000 Subject: [PATCH] Rename new to new_from_pile. --- datman/src/commands/backup.rs | 3 ++- yama/src/chunking.rs | 4 ++-- yama/src/commands.rs | 2 +- yama/src/operations/storing.rs | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/datman/src/commands/backup.rs b/datman/src/commands/backup.rs index 6407717..3b17b41 100644 --- a/datman/src/commands/backup.rs +++ b/datman/src/commands/backup.rs @@ -231,7 +231,8 @@ pub fn backup_source_to_destination( } info!("Will write as pointer {:?}.", pointer_name); - let mut chunker = yama::chunking::RecursiveChunker::new(SENSIBLE_THRESHOLD, &pile); + let mut chunker = + yama::chunking::RecursiveChunker::new_from_pile(SENSIBLE_THRESHOLD, &pile); let mut process = open_stdout_backup_process(extra_args, helper)?; diff --git a/yama/src/chunking.rs b/yama/src/chunking.rs index 3022961..d06d548 100644 --- a/yama/src/chunking.rs +++ b/yama/src/chunking.rs @@ -53,7 +53,7 @@ pub struct RecursiveChunker<'pile, RP: RawPile> { } impl<'pile, RP: RawPile> RecursiveChunker<'pile, RP> { - pub fn new(threshold: usize, pile: &'pile Pile) -> Self { + pub fn new_from_pile(threshold: usize, pile: &'pile Pile) -> Self { RecursiveChunker { pile, buffer: vec![], @@ -112,7 +112,7 @@ impl<'pile, RP: RawPile> RecursiveChunker<'pile, RP> { if self.buffer.len() > self.threshold { if self.next_layer.is_none() { // start chunking - self.next_layer = Some(Box::new(RecursiveChunker::new( + self.next_layer = Some(Box::new(RecursiveChunker::new_from_pile( self.threshold, self.pile.clone(), ))); diff --git a/yama/src/commands.rs b/yama/src/commands.rs index 710d831..f786202 100644 --- a/yama/src/commands.rs +++ b/yama/src/commands.rs @@ -112,7 +112,7 @@ pub fn store_tree_node( root_tree_node: &RootTreeNode, ) -> anyhow::Result { let serialised = serde_bare::to_vec(root_tree_node)?; - let mut chunker = RecursiveChunker::new(SENSIBLE_THRESHOLD, pile); + let mut chunker = RecursiveChunker::new_from_pile(SENSIBLE_THRESHOLD, pile); io::copy(&mut (&serialised[..]), &mut chunker)?; let chunk_ref = chunker.finish()?; Ok(chunk_ref) diff --git a/yama/src/operations/storing.rs b/yama/src/operations/storing.rs index 309c1d1..6768fed 100644 --- a/yama/src/operations/storing.rs +++ b/yama/src/operations/storing.rs @@ -93,7 +93,7 @@ pub fn store_worker( let full_path = root.join(&path); match File::open(&full_path) { Ok(mut file) => { - let mut chunker = RecursiveChunker::new(SENSIBLE_THRESHOLD, &pile); + let mut chunker = RecursiveChunker::new_from_pile(SENSIBLE_THRESHOLD, &pile); // streaming copy from file to chunker, really cool :) io::copy(&mut file, &mut chunker)?; let chunk_ref = chunker.finish()?;