Skip to main content

TxnManager

Struct TxnManager 

Source
pub struct TxnManager { /* private fields */ }
Expand description

Transaction manager

Manages transaction lifecycle and MVCC timestamps.

Implementations§

Source§

impl TxnManager

Source

pub fn new() -> Self

Create a new transaction manager

Source

pub fn with_timeout(timeout: Duration) -> Self

Create with custom timeout

Source

pub fn begin(&self) -> TransactionId

Begin a new transaction with default isolation

Source

pub fn begin_with_isolation(&self, isolation: IsolationLevel) -> TransactionId

Begin a new transaction with specific isolation level

Source

pub fn commit(&self, txn_id: TransactionId) -> KernelResult<Timestamp>

Commit a transaction

Source

pub fn abort(&self, txn_id: TransactionId) -> KernelResult<()>

Abort a transaction

Source

pub fn is_active(&self, txn_id: TransactionId) -> bool

Check if a transaction is active

Source

pub fn snapshot_ts(&self, txn_id: TransactionId) -> KernelResult<Timestamp>

Get snapshot timestamp for a transaction

Source

pub fn record_read(&self, txn_id: TransactionId, table_id: u32, row_id: u64)

Record a read operation (for SSI)

Source

pub fn record_write(&self, txn_id: TransactionId, table_id: u32, row_id: u64)

Record a write operation

Source

pub fn set_last_lsn(&self, txn_id: TransactionId, lsn: LogSequenceNumber)

Update last LSN for a transaction

Source

pub fn min_active_snapshot(&self) -> Option<Timestamp>

Get minimum active snapshot timestamp (for GC)

Source

pub fn active_count(&self) -> usize

Get active transaction count

Source

pub fn cleanup(&self, retention: Duration)

Clean up completed transactions older than retention period

Source

pub fn check_timeouts(&self) -> Vec<TransactionId>

Check for transactions that have timed out

Source

pub fn current_timestamp(&self) -> Timestamp

Get current timestamp

Source

pub fn restore(&self, next_txn_id: TransactionId, current_ts: Timestamp)

Restore state after recovery

Trait Implementations§

Source§

impl Default for TxnManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.