Trait fedimint_core::db::IDatabaseTransactionOps

source ·
pub trait IDatabaseTransactionOps: IDatabaseTransactionOpsCore + MaybeSend {
    // Required methods
    fn set_tx_savepoint<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn rollback_tx_to_savepoint<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Additional operations (only some) database transactions expose, on top of IDatabaseTransactionOpsCore

In certain contexts exposing these operations would be a problem, so they are moved to a separate trait.

Required Methods§

source

fn set_tx_savepoint<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a savepoint during the transaction that can be rolled back to using rollback_tx_to_savepoint. Rolling back to the savepoint will atomically remove the writes that were applied since the savepoint was created.

Warning: Avoid using this in fedimint client code as not all database transaction implementations will support setting a savepoint during a transaction.

source

fn rollback_tx_to_savepoint<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementations on Foreign Types§

source§

impl<T> IDatabaseTransactionOps for &mut T

source§

fn set_tx_savepoint<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn rollback_tx_to_savepoint<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

impl<T> IDatabaseTransactionOps for Box<T>

source§

fn set_tx_savepoint<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

source§

fn rollback_tx_to_savepoint<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§