pub struct TransactionManager<BaseCtx, StagingCtx>where
BaseCtx: TransactionContext + 'static,
StagingCtx: TransactionContext + 'static,{ /* private fields */ }Expand description
Transaction manager for coordinating sessions.
This is the top-level coordinator that creates sessions and manages the shared transaction ID allocator.
Implementations§
Source§impl<BaseCtx, StagingCtx> TransactionManager<BaseCtx, StagingCtx>where
BaseCtx: TransactionContext + 'static,
StagingCtx: TransactionContext + 'static,
impl<BaseCtx, StagingCtx> TransactionManager<BaseCtx, StagingCtx>where
BaseCtx: TransactionContext + 'static,
StagingCtx: TransactionContext + 'static,
pub fn new() -> TransactionManager<BaseCtx, StagingCtx>
Sourcepub fn new_with_initial_txn_id(
next_txn_id: u64,
) -> TransactionManager<BaseCtx, StagingCtx>
pub fn new_with_initial_txn_id( next_txn_id: u64, ) -> TransactionManager<BaseCtx, StagingCtx>
Create a new TransactionManager with a custom initial transaction ID.
Sourcepub fn new_with_initial_state(
next_txn_id: u64,
last_committed: u64,
) -> TransactionManager<BaseCtx, StagingCtx>
pub fn new_with_initial_state( next_txn_id: u64, last_committed: u64, ) -> TransactionManager<BaseCtx, StagingCtx>
Create a new TransactionManager with custom initial state.
Sourcepub fn create_session(
&self,
context: Arc<BaseCtx>,
) -> TransactionSession<BaseCtx, StagingCtx>
pub fn create_session( &self, context: Arc<BaseCtx>, ) -> TransactionSession<BaseCtx, StagingCtx>
Create a new session for transaction management.
Sourcepub fn txn_manager(&self) -> Arc<TxnIdManager>
pub fn txn_manager(&self) -> Arc<TxnIdManager>
Obtain the shared transaction ID manager.
Sourcepub fn has_active_transaction(&self) -> bool
pub fn has_active_transaction(&self) -> bool
Check if there’s an active transaction (checks if ANY session has a transaction).
Trait Implementations§
Source§impl<BaseCtx, StagingCtx> Default for TransactionManager<BaseCtx, StagingCtx>where
BaseCtx: TransactionContext + 'static,
StagingCtx: TransactionContext + 'static,
impl<BaseCtx, StagingCtx> Default for TransactionManager<BaseCtx, StagingCtx>where
BaseCtx: TransactionContext + 'static,
StagingCtx: TransactionContext + 'static,
Source§fn default() -> TransactionManager<BaseCtx, StagingCtx>
fn default() -> TransactionManager<BaseCtx, StagingCtx>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<BaseCtx, StagingCtx> !Freeze for TransactionManager<BaseCtx, StagingCtx>
impl<BaseCtx, StagingCtx> RefUnwindSafe for TransactionManager<BaseCtx, StagingCtx>
impl<BaseCtx, StagingCtx> Send for TransactionManager<BaseCtx, StagingCtx>
impl<BaseCtx, StagingCtx> Sync for TransactionManager<BaseCtx, StagingCtx>
impl<BaseCtx, StagingCtx> Unpin for TransactionManager<BaseCtx, StagingCtx>
impl<BaseCtx, StagingCtx> UnwindSafe for TransactionManager<BaseCtx, StagingCtx>
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> 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