feat(tvix/castore): record errors for some failures in SimplePutter

This makes it easier to see what's going wrong when uploading multiple
Directories.

Change-Id: Ieb71424b9761777c5f719b2f365962644de82baf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11209
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2024-03-19 23:51:51 +02:00 committed by clbot
parent 283c3f0de4
commit 9fb213f47a

View file

@ -7,7 +7,9 @@ use async_stream::stream;
use futures::stream::BoxStream;
use std::collections::{HashSet, VecDeque};
use tonic::async_trait;
use tracing::instrument;
use tracing::warn;
use tracing::Level;
/// Traverses a [proto::Directory] from the root to the children.
///
@ -103,6 +105,7 @@ impl<DS: DirectoryService> SimplePutter<DS> {
#[async_trait]
impl<DS: DirectoryService + 'static> DirectoryPutter for SimplePutter<DS> {
#[instrument(skip_all, fields(directory.digest=%directory.digest()), err)]
async fn put(&mut self, directory: proto::Directory) -> Result<(), Error> {
if self.closed {
return Err(Error::StorageError("already closed".to_string()));
@ -116,6 +119,7 @@ impl<DS: DirectoryService + 'static> DirectoryPutter for SimplePutter<DS> {
Ok(())
}
#[instrument(skip_all, ret(Display, level=Level::TRACE), err)]
async fn close(&mut self) -> Result<B3Digest, Error> {
if self.closed {
return Err(Error::StorageError("already closed".to_string()));