Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triomphe arc #8

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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]
Expand Down
3 changes: 3 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<C: Compressor + Clone> {
/// Target size of vLog segments
Expand Down
3 changes: 2 additions & 1 deletion src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ mod value_log;
mod version;

pub(crate) type HashMap<K, V> = std::collections::HashMap<K, V, xxhash_rust::xxh3::Xxh3Builder>;
pub(crate) use triomphe::Arc;

pub use {
blob_cache::BlobCache,
Expand Down
3 changes: 2 additions & 1 deletion src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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";
Expand Down
6 changes: 2 additions & 4 deletions src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<BTreeMap<UserKey, (ValueHandle, u32)>>;

Expand Down
2 changes: 1 addition & 1 deletion src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
Loading