about summary refs log tree commit diff
path: root/tvix/store
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-03-11T19·24+0100
committerclbot <clbot@tvl.fyi>2023-03-13T08·46+0000
commit2fe7192dbc8787884934cb7623c0c85d12def7f8 (patch)
tree3062eeef7d7e69cb5916a0503f277bbb0665a110 /tvix/store
parent62ecfc7001a642b70aa7d2ff4bf2d5b5e15161e2 (diff)
refactor(tvix/store): use update_hasher in blobwriter r/5957
Make use of the helper function here as well.

Change-Id: Ia0afd84eb3903bb897ee6aee884dc291f3e4371c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8258
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store')
-rw-r--r--tvix/store/src/blobwriter.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/tvix/store/src/blobwriter.rs b/tvix/store/src/blobwriter.rs
index 3966df82df3b..beade0c9a11b 100644
--- a/tvix/store/src/blobwriter.rs
+++ b/tvix/store/src/blobwriter.rs
@@ -1,4 +1,4 @@
-use crate::chunkservice::{upload_chunk, ChunkService};
+use crate::chunkservice::{update_hasher, upload_chunk, ChunkService};
 use crate::{proto, Error};
 use rayon::prelude::*;
 use tracing::instrument;
@@ -59,12 +59,8 @@ impl<CS: ChunkService + std::marker::Sync> std::io::Write for BlobWriter<'_, CS>
         // calculate input_buf.len(), we need to return that later.
         let input_buf_len = input_buf.len();
 
-        // update calculate blob hash, and use rayon if data is > 128KiB.
-        if input_buf.len() > 128 * 1024 {
-            self.blob_hasher.update_rayon(input_buf);
-        } else {
-            self.blob_hasher.update(input_buf);
-        }
+        // update blob hash
+        update_hasher(&mut self.blob_hasher, input_buf);
 
         // prepend buf with existing data (from self.buf)
         let buf: Vec<u8> = {