Struct persy::Recover

source ·
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§

List all the transactions found in the log with the current status

Mark to commit a transaction in the log with state prepared commit

Mark to rollback a transaction that is not yet committed

Read the status of a transaction in the log

Recover all the prepared committed transactions that are not marked to rollback

Examples found in repository?
src/open_options.rs (line 157)
152
153
154
155
156
157
158
    pub fn open<P>(&mut self, path: P) -> Result<Persy, PE<OpenError>>
    where
        P: AsRef<Path>,
    {
        let recover = self.recover(path)?;
        recover.finalize().map_err(|e| PE::PE(OpenError::from(e.error())))
    }

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.