From 2fe7192dbc8787884934cb7623c0c85d12def7f8 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sat, 11 Mar 2023 20:24:07 +0100 Subject: [PATCH] refactor(tvix/store): use update_hasher in blobwriter Make use of the helper function here as well. Change-Id: Ia0afd84eb3903bb897ee6aee884dc291f3e4371c Reviewed-on: https://cl.tvl.fyi/c/depot/+/8258 Reviewed-by: raitobezarius Autosubmit: flokli Reviewed-by: tazjin Tested-by: BuildkiteCI --- tvix/store/src/blobwriter.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tvix/store/src/blobwriter.rs b/tvix/store/src/blobwriter.rs index 3966df82d..beade0c9a 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 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 = {