refactor(tvix/castore): don't require Arc'd DirectoryService

Since cl/12661 this doesn't need to be Arc'd.

Change-Id: I3c14c45df7815867ddea6f461e81649772648962
Reviewed-on: https://cl.tvl.fyi/c/depot/+/13155
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Marijan Petričević 2025-02-17 07:06:56 +01:00
parent dc5c3f7b40
commit 22854c75f3

View file

@ -10,7 +10,7 @@ pub async fn descend_to<DS>(
path: impl AsRef<Path> + std::fmt::Display, path: impl AsRef<Path> + std::fmt::Display,
) -> Result<Option<Node>, Error> ) -> Result<Option<Node>, Error>
where where
DS: AsRef<dyn DirectoryService>, DS: DirectoryService,
{ {
let mut parent_node = root_node; let mut parent_node = root_node;
for component in path.as_ref().components_bytes() { for component in path.as_ref().components_bytes() {
@ -22,17 +22,12 @@ where
} }
Node::Directory { digest, .. } => { Node::Directory { digest, .. } => {
// fetch the linked node from the directory_service. // fetch the linked node from the directory_service.
let directory = let directory = directory_service.get(&digest).await?.ok_or_else(|| {
directory_service // If we didn't get the directory node that's linked, that's a store inconsistency, bail out!
.as_ref() warn!("directory {} does not exist", digest);
.get(&digest)
.await?
.ok_or_else(|| {
// If we didn't get the directory node that's linked, that's a store inconsistency, bail out!
warn!("directory {} does not exist", digest);
Error::StorageError(format!("directory {} does not exist", digest)) Error::StorageError(format!("directory {} does not exist", digest))
})?; })?;
// look for the component in the [Directory]. // look for the component in the [Directory].
if let Some((_child_name, child_node)) = directory if let Some((_child_name, child_node)) = directory