Separate out the pointer operations

This commit is contained in:
Olivier 'reivilibre' 2022-05-28 23:13:44 +01:00
parent 23b352f936
commit 081a1922c7
1 changed files with 25 additions and 7 deletions

View File

@ -240,7 +240,6 @@ pub fn store_fully<PT: ProgressTracker>(
parent: Option<String>, parent: Option<String>,
num_workers: u8, num_workers: u8,
progress_bar: &mut PT, progress_bar: &mut PT,
use_pipelined_storage: bool,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
if let Some(parent) = parent.as_ref() { if let Some(parent) = parent.as_ref() {
let mut parent_pointer = pile.read_pointer(parent)?.ok_or_else(|| { let mut parent_pointer = pile.read_pointer(parent)?.ok_or_else(|| {
@ -255,6 +254,29 @@ pub fn store_fully<PT: ProgressTracker>(
differentiate_node_in_place(&mut root_node, &parent_node.node)?; 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<PT: ProgressTracker>(
pile: &Arc<Pile<Box<dyn RawPile>>>,
root_dir: &PathBuf,
mut root_node: TreeNode,
parent: Option<String>,
num_workers: u8,
progress_bar: &mut PT,
) -> anyhow::Result<PointerData> {
// TODO make these configurable // TODO make these configurable
let sps = StoragePipelineSettings { let sps = StoragePipelineSettings {
num_compressors: get_number_of_workers("YAMA_PL_COMPRESSORS") as u32, num_compressors: get_number_of_workers("YAMA_PL_COMPRESSORS") as u32,
@ -301,9 +323,5 @@ pub fn store_fully<PT: ProgressTracker>(
uid_lookup, uid_lookup,
gid_lookup, gid_lookup,
}; };
Ok(pointer_data)
// TODO(newver) Allow the pointer to be returned separately.
pile.write_pointer(&new_pointer_name, &pointer_data)?;
pile.flush()?;
Ok(())
} }