Struct mvcc_cell::Transaction
source · pub struct Transaction<'a> { /* private fields */ }
Expand description
A mutable snapshot of the controlled MvccCell
s. Created via Mvcc::begin()
.
Implementations§
source§impl<'a> Transaction<'a>
impl<'a> Transaction<'a>
sourcepub fn replace<T: 'a + ?Sized>(
&mut self,
cell: &MvccCell<T>,
val: Box<T>
) -> Option<Box<T>>
pub fn replace<T: 'a + ?Sized>(
&mut self,
cell: &MvccCell<T>,
val: Box<T>
) -> Option<Box<T>>
Store a new value inside the cell.
Returns the old value iff it was previously written by this transaction
sourcepub fn revert<T: 'a + ?Sized>(&mut self, cell: &MvccCell<T>) -> Option<Box<T>>
pub fn revert<T: 'a + ?Sized>(&mut self, cell: &MvccCell<T>) -> Option<Box<T>>
Reverts this cell to its value at the beginning of the transaction.
Returns the pending value, if any.
sourcepub fn get_committed<T: 'a + ?Sized>(&self, cell: &MvccCell<T>) -> &T
pub fn get_committed<T: 'a + ?Sized>(&self, cell: &MvccCell<T>) -> &T
Get the value of this cell as of the start of the transaction
source§impl Transaction<'_>
impl Transaction<'_>
sourcepub fn try_commit(self) -> Result<(), Self>
pub fn try_commit(self) -> Result<(), Self>
Attempt to commit changes
Returns Err(self)
if any MvccCell
seen by this transaction has committed
changes since begin()
was called.
sourcepub fn can_commit(&self) -> bool
pub fn can_commit(&self) -> bool
Checks to see if there are any conflicts preventing this transaction from committing.
Note that, because of TOCTOU, try_commit
may still fail after this
returns true
.