From 54fe97e725bc783c98b1a1c5605bcb761958305f Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 31 Dec 2023 23:30:27 +0200 Subject: refactor(tvix/castore): make directorysvc more generic This works on Box too. Change-Id: Ib869f0f4d963ef4dbaeab22db03ff6afb71ede04 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10513 Autosubmit: flokli Reviewed-by: raitobezarius Tested-by: BuildkiteCI --- tvix/castore/src/directoryservice/traverse.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tvix/castore/src/directoryservice') 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, +pub async fn descend_to( + directory_service: DS, root_node: crate::proto::node::Node, path: &std::path::Path, -) -> Result, Error> { +) -> Result, Error> +where + DS: Deref, +{ // strip a possible `/` prefix from the path. let path = { if path.starts_with("/") { -- cgit 1.4.1