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:
parent
4a91197802
commit
7156697010
1 changed files with 3 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
use crate::blobservice::BlobService;
|
use crate::blobservice::BlobService;
|
||||||
use core::pin::pin;
|
use core::pin::pin;
|
||||||
|
use data_encoding::BASE64;
|
||||||
use futures::{stream::BoxStream, TryFutureExt};
|
use futures::{stream::BoxStream, TryFutureExt};
|
||||||
use std::{
|
use std::{
|
||||||
collections::VecDeque,
|
collections::VecDeque,
|
||||||
|
@ -86,7 +87,7 @@ where
|
||||||
// https://github.com/tokio-rs/tokio/issues/2723#issuecomment-1534723933
|
// https://github.com/tokio-rs/tokio/issues/2723#issuecomment-1534723933
|
||||||
type ReadStream = BoxStream<'static, Result<super::BlobChunk, Status>>;
|
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(
|
async fn stat(
|
||||||
&self,
|
&self,
|
||||||
request: Request<super::StatBlobRequest>,
|
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(
|
async fn read(
|
||||||
&self,
|
&self,
|
||||||
request: Request<super::ReadBlobRequest>,
|
request: Request<super::ReadBlobRequest>,
|
||||||
|
|
Loading…
Reference in a new issue