From c6a2e008d547cb4b29db80d3d494ccb6f1daf79f Mon Sep 17 00:00:00 2001 From: marvin-j97 Date: Thu, 24 Oct 2024 19:52:40 +0200 Subject: [PATCH 1/3] use triomphe arc --- Cargo.toml | 1 + src/slice.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 3dbd56b..9a361ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,7 @@ quick_cache = { version = "0.6.5", default-features = false } rustc-hash = "2.0.0" serde = { version = "1.0.204", optional = true, features = ["derive"] } tempfile = "3.12.0" +triomphe = { version = "0.1.12", default-features = false } xxhash-rust = { version = "0.8.12", features = ["xxh3"] } [dev-dependencies] diff --git a/src/slice.rs b/src/slice.rs index 0020988..9614a2d 100644 --- a/src/slice.rs +++ b/src/slice.rs @@ -3,7 +3,7 @@ // (found in the LICENSE-* files in the repository) use std::hash::Hash; -use std::sync::Arc; +use triomphe::Arc; /// An immutable byte slice that can be cloned without additional heap allocation #[derive(Debug, Clone, PartialEq, Eq, Hash, Ord, PartialOrd)] From 0fa30ccc4b9588dca228ebb290cfdf64d31c7e43 Mon Sep 17 00:00:00 2001 From: marvin-j97 Date: Fri, 25 Oct 2024 00:01:28 +0200 Subject: [PATCH 2/3] use more triomphe arc --- src/config.rs | 3 +++ src/id.rs | 3 ++- src/lib.rs | 1 + src/manifest.rs | 3 ++- src/mock.rs | 6 ++---- src/slice.rs | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/config.rs b/src/config.rs index 7ab391b..3870cd8 100644 --- a/src/config.rs +++ b/src/config.rs @@ -5,6 +5,9 @@ use crate::{blob_cache::BlobCache, compression::Compressor}; use std::sync::Arc; +// TODO: 2.0.0 use triomphe::Arc everywhere +// change blob cache API, so the user does not need to use Arc<> at all + /// Value log configuration pub struct Config { /// Target size of vLog segments diff --git a/src/id.rs b/src/id.rs index af7804e..782ec99 100644 --- a/src/id.rs +++ b/src/id.rs @@ -2,7 +2,8 @@ // This source code is licensed under both the Apache 2.0 and MIT License // (found in the LICENSE-* files in the repository) -use std::sync::{atomic::AtomicU64, Arc}; +use crate::Arc; +use std::sync::atomic::AtomicU64; #[allow(clippy::module_name_repetitions)] pub type SegmentId = u64; diff --git a/src/lib.rs b/src/lib.rs index 27acf0a..842db66 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -124,6 +124,7 @@ mod value_log; mod version; pub(crate) type HashMap = std::collections::HashMap; +pub(crate) use triomphe::Arc; pub use { blob_cache::BlobCache, diff --git a/src/manifest.rs b/src/manifest.rs index 9f7df5d..85ca9f8 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -2,6 +2,7 @@ // This source code is licensed under both the Apache 2.0 and MIT License // (found in the LICENSE-* files in the repository) +use crate::Arc; use crate::{ id::SegmentId, key_range::KeyRange, @@ -13,7 +14,7 @@ use std::{ io::{Cursor, Write}, marker::PhantomData, path::{Path, PathBuf}, - sync::{Arc, RwLock}, + sync::RwLock, }; pub const VLOG_MARKER: &str = ".vlog"; diff --git a/src/mock.rs b/src/mock.rs index 0cd2165..5f34824 100644 --- a/src/mock.rs +++ b/src/mock.rs @@ -2,11 +2,9 @@ // This source code is licensed under both the Apache 2.0 and MIT License // (found in the LICENSE-* files in the repository) +use crate::Arc; use crate::{value::UserKey, IndexReader, IndexWriter, ValueHandle}; -use std::{ - collections::BTreeMap, - sync::{Arc, RwLock}, -}; +use std::{collections::BTreeMap, sync::RwLock}; type MockIndexInner = RwLock>; diff --git a/src/slice.rs b/src/slice.rs index 9614a2d..44a426e 100644 --- a/src/slice.rs +++ b/src/slice.rs @@ -2,8 +2,8 @@ // This source code is licensed under both the Apache 2.0 and MIT License // (found in the LICENSE-* files in the repository) +use crate::Arc; use std::hash::Hash; -use triomphe::Arc; /// An immutable byte slice that can be cloned without additional heap allocation #[derive(Debug, Clone, PartialEq, Eq, Hash, Ord, PartialOrd)] From 13d13b444418a4d5d4a14a8f18bed84bac976535 Mon Sep 17 00:00:00 2001 From: marvin-j97 Date: Fri, 25 Oct 2024 00:02:52 +0200 Subject: [PATCH 3/3] 1.2.0 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 9a361ff..ddb4a72 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "value-log" description = "Value log implementation for key-value separated LSM storage" license = "MIT OR Apache-2.0" -version = "1.1.0" +version = "1.2.0" edition = "2021" rust-version = "1.74.0" readme = "README.md"