about summary refs log tree commit diff
path: root/tvix/castore
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/castore')
-rw-r--r--tvix/castore/Cargo.toml7
-rw-r--r--tvix/castore/src/digests.rs7
2 files changed, 11 insertions, 3 deletions
diff --git a/tvix/castore/Cargo.toml b/tvix/castore/Cargo.toml
index 584e64adb8ec..a4b74cba1118 100644
--- a/tvix/castore/Cargo.toml
+++ b/tvix/castore/Cargo.toml
@@ -5,9 +5,12 @@ edition = "2021"
 
 [dependencies]
 async-stream = "0.3.5"
-blake3 = { version = "1.3.1", features = ["rayon", "std"] }
+async-tempfile = "0.4.0"
+blake3 = { version = "1.3.1", features = ["rayon", "std", "traits-preview"] }
+bstr = "1.6.0"
 bytes = "1.4.0"
 data-encoding = "2.3.3"
+digest = "0.10.7"
 futures = "0.3.30"
 lazy_static = "1.4.0"
 parking_lot = "0.12.1"
@@ -23,8 +26,6 @@ tower = "0.4.13"
 tracing = "0.1.37"
 url = "2.4.0"
 walkdir = "2.4.0"
-bstr = "1.6.0"
-async-tempfile = "0.4.0"
 
 [dependencies.fuse-backend-rs]
 optional = true
diff --git a/tvix/castore/src/digests.rs b/tvix/castore/src/digests.rs
index 137ed2669a8f..8a1938c1b649 100644
--- a/tvix/castore/src/digests.rs
+++ b/tvix/castore/src/digests.rs
@@ -26,6 +26,13 @@ impl From<B3Digest> for bytes::Bytes {
     }
 }
 
+impl From<digest::Output<blake3::Hasher>> for B3Digest {
+    fn from(value: digest::Output<blake3::Hasher>) -> Self {
+        let v = Into::<[u8; B3_LEN]>::into(value);
+        Self(Bytes::copy_from_slice(&v))
+    }
+}
+
 impl TryFrom<Vec<u8>> for B3Digest {
     type Error = Error;