pub struct TxnManager { /* private fields */ }Expand description
Transaction manager
Manages transaction lifecycle and MVCC timestamps.
Implementations§
Source§impl TxnManager
impl TxnManager
Sourcepub fn with_timeout(timeout: Duration) -> Self
pub fn with_timeout(timeout: Duration) -> Self
Create with custom timeout
Sourcepub fn begin(&self) -> TransactionId
pub fn begin(&self) -> TransactionId
Begin a new transaction with default isolation
Sourcepub fn begin_with_isolation(&self, isolation: IsolationLevel) -> TransactionId
pub fn begin_with_isolation(&self, isolation: IsolationLevel) -> TransactionId
Begin a new transaction with specific isolation level
Sourcepub fn commit(&self, txn_id: TransactionId) -> KernelResult<Timestamp>
pub fn commit(&self, txn_id: TransactionId) -> KernelResult<Timestamp>
Commit a transaction
Sourcepub fn abort(&self, txn_id: TransactionId) -> KernelResult<()>
pub fn abort(&self, txn_id: TransactionId) -> KernelResult<()>
Abort a transaction
Sourcepub fn is_active(&self, txn_id: TransactionId) -> bool
pub fn is_active(&self, txn_id: TransactionId) -> bool
Check if a transaction is active
Sourcepub fn snapshot_ts(&self, txn_id: TransactionId) -> KernelResult<Timestamp>
pub fn snapshot_ts(&self, txn_id: TransactionId) -> KernelResult<Timestamp>
Get snapshot timestamp for a transaction
Sourcepub fn record_read(&self, txn_id: TransactionId, table_id: u32, row_id: u64)
pub fn record_read(&self, txn_id: TransactionId, table_id: u32, row_id: u64)
Record a read operation (for SSI)
Sourcepub fn record_write(&self, txn_id: TransactionId, table_id: u32, row_id: u64)
pub fn record_write(&self, txn_id: TransactionId, table_id: u32, row_id: u64)
Record a write operation
Sourcepub fn set_last_lsn(&self, txn_id: TransactionId, lsn: LogSequenceNumber)
pub fn set_last_lsn(&self, txn_id: TransactionId, lsn: LogSequenceNumber)
Update last LSN for a transaction
Sourcepub fn min_active_snapshot(&self) -> Option<Timestamp>
pub fn min_active_snapshot(&self) -> Option<Timestamp>
Get minimum active snapshot timestamp (for GC)
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Get active transaction count
Sourcepub fn cleanup(&self, retention: Duration)
pub fn cleanup(&self, retention: Duration)
Clean up completed transactions older than retention period
Sourcepub fn check_timeouts(&self) -> Vec<TransactionId> ⓘ
pub fn check_timeouts(&self) -> Vec<TransactionId> ⓘ
Check for transactions that have timed out
Sourcepub fn current_timestamp(&self) -> Timestamp
pub fn current_timestamp(&self) -> Timestamp
Get current timestamp
Sourcepub fn restore(&self, next_txn_id: TransactionId, current_ts: Timestamp)
pub fn restore(&self, next_txn_id: TransactionId, current_ts: Timestamp)
Restore state after recovery
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TxnManager
impl !RefUnwindSafe for TxnManager
impl Send for TxnManager
impl Sync for TxnManager
impl Unpin for TxnManager
impl UnwindSafe for TxnManager
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
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