pub struct TransactionLifecycle { /* private fields */ }Expand description
A small state machine shared by storage-backed domain transactions.
Implementations§
Source§impl TransactionLifecycle
impl TransactionLifecycle
Sourcepub const fn with_id(id: TransactionId) -> Self
pub const fn with_id(id: TransactionId) -> Self
Creates an open transaction with an existing identity.
Sourcepub const fn id(self) -> TransactionId
pub const fn id(self) -> TransactionId
Returns the transaction identity.
Sourcepub const fn state(self) -> TransactionState
pub const fn state(self) -> TransactionState
Returns the current state.
Sourcepub fn ensure_open(self) -> Result<()>
pub fn ensure_open(self) -> Result<()>
Ensures that a mutation may be staged.
§Errors
Returns ErrorKind::Conflict if the transaction is already closed.
Sourcepub fn mark_committed(&mut self) -> Result<()>
pub fn mark_committed(&mut self) -> Result<()>
Marks the transaction committed after the backend commit succeeds.
§Errors
Returns ErrorKind::Conflict if the transaction is already closed.
Sourcepub fn mark_rolled_back(&mut self) -> Result<()>
pub fn mark_rolled_back(&mut self) -> Result<()>
Marks the transaction rolled back after staged work is discarded.
§Errors
Returns ErrorKind::Conflict if the transaction is already closed.
Trait Implementations§
Source§impl Clone for TransactionLifecycle
impl Clone for TransactionLifecycle
Source§fn clone(&self) -> TransactionLifecycle
fn clone(&self) -> TransactionLifecycle
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 moreimpl Copy for TransactionLifecycle
Source§impl Debug for TransactionLifecycle
impl Debug for TransactionLifecycle
Source§impl Default for TransactionLifecycle
impl Default for TransactionLifecycle
impl Eq for TransactionLifecycle
Source§impl PartialEq for TransactionLifecycle
impl PartialEq for TransactionLifecycle
Source§fn eq(&self, other: &TransactionLifecycle) -> bool
fn eq(&self, other: &TransactionLifecycle) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TransactionLifecycle
Auto Trait Implementations§
impl Freeze for TransactionLifecycle
impl RefUnwindSafe for TransactionLifecycle
impl Send for TransactionLifecycle
impl Sync for TransactionLifecycle
impl Unpin for TransactionLifecycle
impl UnsafeUnpin for TransactionLifecycle
impl UnwindSafe for TransactionLifecycle
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