pub struct TransactionRecord { /* private fields */ }Expand description
The storage-facing identity and state of a transaction.
Implementations§
Source§impl TransactionRecord
impl TransactionRecord
Sourcepub const fn new(id: TransactionId, base_snapshot: SnapshotId) -> Self
pub const fn new(id: TransactionId, base_snapshot: SnapshotId) -> Self
Create a transaction record in the only valid initial state.
Sourcepub const fn with_artifact(self, artifact: BlobId) -> Self
pub const fn with_artifact(self, artifact: BlobId) -> Self
Bind an immutable content-addressed transaction artifact before persistence.
Sourcepub const fn id(&self) -> TransactionId
pub const fn id(&self) -> TransactionId
Return the transaction identity.
Sourcepub const fn base_snapshot(&self) -> SnapshotId
pub const fn base_snapshot(&self) -> SnapshotId
Return the immutable base snapshot identity.
Sourcepub const fn state(&self) -> TransactionState
pub const fn state(&self) -> TransactionState
Return the current persisted state.
Sourcepub const fn artifact(&self) -> Option<BlobId>
pub const fn artifact(&self) -> Option<BlobId>
Return the immutable transaction artifact identity, when one is retained.
Sourcepub const fn approval(&self) -> Option<ApprovalGrant>
pub const fn approval(&self) -> Option<ApprovalGrant>
Return the exact independent approval grant, when one exists.
Sourcepub fn transition(
&mut self,
next: TransactionState,
) -> Result<(), TransitionError>
pub fn transition( &mut self, next: TransactionState, ) -> Result<(), TransitionError>
Apply a valid state transition or leave the record unchanged.
§Errors
Returns TransitionError when next is not reachable from the current state.
Trait Implementations§
Source§impl Clone for TransactionRecord
impl Clone for TransactionRecord
Source§fn clone(&self) -> TransactionRecord
fn clone(&self) -> TransactionRecord
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 TransactionRecord
impl Debug for TransactionRecord
impl Eq for TransactionRecord
Source§impl PartialEq for TransactionRecord
impl PartialEq for TransactionRecord
impl StructuralPartialEq for TransactionRecord
Auto Trait Implementations§
impl Freeze for TransactionRecord
impl RefUnwindSafe for TransactionRecord
impl Send for TransactionRecord
impl Sync for TransactionRecord
impl Unpin for TransactionRecord
impl UnsafeUnpin for TransactionRecord
impl UnwindSafe for TransactionRecord
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