about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-03-18T13·17+0200
committerflokli <flokli@flokli.de>2024-03-18T16·10+0000
commit499bc2f7ee263e468e444784daddc4ba66349d2c (patch)
treebeba6cf3aa9e96ec93ac2a9b9d96b94532fb4010
parent8d177a18a5bae595e9662b8a6a38479517e7695f (diff)
refactor(tvix/castore/blobsvc): use B3Digest Display impl r/7730
We don't need to use BASE64 here on our own, B3Digest has a Display
impl.

This will also make sure the `b3:` digest is present in field values.

Change-Id: I0ce6ee0f7e7e99fb9b16872953a1b742e99be291
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11192
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
-rw-r--r--tvix/castore/src/blobservice/chunked_reader.rs6
-rw-r--r--tvix/castore/src/blobservice/combinator.rs6
2 files changed, 2 insertions, 10 deletions
diff --git a/tvix/castore/src/blobservice/chunked_reader.rs b/tvix/castore/src/blobservice/chunked_reader.rs
index 6ca0d2003226..e2a9f614c456 100644
--- a/tvix/castore/src/blobservice/chunked_reader.rs
+++ b/tvix/castore/src/blobservice/chunked_reader.rs
@@ -1,4 +1,3 @@
-use data_encoding::BASE64;
 use futures::TryStreamExt;
 use pin_project_lite::pin_project;
 use tokio::io::{AsyncRead, AsyncSeekExt};
@@ -222,10 +221,7 @@ where
                         .open_read(&chunk_digest.to_owned())
                         .await?
                         .ok_or_else(|| {
-                            warn!(
-                                chunk.digest = BASE64.encode(chunk_digest.as_slice()),
-                                "chunk not found"
-                            );
+                            warn!(chunk.digest = %chunk_digest, "chunk not found");
                             std::io::Error::new(std::io::ErrorKind::NotFound, "chunk not found")
                         })?;
 
diff --git a/tvix/castore/src/blobservice/combinator.rs b/tvix/castore/src/blobservice/combinator.rs
index d75cad62a629..067eff96f488 100644
--- a/tvix/castore/src/blobservice/combinator.rs
+++ b/tvix/castore/src/blobservice/combinator.rs
@@ -1,4 +1,3 @@
-use data_encoding::BASE64;
 use futures::{StreamExt, TryStreamExt};
 use tokio_util::io::{ReaderStream, StreamReader};
 use tonic::async_trait;
@@ -114,10 +113,7 @@ where
         let blob_service = blob_service.clone();
         async move {
             blob_service.open_read(&d.to_owned()).await?.ok_or_else(|| {
-                warn!(
-                    chunk.digest = BASE64.encode(digest.as_slice()),
-                    "chunk not found"
-                );
+                warn!(chunk.digest = %digest, "chunk not found");
                 std::io::Error::new(std::io::ErrorKind::NotFound, "chunk not found")
             })
         }