about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-02-02T15·54+0200
committerclbot <clbot@tvl.fyi>2024-02-02T16·27+0000
commitcb2cf3f6b774bbd8f214e603f7e7f5610e70f78a (patch)
tree2cd3b8c12fa50fd95716b8c0258a3a8ab026afbe
parent9504015031a7299f22a9827ff0eded74a95c66f8 (diff)
fix(tvix/castore/grpc/svc_wrapper): expose chunks() over gRPC r/7471
The Stat() method was just always signalling no granular chunks are
available. However, as we now have a .chunks() method, we can expose it
over gRPC.

Change-Id: I74f0890ae083f301bb0cec62f1ea4a95463ac590
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10736
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
-rw-r--r--tvix/castore/src/proto/grpc_blobservice_wrapper.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/tvix/castore/src/proto/grpc_blobservice_wrapper.rs b/tvix/castore/src/proto/grpc_blobservice_wrapper.rs
index 33f9a73ea431..9f3f944da26f 100644
--- a/tvix/castore/src/proto/grpc_blobservice_wrapper.rs
+++ b/tvix/castore/src/proto/grpc_blobservice_wrapper.rs
@@ -97,9 +97,12 @@ where
             .try_into()
             .map_err(|_e| Status::invalid_argument("invalid digest length"))?;
 
-        match self.blob_service.has(&req_digest).await {
-            Ok(true) => Ok(Response::new(super::StatBlobResponse::default())),
-            Ok(false) => Err(Status::not_found(format!("blob {} not found", &req_digest))),
+        match self.blob_service.chunks(&req_digest).await {
+            Ok(None) => Err(Status::not_found(format!("blob {} not found", &req_digest))),
+            Ok(Some(chunk_metas)) => Ok(Response::new(super::StatBlobResponse {
+                chunks: chunk_metas,
+                ..Default::default()
+            })),
             Err(e) => Err(e.into()),
         }
     }