about summary refs log tree commit diff
path: root/tvix/castore/src/import.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/import.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/import.rs')
-rw-r--r--tvix/castore/src/import.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/tvix/castore/src/import.rs b/tvix/castore/src/import.rs
index c4d410497235..cf4b42fb6826 100644
--- a/tvix/castore/src/import.rs
+++ b/tvix/castore/src/import.rs
@@ -7,7 +7,6 @@ use crate::proto::DirectoryNode;
 use crate::proto::FileNode;
 use crate::proto::SymlinkNode;
 use crate::Error as CastoreError;
-use std::ops::Deref;
 use std::os::unix::ffi::OsStrExt;
 use std::{
     collections::HashMap,
@@ -68,7 +67,7 @@ async fn process_entry<'a, BS>(
     maybe_directory: Option<Directory>,
 ) -> Result<Node, Error>
 where
-    BS: Deref<Target = dyn BlobService> + Clone,
+    BS: AsRef<dyn BlobService> + Clone,
 {
     let file_type = entry.file_type();
 
@@ -114,7 +113,7 @@ where
             .await
             .map_err(|e| Error::UnableToOpen(entry.path().to_path_buf(), e))?;
 
-        let mut writer = blob_service.open_write().await;
+        let mut writer = blob_service.as_ref().open_write().await;
 
         if let Err(e) = tokio::io::copy(&mut file, &mut writer).await {
             return Err(Error::UnableToRead(entry.path().to_path_buf(), e));
@@ -156,12 +155,12 @@ pub async fn ingest_path<'a, BS, DS, P>(
 ) -> Result<Node, Error>
 where
     P: AsRef<Path> + Debug,
-    BS: Deref<Target = dyn BlobService> + Clone,
-    DS: Deref<Target = &'a dyn DirectoryService>,
+    BS: AsRef<dyn BlobService> + Clone,
+    DS: AsRef<dyn DirectoryService>,
 {
     let mut directories: HashMap<PathBuf, Directory> = HashMap::default();
 
-    let mut directory_putter = directory_service.put_multiple_start();
+    let mut directory_putter = directory_service.as_ref().put_multiple_start();
 
     for entry in WalkDir::new(p.as_ref())
         .follow_links(false)