about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-03-27T11·14+0100
committerflokli <flokli@flokli.de>2024-03-28T07·58+0000
commit40f65b363fb9826d5224cbce9d1c66cc70774735 (patch)
tree6d530c2ab0950c478f32d7179fb64a9e6c1c9895
parent3cb943460580cffb83b46c0ae3e7957eaf9170ef (diff)
refactor(tvix/store/nar/renderer): don't require AsRef r/7790
Previous CLs ensured BlobService and DirectoryService is implemented on
AsRef<dyn BlobService> and AsRef<dyn DirectoryService> respectively, so
there's no need to require AsRef in here.

Change-Id: I1e8b93188ca784e1b9a592f3d35fcf6b9df75c75
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11275
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
-rw-r--r--tvix/store/src/nar/renderer.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/tvix/store/src/nar/renderer.rs b/tvix/store/src/nar/renderer.rs
index 313397dcf31b..9ac363ff578d 100644
--- a/tvix/store/src/nar/renderer.rs
+++ b/tvix/store/src/nar/renderer.rs
@@ -23,8 +23,8 @@ pub async fn calculate_size_and_sha256<BS, DS>(
     directory_service: DS,
 ) -> Result<(u64, [u8; 32]), RenderError>
 where
-    BS: AsRef<dyn BlobService> + Send,
-    DS: AsRef<dyn DirectoryService> + Send,
+    BS: BlobService + Send,
+    DS: DirectoryService + Send,
 {
     let mut h = Sha256::new();
     let mut cw = CountWrite::from(&mut h);
@@ -79,8 +79,8 @@ pub async fn write_nar<W, BS, DS>(
 ) -> Result<(), RenderError>
 where
     W: AsyncWrite + Unpin + Send,
-    BS: AsRef<dyn BlobService> + Send,
-    DS: AsRef<dyn DirectoryService> + Send,
+    BS: BlobService + Send,
+    DS: DirectoryService + Send,
 {
     // Initialize NAR writer
     let mut w = w.compat_write();
@@ -109,8 +109,8 @@ async fn walk_node<BS, DS>(
     directory_service: DS,
 ) -> Result<(BS, DS), RenderError>
 where
-    BS: AsRef<dyn BlobService> + Send,
-    DS: AsRef<dyn DirectoryService> + Send,
+    BS: BlobService + Send,
+    DS: DirectoryService + Send,
 {
     match proto_node {
         castorepb::node::Node::Symlink(proto_symlink_node) => {
@@ -129,7 +129,6 @@ where
             })?;
 
             let blob_reader = match blob_service
-                .as_ref()
                 .open_read(&digest)
                 .await
                 .map_err(RenderError::StoreError)?
@@ -165,7 +164,6 @@ where
 
             // look it up with the directory service
             match directory_service
-                .as_ref()
                 .get(&digest)
                 .await
                 .map_err(|e| RenderError::StoreError(e.into()))?