fedimint_core::db

Trait 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§