pub struct OccLockBuckets(/* private fields */);Expand description
A pool of mutex locks used to validate optimistic transactions.
Only consulted when the validation policy is
OccValidationPolicy::ValidateParallel. Hand it to
OptimisticTransactionDBOptions::set_shared_lock_buckets to make several databases
validate against one pool instead of each allocating its own.
Cloning is cheap and produces another handle to the same pool. The pool itself lives
as long as any handle or any options value or database that was given one, so it is
fine to drop every Rust handle right after the set_shared_lock_buckets call.
Implementations§
Source§impl OccLockBuckets
impl OccLockBuckets
Sourcepub fn new(bucket_count: usize, cache_aligned: bool) -> Self
pub fn new(bucket_count: usize, cache_aligned: bool) -> Self
Allocates a pool of bucket_count locks.
More buckets mean less contention between transactions validating at the same
time, and more memory. cache_aligned pads each lock out to a cache line, which
avoids false sharing between neighbouring buckets at the cost of more memory
again. RocksDB has historically used false here.
§Panics
Panics if RocksDB could not allocate the pool.
Sourcepub fn approximate_memory_usage(&self) -> usize
pub fn approximate_memory_usage(&self) -> usize
Estimates how much memory this pool occupies, in bytes.
Trait Implementations§
Source§impl Clone for OccLockBuckets
impl Clone for OccLockBuckets
Source§fn clone(&self) -> OccLockBuckets
fn clone(&self) -> OccLockBuckets
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more