pub struct SessionTransactionManager { /* private fields */ }Expand description
Manager for session transaction state.
Each session has its own SessionTransactionManager to track
its transaction state independently of other sessions.
Implementations§
Source§impl SessionTransactionManager
impl SessionTransactionManager
Sourcepub fn begin(&mut self) -> Result<u64, TransactionError>
pub fn begin(&mut self) -> Result<u64, TransactionError>
Begin a new transaction.
Returns an error if a transaction is already active.
Sourcepub fn commit(&mut self) -> Result<Vec<TransactionChange>, TransactionError>
pub fn commit(&mut self) -> Result<Vec<TransactionChange>, TransactionError>
Commit the current transaction.
Returns the changes to be applied to the shared database.
Sourcepub fn rollback(&mut self) -> Result<(), TransactionError>
pub fn rollback(&mut self) -> Result<(), TransactionError>
Rollback the current transaction.
Discards all uncommitted changes.
Sourcepub fn in_transaction(&self) -> bool
pub fn in_transaction(&self) -> bool
Check if a transaction is currently active.
Sourcepub fn transaction_id(&self) -> Option<u64>
pub fn transaction_id(&self) -> Option<u64>
Get the current transaction ID, if any.
Sourcepub fn current_mut(&mut self) -> Option<&mut TransactionState>
pub fn current_mut(&mut self) -> Option<&mut TransactionState>
Get mutable access to the current transaction state.
Sourcepub fn current(&self) -> Option<&TransactionState>
pub fn current(&self) -> Option<&TransactionState>
Get read access to the current transaction state.
Sourcepub fn record_insert(&mut self, table_name: String, row: Row)
pub fn record_insert(&mut self, table_name: String, row: Row)
Record an insert in the current transaction.
No-op if not in a transaction.
Sourcepub fn record_update(
&mut self,
table_name: String,
row_index: usize,
old_row: Row,
new_row: Row,
)
pub fn record_update( &mut self, table_name: String, row_index: usize, old_row: Row, new_row: Row, )
Record an update in the current transaction.
No-op if not in a transaction.
Sourcepub fn record_delete(&mut self, table_name: String, row_index: usize, row: Row)
pub fn record_delete(&mut self, table_name: String, row_index: usize, row: Row)
Record a delete in the current transaction.
No-op if not in a transaction.
Trait Implementations§
Source§impl Debug for SessionTransactionManager
impl Debug for SessionTransactionManager
Source§impl Default for SessionTransactionManager
impl Default for SessionTransactionManager
Source§fn default() -> SessionTransactionManager
fn default() -> SessionTransactionManager
Auto Trait Implementations§
impl Freeze for SessionTransactionManager
impl RefUnwindSafe for SessionTransactionManager
impl Send for SessionTransactionManager
impl Sync for SessionTransactionManager
impl Unpin for SessionTransactionManager
impl UnsafeUnpin for SessionTransactionManager
impl UnwindSafe for SessionTransactionManager
Blanket Implementations§
impl<T> Allocation for T
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request