about summary refs log tree commit diff
path: root/tvix/castore
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-12-31T21·30+0200
committerclbot <clbot@tvl.fyi>2024-01-01T02·09+0000
commit54fe97e725bc783c98b1a1c5605bcb761958305f (patch)
tree82de56c0b34071ae4d6cf3453e3f4618baee0210 /tvix/castore
parent2c2fdfedc681982a801dc5f58e210ae7d4e61f4d (diff)
refactor(tvix/castore): make directorysvc more generic r/7303
This works on Box<dyn DirectoryService> too.

Change-Id: Ib869f0f4d963ef4dbaeab22db03ff6afb71ede04
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10513
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/castore')
-rw-r--r--tvix/castore/src/directoryservice/traverse.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/tvix/castore/src/directoryservice/traverse.rs b/tvix/castore/src/directoryservice/traverse.rs
index 4f011c963c06..5289751e50dc 100644
--- a/tvix/castore/src/directoryservice/traverse.rs
+++ b/tvix/castore/src/directoryservice/traverse.rs
@@ -1,16 +1,19 @@
 use super::DirectoryService;
 use crate::{proto::NamedNode, B3Digest, Error};
-use std::{os::unix::ffi::OsStrExt, sync::Arc};
+use std::{ops::Deref, os::unix::ffi::OsStrExt};
 use tracing::{instrument, warn};
 
 /// 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.
 #[instrument(skip(directory_service))]
-pub async fn descend_to(
-    directory_service: Arc<dyn DirectoryService>,
+pub async fn descend_to<DS>(
+    directory_service: DS,
     root_node: crate::proto::node::Node,
     path: &std::path::Path,
-) -> Result<Option<crate::proto::node::Node>, Error> {
+) -> Result<Option<crate::proto::node::Node>, Error>
+where
+    DS: Deref<Target = dyn DirectoryService>,
+{
     // strip a possible `/` prefix from the path.
     let path = {
         if path.starts_with("/") {