diff options
Diffstat (limited to 'tvix')
-rw-r--r-- | tvix/cli/src/tvix_store_io.rs | 2 | ||||
-rw-r--r-- | tvix/store/src/directoryservice/mod.rs | 2 | ||||
-rw-r--r-- | tvix/store/src/directoryservice/traverse.rs | 28 |
3 files changed, 14 insertions, 18 deletions
diff --git a/tvix/cli/src/tvix_store_io.rs b/tvix/cli/src/tvix_store_io.rs index 1ea718f1a188..ef112858b1bc 100644 --- a/tvix/cli/src/tvix_store_io.rs +++ b/tvix/cli/src/tvix_store_io.rs @@ -90,7 +90,7 @@ impl TvixStoreIO { let directory_service = self.directory_service.clone(); let sub_path = sub_path.to_owned(); let task = self.tokio_handle.spawn(async move { - directoryservice::traverse_to(directory_service, root_node, &sub_path).await + directoryservice::descend_to(directory_service, root_node, &sub_path).await }); Ok(self.tokio_handle.block_on(task).unwrap()?) diff --git a/tvix/store/src/directoryservice/mod.rs b/tvix/store/src/directoryservice/mod.rs index 09210dfed8e8..3b26f4baf79b 100644 --- a/tvix/store/src/directoryservice/mod.rs +++ b/tvix/store/src/directoryservice/mod.rs @@ -14,7 +14,7 @@ pub use self::from_addr::from_addr; pub use self::grpc::GRPCDirectoryService; pub use self::memory::MemoryDirectoryService; pub use self::sled::SledDirectoryService; -pub use self::traverse::traverse_to; +pub use self::traverse::descend_to; /// The base trait all Directory services need to implement. /// This is a simple get and put of [crate::proto::Directory], returning their diff --git a/tvix/store/src/directoryservice/traverse.rs b/tvix/store/src/directoryservice/traverse.rs index 0489c4458163..5043439e9de5 100644 --- a/tvix/store/src/directoryservice/traverse.rs +++ b/tvix/store/src/directoryservice/traverse.rs @@ -3,14 +3,10 @@ use crate::{proto::NamedNode, B3Digest, Error}; use std::{os::unix::ffi::OsStrExt, sync::Arc}; use tracing::{instrument, warn}; -/// This traverses from a (root) node to the given (sub)path, returning the Node +/// This descends from a (root) node to the given (sub)path, returning the Node /// at that path, or none, if there's nothing at that path. -/// TODO: Do we want to use [DirectoryService.get_recursive] to do less lookups? -/// Or do we consider this to be a non-issue due to store composition and local caching? -/// TODO: the name of this function (and mod) is a bit bad, because it doesn't -/// clearly distinguish it from the BFS traversers. #[instrument(skip(directory_service))] -pub async fn traverse_to( +pub async fn descend_to( directory_service: Arc<dyn DirectoryService>, root_node: crate::proto::node::Node, path: &std::path::Path, @@ -93,10 +89,10 @@ mod tests { utils::gen_directory_service, }; - use super::traverse_to; + use super::descend_to; #[tokio::test] - async fn test_traverse_to() { + async fn test_descend_to() { let directory_service = gen_directory_service(); let mut handle = directory_service.put_multiple_start(); @@ -128,7 +124,7 @@ mod tests { // traversal to an empty subpath should return the root node. { - let resp = traverse_to( + let resp = descend_to( directory_service.clone(), node_directory_complicated.clone(), &PathBuf::from(""), @@ -141,7 +137,7 @@ mod tests { // traversal to `keep` should return the node for DIRECTORY_WITH_KEEP { - let resp = traverse_to( + let resp = descend_to( directory_service.clone(), node_directory_complicated.clone(), &PathBuf::from("keep"), @@ -154,7 +150,7 @@ mod tests { // traversal to `keep/.keep` should return the node for the .keep file { - let resp = traverse_to( + let resp = descend_to( directory_service.clone(), node_directory_complicated.clone(), &PathBuf::from("keep/.keep"), @@ -167,7 +163,7 @@ mod tests { // traversal to `keep/.keep` should return the node for the .keep file { - let resp = traverse_to( + let resp = descend_to( directory_service.clone(), node_directory_complicated.clone(), &PathBuf::from("/keep/.keep"), @@ -180,7 +176,7 @@ mod tests { // traversal to `void` should return None (doesn't exist) { - let resp = traverse_to( + let resp = descend_to( directory_service.clone(), node_directory_complicated.clone(), &PathBuf::from("void"), @@ -193,7 +189,7 @@ mod tests { // traversal to `void` should return None (doesn't exist) { - let resp = traverse_to( + let resp = descend_to( directory_service.clone(), node_directory_complicated.clone(), &PathBuf::from("//v/oid"), @@ -207,7 +203,7 @@ mod tests { // traversal to `keep/.keep/404` should return None (the path can't be // reached, as keep/.keep already is a file) { - let resp = traverse_to( + let resp = descend_to( directory_service.clone(), node_directory_complicated.clone(), &PathBuf::from("keep/.keep/foo"), @@ -220,7 +216,7 @@ mod tests { // traversal to a subpath of '/' should return the root node. { - let resp = traverse_to( + let resp = descend_to( directory_service.clone(), node_directory_complicated.clone(), &PathBuf::from("/"), |