pub struct UndoBuffer { /* private fields */ }Expand description
Accumulates undo records for a single write transaction.
Implementations§
Source§impl UndoBuffer
impl UndoBuffer
pub fn new() -> Self
Sourcepub fn record(
&mut self,
table_id: u64,
row_id: u64,
column: u32,
old_data: Vec<u8>,
)
pub fn record( &mut self, table_id: u64, row_id: u64, column: u32, old_data: Vec<u8>, )
Record the old value of a cell before it is overwritten.
Sourcepub fn drain(&mut self) -> Vec<UndoRecord>
pub fn drain(&mut self) -> Vec<UndoRecord>
Drain all records out of the buffer (consuming). Used when the caller needs to take ownership of the records for rollback application.
Sourcepub fn rollback<F>(&mut self, apply_fn: F) -> Result<(), StorageError>
pub fn rollback<F>(&mut self, apply_fn: F) -> Result<(), StorageError>
Apply all undo records in reverse order.
The apply_fn callback receives each undo record and should
write old_data back to the appropriate table/row/column.
Records are applied in reverse order (LIFO) so that the
last write is undone first — preserving intermediate states.
Trait Implementations§
Source§impl Debug for UndoBuffer
impl Debug for UndoBuffer
Source§impl Default for UndoBuffer
impl Default for UndoBuffer
Source§fn default() -> UndoBuffer
fn default() -> UndoBuffer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for UndoBuffer
impl RefUnwindSafe for UndoBuffer
impl Send for UndoBuffer
impl Sync for UndoBuffer
impl Unpin for UndoBuffer
impl UnsafeUnpin for UndoBuffer
impl UnwindSafe for UndoBuffer
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more