pub struct Recover { /* private fields */ }Expand description
Intermediate recover status to select witch transactions to commit or rollback and list witch transactions are in a intermediate state
§Example
let mut recover = Persy::recover("./target/recover_example.persy", Config::new())?;
for (tx_id,status) in recover.list_transactions() {
// Check the transaction if can be committed using the tx_id
if true {
// if so commit the tx
recover.commit(tx_id);
} else {
// otherwise roll back it
recover.rollback(tx_id);
}
// finalize all the transaction marked to finalize and get a persy instance.
}
let persy = recover.finalize()?;Implementations§
source§impl Recover
impl Recover
sourcepub fn list_transactions(&self) -> Vec<(TransactionId, RecoverStatus)>
pub fn list_transactions(&self) -> Vec<(TransactionId, RecoverStatus)>
List all the transactions found in the log with the current status
sourcepub fn commit(&mut self, tx_id: TransactionId)
pub fn commit(&mut self, tx_id: TransactionId)
Mark to commit a transaction in the log with state prepared commit
sourcepub fn rollback(&mut self, tx_id: TransactionId)
pub fn rollback(&mut self, tx_id: TransactionId)
Mark to rollback a transaction that is not yet committed
sourcepub fn status(&self, tx_id: TransactionId) -> Option<RecoverStatus>
pub fn status(&self, tx_id: TransactionId) -> Option<RecoverStatus>
Read the status of a transaction in the log
Auto Trait Implementations§
impl Freeze for Recover
impl !RefUnwindSafe for Recover
impl Send for Recover
impl Sync for Recover
impl Unpin for Recover
impl !UnwindSafe for Recover
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