From 8263c024c9436c1ad56f64fbd6aa2ec27070eecb Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 27 Mar 2023 17:24:53 +0200 Subject: [PATCH] refactor(tvix/store/import): use DirectoryPutter in import.rs This should allow import_path to communicate to a gRPC remote store, that actually verifies the Directory nodes are interconnected. Change-Id: Ic5d28c33518f50dedec15f1732d81579a3afaff1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8357 Autosubmit: flokli Reviewed-by: tazjin Tested-by: BuildkiteCI --- tvix/store/src/import.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tvix/store/src/import.rs b/tvix/store/src/import.rs index 6aee2af98..e62097ec4 100644 --- a/tvix/store/src/import.rs +++ b/tvix/store/src/import.rs @@ -1,4 +1,4 @@ -use crate::{chunkservice::read_all_and_chunk, proto}; +use crate::{chunkservice::read_all_and_chunk, directoryservice::DirectoryPutter, proto}; use std::{ collections::HashMap, fmt::Debug, @@ -57,10 +57,10 @@ impl From for Error { // // It assumes the caller adds returned nodes to the directories it assembles. #[instrument(skip_all, fields(entry.file_type=?&entry.file_type(),entry.path=?entry.path()))] -fn process_entry( +fn process_entry( blob_service: &mut BS, chunk_service: &mut CS, - directory_service: &mut DS, + directory_putter: &mut DP, entry: &walkdir::DirEntry, maybe_directory: Option, ) -> Result { @@ -75,7 +75,7 @@ fn process_entry = HashMap::default(); + let mut directory_putter = directory_service.put_multiple_start(); + for entry in WalkDir::new(p) .follow_links(false) .contents_first(true) @@ -213,7 +215,7 @@ pub fn import_path< let node = process_entry( blob_service, chunk_service, - directory_service, + &mut directory_putter, &entry, maybe_directory, )?;