From 081a1922c7b4f829c0bcf8af6c31927344a2afda Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Sat, 28 May 2022 23:13:44 +0100 Subject: [PATCH] Separate out the pointer operations --- yama/src/operations/storing.rs | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/yama/src/operations/storing.rs b/yama/src/operations/storing.rs index 48fbf8e..9423a07 100644 --- a/yama/src/operations/storing.rs +++ b/yama/src/operations/storing.rs @@ -240,7 +240,6 @@ pub fn store_fully( parent: Option, num_workers: u8, progress_bar: &mut PT, - use_pipelined_storage: bool, ) -> anyhow::Result<()> { if let Some(parent) = parent.as_ref() { let mut parent_pointer = pile.read_pointer(parent)?.ok_or_else(|| { @@ -254,7 +253,30 @@ pub fn store_fully( fully_integrate_pointer_node(&pile, &mut parent_node.node, &mut parent_pointer)?; differentiate_node_in_place(&mut root_node, &parent_node.node)?; } - + + let pointer_data = store_without_pointer_ops( + &pile, + &root_dir, + root_node, + parent, + num_workers, + progress_bar, + )?; + + // TODO(newver) Allow the pointer to be returned separately. + pile.write_pointer(&new_pointer_name, &pointer_data)?; + pile.flush()?; + Ok(()) +} + +fn store_without_pointer_ops( + pile: &Arc>>, + root_dir: &PathBuf, + mut root_node: TreeNode, + parent: Option, + num_workers: u8, + progress_bar: &mut PT, +) -> anyhow::Result { // TODO make these configurable let sps = StoragePipelineSettings { num_compressors: get_number_of_workers("YAMA_PL_COMPRESSORS") as u32, @@ -301,9 +323,5 @@ pub fn store_fully( uid_lookup, gid_lookup, }; - - // TODO(newver) Allow the pointer to be returned separately. - pile.write_pointer(&new_pointer_name, &pointer_data)?; - pile.flush()?; - Ok(()) + Ok(pointer_data) }