fix(tvix/castore/grpc/svc_wrapper): expose chunks() over gRPC

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>
This commit is contained in:
Florian Klink 2024-02-02 17:54:08 +02:00 committed by clbot
parent 9504015031
commit cb2cf3f6b7

View file

@ -97,9 +97,12 @@ where
.try_into() .try_into()
.map_err(|_e| Status::invalid_argument("invalid digest length"))?; .map_err(|_e| Status::invalid_argument("invalid digest length"))?;
match self.blob_service.has(&req_digest).await { match self.blob_service.chunks(&req_digest).await {
Ok(true) => Ok(Response::new(super::StatBlobResponse::default())), Ok(None) => Err(Status::not_found(format!("blob {} not found", &req_digest))),
Ok(false) => 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()), Err(e) => Err(e.into()),
} }
} }