From 7725eb53ad67730e92a3839a6c10925c668e5586 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 9 Jun 2023 12:26:34 +0300 Subject: refactor(tvix/store): use Box 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 Reviewed-by: tazjin Tested-by: BuildkiteCI --- tvix/store/src/nar/renderer.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tvix/store/src/nar/renderer.rs') 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( +pub fn calculate_size_and_sha256( root_node: &proto::node::Node, blob_service: &Box, - directory_service: DS, + directory_service: &Box, ) -> 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( /// 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( +pub fn write_nar( w: &mut W, proto_root_node: &proto::node::Node, blob_service: &Box, - directory_service: DS, + directory_service: &Box, ) -> 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( /// Process an intermediate node in the structure. /// This consumes the node. -fn walk_node( +fn walk_node( nar_node: nar::writer::Node, proto_node: &proto::node::Node, blob_service: &Box, - directory_service: DS, + directory_service: &Box, ) -> Result<(), RenderError> { match proto_node { proto::node::Node::Symlink(proto_symlink_node) => { -- cgit 1.4.1