pub trait MvccStore: Send + Sync {
// Required methods
fn mvcc_get(
&self,
key: &[u8],
snapshot_ts: u64,
txn_id: Option<u64>,
) -> Option<Vec<u8>>;
fn mvcc_put(
&self,
key: &[u8],
value: Option<Vec<u8>>,
txn_id: u64,
) -> Result<(), MvccStoreError>;
fn mvcc_commit_key(&self, key: &[u8], txn_id: u64, commit_ts: u64) -> bool;
fn mvcc_abort_key(&self, key: &[u8], txn_id: u64);
fn mvcc_has_conflict(&self, key: &[u8], txn_id: u64) -> bool;
fn mvcc_gc(&self, min_ts: u64) -> MvccGcStats;
fn mvcc_key_count(&self) -> usize;
}Expand description
Unified MVCC key-value store trait.
Provides a common interface for:
durable_storage::MvccMemTablemvcc_concurrent::VersionStoreepoch_mvcc::EpochMvccStore
Callers can program against this trait to be agnostic to the underlying concurrency / storage strategy.
Required Methods§
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn 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.
Sourcefn mvcc_gc(&self, min_ts: u64) -> MvccGcStats
fn mvcc_gc(&self, min_ts: u64) -> MvccGcStats
Run garbage collection. Returns statistics.
Sourcefn mvcc_key_count(&self) -> usize
fn mvcc_key_count(&self) -> usize
Number of distinct keys in the store.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".