pub struct Transaction { /* private fields */ }Expand description
Transaction — snapshots the versions, performs modify operations, and commits/rolls back at the end.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub fn begin(cache: &ObjectCache, level: ConsistencyLevel) -> Self
pub fn begin(cache: &ObjectCache, level: ConsistencyLevel) -> Self
begin — Spec §B.7.4.1.
Sourcepub fn id(&self) -> TransactionId
pub fn id(&self) -> TransactionId
Transaction ID.
Sourcepub fn level(&self) -> ConsistencyLevel
pub fn level(&self) -> ConsistencyLevel
Consistency level.
Sourcepub fn state(&self) -> TransactionState
pub fn state(&self) -> TransactionState
Current state.
Sourcepub fn snapshot_size(&self) -> usize
pub fn snapshot_size(&self) -> usize
Number of objects in the snapshot.
Sourcepub fn expected_version(&self, id: &ObjectId) -> Option<u64>
pub fn expected_version(&self, id: &ObjectId) -> Option<u64>
Expected version of an object in the snapshot.
Sourcepub fn commit(
&mut self,
cache: &mut ObjectCache,
) -> Result<(), TransactionError>
pub fn commit( &mut self, cache: &mut ObjectCache, ) -> Result<(), TransactionError>
commit — Spec §B.7.4.4. Checks for all snapshotted objects
whether the version still matches; on conflict returns
OptimisticConflict and sets state → Aborted.
§Errors
Siehe TransactionError.
Sourcepub fn rollback(
&mut self,
cache: &mut ObjectCache,
) -> Result<(), TransactionError>
pub fn rollback( &mut self, cache: &mut ObjectCache, ) -> Result<(), TransactionError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Transaction
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnsafeUnpin for Transaction
impl UnwindSafe for Transaction
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