Skip to main content

MvccStore

Trait MvccStore 

Source
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::MvccMemTable
  • mvcc_concurrent::VersionStore
  • epoch_mvcc::EpochMvccStore

Callers can program against this trait to be agnostic to the underlying concurrency / storage strategy.

Required Methods§

Source

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>

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

Commit one key’s uncommitted write. Returns true if found and committed.

Source

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

Check if there’s an uncommitted write conflict on a key.

Source

fn mvcc_gc(&self, min_ts: u64) -> MvccGcStats

Run garbage collection. Returns statistics.

Source

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".

Implementors§