From b70744fda627594cd42f8b6ae2d0dd1d7d037d61 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sat, 13 Apr 2024 19:22:37 +0300 Subject: refactor(tvix/*/import): rename direntry_stream, entries_per_depths Align these names and comments with the two users, to make it more obvious we're doing the same thing here, just use a different method to come up with entries_per_depths. Change-Id: I42058e397588b6b57a6299e87183bef27588b228 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11415 Tested-by: BuildkiteCI Autosubmit: flokli Reviewed-by: Connor Brewster --- tvix/castore/src/import.rs | 9 +++++---- tvix/glue/src/builtins/import.rs | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tvix/castore/src/import.rs b/tvix/castore/src/import.rs index 2e1d4c2af3..acae8299cc 100644 --- a/tvix/castore/src/import.rs +++ b/tvix/castore/src/import.rs @@ -143,11 +143,12 @@ where BS: AsRef + Clone, DS: AsRef, { - let entries = walk_path_for_ingestion(path)?; - let entries_stream = leveled_entries_to_stream(entries); - pin_mut!(entries_stream); + // produce the leveled-key vector of DirEntry. + let entries_per_depths = walk_path_for_ingestion(path)?; + let direntry_stream = leveled_entries_to_stream(entries_per_depths); + pin_mut!(direntry_stream); - ingest_entries(blob_service, directory_service, entries_stream).await + ingest_entries(blob_service, directory_service, direntry_stream).await } /// The Merkle invariant checker is an internal structure to perform bookkeeping of all directory diff --git a/tvix/glue/src/builtins/import.rs b/tvix/glue/src/builtins/import.rs index 3a2dea953f..800f8ddc17 100644 --- a/tvix/glue/src/builtins/import.rs +++ b/tvix/glue/src/builtins/import.rs @@ -3,6 +3,7 @@ use crate::builtins::errors::ImportError; use futures::pin_mut; use std::path::Path; +use tvix_castore::import::leveled_entries_to_stream; use tvix_eval::{ builtin_macros::builtins, generators::{self, GenCo}, @@ -17,6 +18,7 @@ async fn filtered_ingest( path: &Path, filter: Option<&Value>, ) -> Result { + // produce the leveled-key vector of DirEntry. let mut entries_per_depths: Vec> = vec![Vec::new()]; let mut it = walkdir::WalkDir::new(path) .follow_links(false) @@ -99,13 +101,12 @@ async fn filtered_ingest( // FUTUREWORK: determine when it's the right moment to flush a level to the ingester. } - let entries_stream = tvix_castore::import::leveled_entries_to_stream(entries_per_depths); - - pin_mut!(entries_stream); + let direntry_stream = leveled_entries_to_stream(entries_per_depths); + pin_mut!(direntry_stream); state.tokio_handle.block_on(async { state - .ingest_entries(entries_stream) + .ingest_entries(direntry_stream) .await .map_err(|err| ErrorKind::IO { path: Some(path.to_path_buf()), -- cgit 1.4.1