diff options
author | Ilan Joselevich <personal@ilanjoselevich.com> | 2024-07-26T20·46+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-08-01T13·20+0000 |
commit | 41dc9ee6a2eddb9d378b12e6fdf28336499bff83 (patch) | |
tree | adeb7be66eeb628d2c765d10c836b6929be844e0 /tvix/castore/src/digests.rs | |
parent | 87d4b00ff54b5726c7e26ed456f0c5285e506a6b (diff) |
feat(tvix/castore): add RedbDirectoryService r/8437
This provides a DirectoryService implementation which uses redb (https://github.com/cberner/redb) as the database. It provides both in-memory and persistent on-filesystem implementations. Change-Id: Id8f7c812e2cf401cccd1c382b19907b17a6887bc Reviewed-on: https://cl.tvl.fyi/c/depot/+/12038 Tested-by: BuildkiteCI Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com> Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/castore/src/digests.rs')
-rw-r--r-- | tvix/castore/src/digests.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tvix/castore/src/digests.rs b/tvix/castore/src/digests.rs index 2311c95c4ddc..ef9a7326b3fb 100644 --- a/tvix/castore/src/digests.rs +++ b/tvix/castore/src/digests.rs @@ -26,6 +26,11 @@ impl From<B3Digest> for bytes::Bytes { } } +impl From<blake3::Hash> for B3Digest { + fn from(value: blake3::Hash) -> Self { + Self(Bytes::copy_from_slice(value.as_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); @@ -67,6 +72,12 @@ impl From<&[u8; B3_LEN]> for B3Digest { } } +impl From<B3Digest> for [u8; B3_LEN] { + fn from(value: B3Digest) -> Self { + value.0.to_vec().try_into().unwrap() + } +} + impl Clone for B3Digest { fn clone(&self) -> Self { Self(self.0.to_owned()) |