pub struct TxnIdManager { /* private fields */ }Expand description
Transaction ID manager that hands out IDs and tracks commit status.
Implementations§
Source§impl TxnIdManager
impl TxnIdManager
Sourcepub fn new() -> TxnIdManager
pub fn new() -> TxnIdManager
Create a new manager.
Sourcepub fn new_with_initial_txn_id(next_txn_id: u64) -> TxnIdManager
pub fn new_with_initial_txn_id(next_txn_id: u64) -> TxnIdManager
Create a new manager with a custom initial transaction ID. Used when loading persisted state from the catalog.
Sourcepub fn new_with_initial_state(
next_txn_id: u64,
last_committed: u64,
) -> TxnIdManager
pub fn new_with_initial_state( next_txn_id: u64, last_committed: u64, ) -> TxnIdManager
Create a new manager with custom initial state. Used when loading persisted state from the catalog.
Sourcepub fn current_next_txn_id(&self) -> u64
pub fn current_next_txn_id(&self) -> u64
Get the current next_txn_id value (for persistence).
Sourcepub fn begin_transaction(&self) -> TransactionSnapshot
pub fn begin_transaction(&self) -> TransactionSnapshot
Begin a new transaction and return its snapshot.
The snapshot captures both the allocated transaction ID and the latest committed ID at the moment the transaction starts. These two values are required to evaluate row visibility rules.
Sourcepub fn next_txn_id(&self) -> u64
pub fn next_txn_id(&self) -> u64
Convenience helper that returns only the allocated transaction ID.
Prefer TxnIdManager::begin_transaction when a snapshot is required.
Sourcepub fn mark_committed(&self, txn_id: u64)
pub fn mark_committed(&self, txn_id: u64)
Mark a transaction as committed and advance the global watermark.
Sourcepub fn mark_aborted(&self, txn_id: u64)
pub fn mark_aborted(&self, txn_id: u64)
Mark a transaction as aborted.
Sourcepub fn last_committed(&self) -> u64
pub fn last_committed(&self) -> u64
Return the latest committed transaction ID (snapshot watermark).
Trait Implementations§
Source§impl Clone for TxnIdManager
impl Clone for TxnIdManager
Source§fn clone(&self) -> TxnIdManager
fn clone(&self) -> TxnIdManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TxnIdManager
impl Debug for TxnIdManager
Source§impl Default for TxnIdManager
impl Default for TxnIdManager
Source§fn default() -> TxnIdManager
fn default() -> TxnIdManager
Auto Trait Implementations§
impl Freeze for TxnIdManager
impl RefUnwindSafe for TxnIdManager
impl Send for TxnIdManager
impl Sync for TxnIdManager
impl Unpin for TxnIdManager
impl UnwindSafe for TxnIdManager
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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