about summary refs log tree commit diff
path: root/tvix/castore
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-04-14T13·55+0300
committerclbot <clbot@tvl.fyi>2024-04-15T19·32+0000
commit71566970104bc99c8400c2d4920334dcd8471519 (patch)
treed1de72359cae07ed0d8fd9f9523198b04ec6e516 /tvix/castore
parent4a91197802edbe6257e52cd20cd418122d733c26 (diff)
feat(tvix/castore/blob/grpc_wrapper): add blob.digest field r/7934
We're receiving bytes over the wire, and encode them the same way
B3Digest does internally, but don't use it for formatting, as we're
discarding that string.

In case the sent bytes don't have the right length, the string will be
short, but it's better to still have it as a field, even if it's not a
valid b3 digest.

Change-Id: I6ef08275d51c8a0d98f5e46844b15dfd05d17cd8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11436
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Diffstat (limited to 'tvix/castore')
-rw-r--r--tvix/castore/src/proto/grpc_blobservice_wrapper.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/tvix/castore/src/proto/grpc_blobservice_wrapper.rs b/tvix/castore/src/proto/grpc_blobservice_wrapper.rs
index a7f84dbe6077..41bd0698ec98 100644
--- a/tvix/castore/src/proto/grpc_blobservice_wrapper.rs
+++ b/tvix/castore/src/proto/grpc_blobservice_wrapper.rs
@@ -1,5 +1,6 @@
 use crate::blobservice::BlobService;
 use core::pin::pin;
+use data_encoding::BASE64;
 use futures::{stream::BoxStream, TryFutureExt};
 use std::{
     collections::VecDeque,
@@ -86,7 +87,7 @@ where
     // https://github.com/tokio-rs/tokio/issues/2723#issuecomment-1534723933
     type ReadStream = BoxStream<'static, Result<super::BlobChunk, Status>>;
 
-    #[instrument(skip_all)]
+    #[instrument(skip_all, fields(blob.digest=format!("b3:{}", BASE64.encode(&request.get_ref().digest))))]
     async fn stat(
         &self,
         request: Request<super::StatBlobRequest>,
@@ -110,7 +111,7 @@ where
         }
     }
 
-    #[instrument(skip_all)]
+    #[instrument(skip_all, fields(blob.digest=format!("b3:{}", BASE64.encode(&request.get_ref().digest))))]
     async fn read(
         &self,
         request: Request<super::ReadBlobRequest>,