diff --git a/crates/filemeta/Cargo.toml b/crates/filemeta/Cargo.toml index 7f92441e..6f5e581a 100644 --- a/crates/filemeta/Cargo.toml +++ b/crates/filemeta/Cargo.toml @@ -15,7 +15,7 @@ time.workspace = true uuid = { workspace = true, features = ["v4", "fast-rng", "serde"] } tokio = { workspace = true, features = ["io-util", "macros", "sync"] } xxhash-rust = { version = "0.8.15", features = ["xxh64"] } - +bytes.workspace = true rustfs-utils = {workspace = true, features= ["hash"]} byteorder = "1.5.0" tracing.workspace = true diff --git a/crates/filemeta/src/fileinfo.rs b/crates/filemeta/src/fileinfo.rs index 1ae3c5af..b9d75496 100644 --- a/crates/filemeta/src/fileinfo.rs +++ b/crates/filemeta/src/fileinfo.rs @@ -1,5 +1,6 @@ use crate::error::{Error, Result}; use crate::headers::RESERVED_METADATA_PREFIX_LOWER; +use bytes::Bytes; use rmp_serde::Serializer; use rustfs_utils::HashAlgorithm; use serde::Deserialize; @@ -36,7 +37,7 @@ pub struct ObjectPartInfo { pub struct ChecksumInfo { pub part_number: usize, pub algorithm: HashAlgorithm, - pub hash: Vec, + pub hash: Bytes, } #[derive(Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Default, Clone)] diff --git a/ecstore/src/disk/local.rs b/ecstore/src/disk/local.rs index 8d83006c..25870964 100644 --- a/ecstore/src/disk/local.rs +++ b/ecstore/src/disk/local.rs @@ -703,7 +703,7 @@ impl LocalDisk { let meta = file.metadata().await.map_err(to_file_error)?; let file_size = meta.len() as usize; - bitrot_verify(Box::new(file), file_size, part_size, algo, sum.to_vec(), shard_size) + bitrot_verify(Box::new(file), file_size, part_size, algo, bytes::Bytes::copy_from_slice(sum), shard_size) .await .map_err(to_file_error)?; diff --git a/ecstore/src/erasure_coding/bitrot.rs b/ecstore/src/erasure_coding/bitrot.rs index 367bf207..63421d7b 100644 --- a/ecstore/src/erasure_coding/bitrot.rs +++ b/ecstore/src/erasure_coding/bitrot.rs @@ -1,3 +1,4 @@ +use bytes::Bytes; use pin_project_lite::pin_project; use rustfs_utils::{HashAlgorithm, read_full, write_all}; use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite}; @@ -174,7 +175,7 @@ pub async fn bitrot_verify( want_size: usize, part_size: usize, algo: HashAlgorithm, - _want: Vec, + _want: Bytes, // FIXME: useless parameter? mut shard_size: usize, ) -> std::io::Result<()> { let mut hash_buf = vec![0; algo.size()];