pub struct MvccTransactionManager { /* private fields */ }Expand description
Full MVCC Transaction Manager with WAL and Group Commit
Provides ACID transactions with:
- Multi-Version Concurrency Control
- WAL-based durability
- Group commit for high throughput
- SSI for serializability (optional)
Uses DashMap for version chains to reduce lock contention:
- Striped locking: O(1) contention with ~64 internal shards
- Lock-free reads via read() method for most cases
- Fine-grained per-key locking for writes
Implementations§
Source§impl MvccTransactionManager
impl MvccTransactionManager
Sourcepub fn new<P: AsRef<Path>, F>(wal_path: P, apply_fn: F) -> Result<Self>
pub fn new<P: AsRef<Path>, F>(wal_path: P, apply_fn: F) -> Result<Self>
Create a new MVCC transaction manager
Sourcepub fn begin(&self, isolation_level: IsolationLevel) -> Result<u64>
pub fn begin(&self, isolation_level: IsolationLevel) -> Result<u64>
Begin a new transaction with specified isolation level
Sourcepub fn begin_default(&self) -> Result<u64>
pub fn begin_default(&self) -> Result<u64>
Begin with default snapshot isolation
Sourcepub fn read(&self, txn_id: u64, key: &[u8]) -> Result<Option<Vec<u8>>>
pub fn read(&self, txn_id: u64, key: &[u8]) -> Result<Option<Vec<u8>>>
Read a key within a transaction
Sourcepub fn write(&self, txn_id: u64, key: Vec<u8>, value: Vec<u8>) -> Result<()>
pub fn write(&self, txn_id: u64, key: Vec<u8>, value: Vec<u8>) -> Result<()>
Write a key within a transaction
Sourcepub fn delete(&self, txn_id: u64, key: &[u8]) -> Result<bool>
pub fn delete(&self, txn_id: u64, key: &[u8]) -> Result<bool>
Delete a key within a transaction
Sourcepub fn recover(&self) -> Result<RecoveryStats>
pub fn recover(&self) -> Result<RecoveryStats>
Recover from WAL after crash
Sourcepub fn current_timestamp(&self) -> u64
pub fn current_timestamp(&self) -> u64
Get current timestamp
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Get active transaction count
Auto Trait Implementations§
impl !Freeze for MvccTransactionManager
impl !RefUnwindSafe for MvccTransactionManager
impl !UnwindSafe for MvccTransactionManager
impl Send for MvccTransactionManager
impl Sync for MvccTransactionManager
impl Unpin for MvccTransactionManager
impl UnsafeUnpin for MvccTransactionManager
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