feat(tvix/castore/blob/grpc_wrapper): add blob.digest field

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>
This commit is contained in:
Florian Klink 2024-04-14 16:55:08 +03:00 committed by clbot
parent 4a91197802
commit 7156697010

View file

@ -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>,