about summary refs log tree commit diff
path: root/tvix/store/src/pathinfoservice/grpc.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-10-15T14·10+0300
committerclbot <clbot@tvl.fyi>2024-10-18T21·45+0000
commitbd6894d265738ca7463922d39cbc128c5dc0e6ec (patch)
tree6af2ed8ed6e6a3be7131c0fab4c6c20412aca4f2 /tvix/store/src/pathinfoservice/grpc.rs
parent98df0e4e34683db103d1b258ed7449676f647dae (diff)
fix(tvix/store/pathinfo): use gRPC NarCalculationService r/8833
If the PathInfoService is using gRPC, expose it via the
nar_calculation_service() method in the PathInfoService.

Also pass nar_calculation_service through in tha blanket impl.

This now causes a `tvix-store import` using the default config to not
fall back to `SimpleRenderer`, which will calculate the NAR hash and
size by downloading the uploaded blobs (and blobs it didn't need to
upload) locally, making such imports faster.

Change-Id: If2c3fe6584e9093cba322d2360f355a3923904ae
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12658
Tested-by: BuildkiteCI
Reviewed-by: edef <edef@edef.eu>
Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/store/src/pathinfoservice/grpc.rs')
-rw-r--r--tvix/store/src/pathinfoservice/grpc.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/tvix/store/src/pathinfoservice/grpc.rs b/tvix/store/src/pathinfoservice/grpc.rs
index d292b2a784f6..453044cba13d 100644
--- a/tvix/store/src/pathinfoservice/grpc.rs
+++ b/tvix/store/src/pathinfoservice/grpc.rs
@@ -8,7 +8,7 @@ use futures::stream::BoxStream;
 use nix_compat::nixbase32;
 use std::sync::Arc;
 use tonic::{async_trait, Code};
-use tracing::{instrument, Span};
+use tracing::{instrument, warn, Span};
 use tracing_indicatif::span_ext::IndicatifSpanExt;
 use tvix_castore::composition::{CompositionContext, ServiceBuilder};
 use tvix_castore::Error;
@@ -95,6 +95,13 @@ where
 
         Box::pin(stream)
     }
+
+    #[instrument(level = "trace", skip_all)]
+    fn nar_calculation_service(&self) -> Option<Box<dyn NarCalculationService>> {
+        Some(Box::new(GRPCPathInfoService {
+            grpc_client: self.grpc_client.clone(),
+        }) as Box<dyn NarCalculationService>)
+    }
 }
 
 #[async_trait]