diff --git a/foyer-storage/Cargo.toml b/foyer-storage/Cargo.toml index 6e02a93f..c1955f2d 100644 --- a/foyer-storage/Cargo.toml +++ b/foyer-storage/Cargo.toml @@ -31,7 +31,7 @@ fastrace = { workspace = true } flume = "0.11" foyer-common = { workspace = true } foyer-memory = { workspace = true } -fs4 = "0.9.1" +fs4 = { version = "0.12", default-features = false } futures = "0.3" hashbrown = { workspace = true } itertools = { workspace = true } @@ -46,7 +46,7 @@ serde = { workspace = true } thiserror = { workspace = true } tokio = { workspace = true } tracing = { workspace = true } -twox-hash = "1" +twox-hash = "2" zstd = "0.13" [dev-dependencies] diff --git a/foyer-storage/src/serde.rs b/foyer-storage/src/serde.rs index 2fbf6028..3f633f91 100644 --- a/foyer-storage/src/serde.rs +++ b/foyer-storage/src/serde.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::{fmt::Debug, hash::Hasher, io::Write, time::Instant}; +use std::{fmt::Debug, io::Write, time::Instant}; use foyer_common::{ code::{StorageKey, StorageValue}, @@ -30,15 +30,11 @@ pub struct Checksummer; impl Checksummer { pub fn checksum64(buf: &[u8]) -> u64 { - let mut hasher = XxHash64::with_seed(0); - hasher.write(buf); - hasher.finish() + XxHash64::oneshot(0, buf) } pub fn checksum32(buf: &[u8]) -> u32 { - let mut hasher = XxHash32::with_seed(0); - hasher.write(buf); - hasher.finish() as u32 + XxHash32::oneshot(0, buf) } }