pub struct VersionStore { /* private fields */ }Expand description
Lock-free version store using DashMap
Provides O(1) key lookup + O(log V) version lookup per key.
Implementations§
Source§impl VersionStore
impl VersionStore
Sourcepub fn insert_uncommitted(
&self,
key: &[u8],
value: Option<Vec<u8>>,
txn_id: u64,
epoch: u32,
) -> Result<()>
pub fn insert_uncommitted( &self, key: &[u8], value: Option<Vec<u8>>, txn_id: u64, epoch: u32, ) -> Result<()>
Insert a new uncommitted version
Sourcepub fn get(
&self,
key: &[u8],
snapshot_ts: u64,
current_txn_id: Option<u64>,
) -> Option<Vec<u8>>
pub fn get( &self, key: &[u8], snapshot_ts: u64, current_txn_id: Option<u64>, ) -> Option<Vec<u8>>
Read value at snapshot timestamp
Sourcepub fn gc(&self, min_epoch: u32, min_snapshot_ts: u64) -> usize
pub fn gc(&self, min_epoch: u32, min_snapshot_ts: u64) -> usize
Run garbage collection
Removes old versions that are no longer visible to any reader.
Sourcepub fn stats(&self) -> &VersionStoreStats
pub fn stats(&self) -> &VersionStoreStats
Get statistics
Trait Implementations§
Source§impl Default for VersionStore
impl Default for VersionStore
Source§impl MvccStore for VersionStore
impl MvccStore for VersionStore
Source§fn mvcc_get(
&self,
key: &[u8],
snapshot_ts: u64,
txn_id: Option<u64>,
) -> Option<Vec<u8>>
fn mvcc_get( &self, key: &[u8], snapshot_ts: u64, txn_id: Option<u64>, ) -> Option<Vec<u8>>
Read the visible value at
snapshot_ts, optionally seeing own writes
from txn_id.Source§fn mvcc_put(
&self,
key: &[u8],
value: Option<Vec<u8>>,
txn_id: u64,
) -> Result<(), MvccStoreError>
fn mvcc_put( &self, key: &[u8], value: Option<Vec<u8>>, txn_id: u64, ) -> Result<(), MvccStoreError>
Write a value (or tombstone
None) as uncommitted for the given transaction.Source§fn mvcc_commit_key(&self, key: &[u8], txn_id: u64, commit_ts: u64) -> bool
fn mvcc_commit_key(&self, key: &[u8], txn_id: u64, commit_ts: u64) -> bool
Commit one key’s uncommitted write. Returns
true if found and committed.Source§fn mvcc_abort_key(&self, key: &[u8], txn_id: u64)
fn mvcc_abort_key(&self, key: &[u8], txn_id: u64)
Abort one key’s uncommitted write.
Source§fn mvcc_has_conflict(&self, key: &[u8], txn_id: u64) -> bool
fn mvcc_has_conflict(&self, key: &[u8], txn_id: u64) -> bool
Check if there’s an uncommitted write conflict on a key.
Source§fn mvcc_gc(&self, min_ts: u64) -> MvccGcStats
fn mvcc_gc(&self, min_ts: u64) -> MvccGcStats
Run garbage collection. Returns statistics.
Source§fn mvcc_key_count(&self) -> usize
fn mvcc_key_count(&self) -> usize
Number of distinct keys in the store.
Auto Trait Implementations§
impl !Freeze for VersionStore
impl !RefUnwindSafe for VersionStore
impl Send for VersionStore
impl Sync for VersionStore
impl Unpin for VersionStore
impl UnsafeUnpin for VersionStore
impl UnwindSafe for VersionStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more