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/store_io.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'tvix/store/src/store_io.rs') diff --git a/tvix/store/src/store_io.rs b/tvix/store/src/store_io.rs index 3820931e281f..ee302f3b58ba 100644 --- a/tvix/store/src/store_io.rs +++ b/tvix/store/src/store_io.rs @@ -29,17 +29,17 @@ use crate::{ /// This is to both cover cases of syntactically valid store paths, that exist /// on the filesystem (still managed by Nix), as well as being able to read /// files outside store paths. -pub struct TvixStoreIO { +pub struct TvixStoreIO { blob_service: Box, - directory_service: DS, + directory_service: Box, path_info_service: PS, std_io: StdIO, } -impl TvixStoreIO { +impl TvixStoreIO { pub fn new( blob_service: Box, - directory_service: DS, + directory_service: Box, path_info_service: PS, ) -> Self { Self { @@ -104,12 +104,9 @@ impl TvixStoreIO { .expect("error during import_path"); // Render the NAR - let (nar_size, nar_sha256) = calculate_size_and_sha256( - &root_node, - &self.blob_service, - self.directory_service.clone(), - ) - .expect("error during nar calculation"); // TODO: handle error + let (nar_size, nar_sha256) = + calculate_size_and_sha256(&root_node, &self.blob_service, &self.directory_service) + .expect("error during nar calculation"); // TODO: handle error // For given NAR sha256 digest and name, return the new [StorePath] this would have. let nar_hash_with_mode = @@ -175,7 +172,7 @@ fn calculate_nar_based_store_path(nar_sha256_digest: &[u8; 32], name: &str) -> S build_regular_ca_path(name, &nar_hash_with_mode, Vec::::new(), false).unwrap() } -impl EvalIO for TvixStoreIO { +impl EvalIO for TvixStoreIO { #[instrument(skip(self), ret, err)] fn path_exists(&self, path: &Path) -> Result { if let Ok((store_path, sub_path)) = -- cgit 1.4.1