about summary refs log tree commit diff
path: root/tvix/castore/src/fs/mod.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-01-09T09·04+0200
committerclbot <clbot@tvl.fyi>2024-01-09T14·08+0000
commit89882ff9b13ff1c25fc64605e3fc87ae7b9ab877 (patch)
tree4eaf9a8d3214ec8acda1fa5f94c2fc9624438518 /tvix/castore/src/fs/mod.rs
parent8fbdf72825843416dc1923d91cb20059cdbc07b1 (diff)
refactor(tvix): use AsRef<dyn …> instead of Deref<Target= …> r/7359
Removes some more needs for Arcs.

Change-Id: I9a9f4b81641c271de260e9ffa98313a32944d760
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10578
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Diffstat (limited to 'tvix/castore/src/fs/mod.rs')
-rw-r--r--tvix/castore/src/fs/mod.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/tvix/castore/src/fs/mod.rs b/tvix/castore/src/fs/mod.rs
index 2da072329d34..632dad84cf86 100644
--- a/tvix/castore/src/fs/mod.rs
+++ b/tvix/castore/src/fs/mod.rs
@@ -23,7 +23,6 @@ use fuse_backend_rs::abi::fuse_abi::stat64;
 use fuse_backend_rs::api::filesystem::{Context, FileSystem, FsOptions, ROOT_ID};
 use futures::StreamExt;
 use parking_lot::RwLock;
-use std::ops::Deref;
 use std::{
     collections::HashMap,
     io,
@@ -101,8 +100,8 @@ pub struct TvixStoreFs<BS, DS, RN> {
 
 impl<BS, DS, RN> TvixStoreFs<BS, DS, RN>
 where
-    BS: Deref<Target = dyn BlobService> + Clone + Send,
-    DS: Deref<Target = dyn DirectoryService> + Clone + Send + 'static,
+    BS: AsRef<dyn BlobService> + Clone + Send,
+    DS: AsRef<dyn DirectoryService> + Clone + Send + 'static,
     RN: RootNodes + Clone + 'static,
 {
     pub fn new(
@@ -157,7 +156,7 @@ where
                     .block_on(self.tokio_handle.spawn({
                         let directory_service = self.directory_service.clone();
                         let parent_digest = parent_digest.to_owned();
-                        async move { directory_service.get(&parent_digest).await }
+                        async move { directory_service.as_ref().get(&parent_digest).await }
                     }))
                     .unwrap()?
                     .ok_or_else(|| {
@@ -270,8 +269,8 @@ where
 
 impl<BS, DS, RN> FileSystem for TvixStoreFs<BS, DS, RN>
 where
-    BS: Deref<Target = dyn BlobService> + Clone + Send + 'static,
-    DS: Deref<Target = dyn DirectoryService> + Send + Clone + 'static,
+    BS: AsRef<dyn BlobService> + Clone + Send + 'static,
+    DS: AsRef<dyn DirectoryService> + Send + Clone + 'static,
     RN: RootNodes + Clone + 'static,
 {
     type Handle = u64;
@@ -496,7 +495,7 @@ where
 
                 let task = self
                     .tokio_handle
-                    .spawn(async move { blob_service.open_read(&blob_digest).await });
+                    .spawn(async move { blob_service.as_ref().open_read(&blob_digest).await });
 
                 let blob_reader = self.tokio_handle.block_on(task).unwrap();