Trait Aux

Source
pub trait Aux {
    // Required methods
    fn commit(self) -> bool;
    fn rollback(self);
}
Expand description

An auxiliary transaction that gets co-committed with the STM transaction, unless the STM transaction is aborted or has to be retried, in which case the auxiliary transaction is rolled back.

The auxiliary transaction can also signal that its is unable to be committed, in which case the whole atomic transaction will be retried.

The database is not expected to return an error here, because of how Transaction::commit works. If there is a failure that needs to be surfaced, at the moment the database would have to buffer that error and return it on a subsequent operation, mapped to an StmError::Abort.

Required Methods§

Source

fn commit(self) -> bool

Commit the auxiliary transaction if the STM transaction did not detect any errors. The STM transaction is checked first, because committing the database involves IO and is expected to be slower.

Return false if there are write conflicts in the persistent database itself, to cause a complete retry for the whole transaction.

Source

fn rollback(self)

Rollback the auxiliary transaction if the STM transaction was aborted, or it’s going to be retried.

Implementors§