pub struct OwnedTransactionSession { /* private fields */ }Expand description
A transaction session that serializes stream leases and owns exactly one terminal action.
Implementations§
Source§impl OwnedTransactionSession
impl OwnedTransactionSession
Sourcepub fn new(transaction: Box<dyn OwnedKVTransaction>) -> OwnedTransactionSession
pub fn new(transaction: Box<dyn OwnedKVTransaction>) -> OwnedTransactionSession
Wrap one backend-owned transaction.
Sourcepub fn status(&self) -> OwnedTransactionSessionStatus
pub fn status(&self) -> OwnedTransactionSessionStatus
Return the current transaction/lease lifecycle state.
Sourcepub fn acquire_lease(&self) -> Result<OwnedTransactionLease, Error>
pub fn acquire_lease(&self) -> Result<OwnedTransactionLease, Error>
Acquire a single active lease. A later lease may start only after normal exhaustion.
Sourcepub fn with_transaction<T>(
&self,
operation: impl FnOnce(&mut dyn OwnedKVTransaction) -> Result<T, Error>,
) -> Result<T, Error>
pub fn with_transaction<T>( &self, operation: impl FnOnce(&mut dyn OwnedKVTransaction) -> Result<T, Error>, ) -> Result<T, Error>
Run one finite compatibility operation without exposing the active lease.
This is intentionally distinct from a stream lease: the operation cannot retain a
cursor, and a successful or classified operation error releases the transaction as
committable. A panic or an abandoned lease remains conservative and marks the session
MustAbort through OwnedTransactionLease::drop.
Sourcepub fn commit(&self) -> Result<OwnedTransactionSessionStatus, Error>
pub fn commit(&self) -> Result<OwnedTransactionSessionStatus, Error>
Commit this owned transaction once.
Sourcepub fn rollback(&self) -> Result<OwnedTransactionSessionStatus, Error>
pub fn rollback(&self) -> Result<OwnedTransactionSessionStatus, Error>
Roll back this owned transaction once.
Trait Implementations§
Source§impl Clone for OwnedTransactionSession
impl Clone for OwnedTransactionSession
Source§fn clone(&self) -> OwnedTransactionSession
fn clone(&self) -> OwnedTransactionSession
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OwnedTransactionSession
impl Debug for OwnedTransactionSession
Source§impl OwnedTransactionSessionApi for OwnedTransactionSession
impl OwnedTransactionSessionApi for OwnedTransactionSession
Source§fn status(&self) -> OwnedTransactionSessionStatus
fn status(&self) -> OwnedTransactionSessionStatus
Return the current one-way lifecycle state.
Source§fn acquire_lease(&self) -> Result<OwnedTransactionLease, Error>
fn acquire_lease(&self) -> Result<OwnedTransactionLease, Error>
Acquire the only active stream lease for this transaction.
Auto Trait Implementations§
impl Freeze for OwnedTransactionSession
impl RefUnwindSafe for OwnedTransactionSession
impl Send for OwnedTransactionSession
impl Sync for OwnedTransactionSession
impl Unpin for OwnedTransactionSession
impl UnsafeUnpin for OwnedTransactionSession
impl UnwindSafe for OwnedTransactionSession
Blanket Implementations§
impl<T> Allocation for T
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
Mutably borrows from an owned value. Read more