diff options
author | Florian Klink <flokli@flokli.de> | 2023-06-08T20·00+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-06-12T10·15+0000 |
commit | 8d05c0ceaa9bddb7fdaab436730f093eb16374a2 (patch) | |
tree | 33e034ae01b219d413247f1f93ea383133bd8062 /tvix/store/src/bin/tvix-store.rs | |
parent | 27ff98000b0cdf0ed30eb8837c7d44cd3e79d32f (diff) |
refactor(tvix/src/nar): drop NARCalculationService r/6270
There's only one way to calculate NAR files, by walking through them. Things like caching such replies should be done closer to where we use these, composing NARCalculationService doesn't actually give us much. Instead, expose two functions, `nar::calculate_size_and_sha256` and `nar::writer_nar`, the latter writing NAR to a writer, the former using write_nar to only keeping the NAR size and digest. Change-Id: Ie5d2cfea35470fdbb5cbf9da1136b0cdf0250266 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8723 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/store/src/bin/tvix-store.rs')
-rw-r--r-- | tvix/store/src/bin/tvix-store.rs | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/tvix/store/src/bin/tvix-store.rs b/tvix/store/src/bin/tvix-store.rs index 8fe62e5b5b2e..49c8c9ec34eb 100644 --- a/tvix/store/src/bin/tvix-store.rs +++ b/tvix/store/src/bin/tvix-store.rs @@ -11,8 +11,6 @@ use tvix_store::blobservice::GRPCBlobService; use tvix_store::blobservice::SledBlobService; use tvix_store::directoryservice::GRPCDirectoryService; use tvix_store::directoryservice::SledDirectoryService; -use tvix_store::nar::GRPCNARCalculationService; -use tvix_store::nar::NonCachingNARCalculationService; use tvix_store::pathinfoservice::GRPCPathInfoService; use tvix_store::pathinfoservice::SledPathInfoService; use tvix_store::proto::blob_service_client::BlobServiceClient; @@ -102,6 +100,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { Commands::Daemon { listen_address } => { // initialize stores let blob_service = SledBlobService::new("blobs.sled".into())?; + let boxed_blob_service: Box<dyn BlobService> = Box::new(blob_service.clone()); + let boxed_blob_service2: Box<dyn BlobService> = Box::new(blob_service); let directory_service = SledDirectoryService::new("directories.sled".into())?; let path_info_service = SledPathInfoService::new("pathinfo.sled".into())?; @@ -112,22 +112,18 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { let mut server = Server::builder(); - let nar_calculation_service = NonCachingNARCalculationService::new( - Box::new(blob_service.clone()), - directory_service.clone(), - ); - #[allow(unused_mut)] let mut router = server .add_service(BlobServiceServer::new(GRPCBlobServiceWrapper::from( - Box::new(blob_service) as Box<dyn BlobService>, + boxed_blob_service, ))) .add_service(DirectoryServiceServer::new( - GRPCDirectoryServiceWrapper::from(directory_service), + GRPCDirectoryServiceWrapper::from(directory_service.clone()), )) .add_service(PathInfoServiceServer::new(GRPCPathInfoServiceWrapper::new( path_info_service, - nar_calculation_service, + boxed_blob_service2, + directory_service, ))); #[cfg(feature = "reflection")] @@ -153,14 +149,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { PathInfoServiceClient::connect("http://[::1]:8000").await?; let path_info_service = GRPCPathInfoService::from_client(path_info_service_client.clone()); - let nar_calculation_service = - GRPCNARCalculationService::from_client(path_info_service_client); let io = Arc::new(TvixStoreIO::new( Box::new(blob_service), directory_service, path_info_service, - nar_calculation_service, )); let tasks = paths |