diff options
author | Florian Klink <flokli@flokli.de> | 2023-07-20T10·37+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-07-21T19·01+0000 |
commit | a6580748aabe7fcbea735396ac700661b6c53e87 (patch) | |
tree | fab2df50c860f6ddc6730693223aa42e0416dca0 /tvix/store/src/nar/renderer.rs | |
parent | 72e82ffcb11b1aaf1f1cc8db4189ced5ec0aa42e (diff) |
feat(tvix/store/digests): use bytes::Bytes instead of Vec<u8> r/6437
This will save us some copies, because a clone will simply create an additional pointer to the same data. Change-Id: I017a5d6b4c85a861b5541ebad2858ad4fbf8e8fa Reviewed-on: https://cl.tvl.fyi/c/depot/+/8978 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store/src/nar/renderer.rs')
-rw-r--r-- | tvix/store/src/nar/renderer.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tvix/store/src/nar/renderer.rs b/tvix/store/src/nar/renderer.rs index 518854c09c45..e2119ae0796d 100644 --- a/tvix/store/src/nar/renderer.rs +++ b/tvix/store/src/nar/renderer.rs @@ -3,7 +3,6 @@ use crate::{ blobservice::BlobService, directoryservice::DirectoryService, proto::{self, NamedNode}, - B3Digest, }; use count_write::CountWrite; use nix_compat::nar; @@ -65,7 +64,7 @@ fn walk_node( .map_err(RenderError::NARWriterError)?; } proto::node::Node::File(proto_file_node) => { - let digest = B3Digest::from_vec(proto_file_node.digest.clone()).map_err(|_e| { + let digest = proto_file_node.digest.clone().try_into().map_err(|_e| { warn!( file_node = ?proto_file_node, "invalid digest length in file node", @@ -96,8 +95,11 @@ fn walk_node( .map_err(RenderError::NARWriterError)?; } proto::node::Node::Directory(proto_directory_node) => { - let digest = - B3Digest::from_vec(proto_directory_node.digest.to_vec()).map_err(|_e| { + let digest = proto_directory_node + .digest + .clone() + .try_into() + .map_err(|_e| { RenderError::StoreError(crate::Error::StorageError( "invalid digest len in directory node".to_string(), )) |