about summary refs log tree commit diff
path: root/tvix/store/src/nar/renderer.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-06-09T09·26+0300
committerclbot <clbot@tvl.fyi>2023-06-12T10·24+0000
commit7725eb53ad67730e92a3839a6c10925c668e5586 (patch)
tree82b8abf8e52630039d2a0cd3ae8b251c32e863bd /tvix/store/src/nar/renderer.rs
parent6f85dbfc06c4fa96deb968cfeb7e98ba36e95043 (diff)
refactor(tvix/store): use Box<dyn DirectoryService> r/6272
Once we support configuring services at runtime, we don't know what
DirectoryService we're using at compile time.

This also means, we can't explicitly use the is_closed method from
GRPCPutter, without making it part of the DirectoryPutter itself.

Change-Id: Icd2a1ec4fc5649a6cd15c9cc7db4c2b473630431
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8727
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store/src/nar/renderer.rs')
-rw-r--r--tvix/store/src/nar/renderer.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/tvix/store/src/nar/renderer.rs b/tvix/store/src/nar/renderer.rs
index 80bf9bc6d816..97dfcfee6e32 100644
--- a/tvix/store/src/nar/renderer.rs
+++ b/tvix/store/src/nar/renderer.rs
@@ -13,10 +13,10 @@ use tracing::warn;
 
 /// Invoke [render_nar], and return the size and sha256 digest of the produced
 /// NAR output.
-pub fn calculate_size_and_sha256<DS: DirectoryService + Clone>(
+pub fn calculate_size_and_sha256(
     root_node: &proto::node::Node,
     blob_service: &Box<dyn BlobService>,
-    directory_service: DS,
+    directory_service: &Box<dyn DirectoryService>,
 ) -> Result<(u64, [u8; 32]), RenderError> {
     let h = Sha256::new();
     let mut cw = CountWrite::from(h);
@@ -30,11 +30,11 @@ pub fn calculate_size_and_sha256<DS: DirectoryService + Clone>(
 /// and uses the passed blob_service and directory_service to
 /// perform the necessary lookups as it traverses the structure.
 /// The contents in NAR serialization are writen to the passed [std::io::Write].
-pub fn write_nar<W: std::io::Write, DS: DirectoryService + Clone>(
+pub fn write_nar<W: std::io::Write>(
     w: &mut W,
     proto_root_node: &proto::node::Node,
     blob_service: &Box<dyn BlobService>,
-    directory_service: DS,
+    directory_service: &Box<dyn DirectoryService>,
 ) -> Result<(), RenderError> {
     // Initialize NAR writer
     let nar_root_node = nar::writer::open(w).map_err(RenderError::NARWriterError)?;
@@ -49,11 +49,11 @@ pub fn write_nar<W: std::io::Write, DS: DirectoryService + Clone>(
 
 /// Process an intermediate node in the structure.
 /// This consumes the node.
-fn walk_node<DS: DirectoryService + Clone>(
+fn walk_node(
     nar_node: nar::writer::Node,
     proto_node: &proto::node::Node,
     blob_service: &Box<dyn BlobService>,
-    directory_service: DS,
+    directory_service: &Box<dyn DirectoryService>,
 ) -> Result<(), RenderError> {
     match proto_node {
         proto::node::Node::Symlink(proto_symlink_node) => {