diff --git a/Cargo.toml b/Cargo.toml index 3dbd56b..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" @@ -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/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 0020988..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 std::sync::Arc; /// An immutable byte slice that can be cloned without additional heap allocation #[derive(Debug, Clone, PartialEq, Eq, Hash, Ord, PartialOrd)]