fedimint_core::db

Trait IRawDatabase

Source
pub trait IRawDatabase:
    Debug
    + MaybeSend
    + MaybeSync
    + 'static {
    type Transaction<'a>: IRawDatabaseTransaction + Debug;

    // Required methods
    fn begin_transaction<'a, 'async_trait>(
        &'a self,
    ) -> Pin<Box<dyn Future<Output = Self::Transaction<'a>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
    fn checkpoint(&self, backup_path: &Path) -> Result<()>;
}
Expand description

Raw database implementation

This and IRawDatabaseTransaction are meant to be implemented by crates like fedimint-rocksdb to provide a concrete implementation of a database to be used by Fedimint.

This is in contrast of IDatabase which includes extra functionality that Fedimint needs (and adds) on top of it.

Required Associated Types§

Source

type Transaction<'a>: IRawDatabaseTransaction + Debug

A raw database transaction type

Required Methods§

Source

fn begin_transaction<'a, 'async_trait>( &'a self, ) -> Pin<Box<dyn Future<Output = Self::Transaction<'a>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Start a database transaction

Source

fn checkpoint(&self, backup_path: &Path) -> Result<()>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> IRawDatabase for Box<T>
where T: IRawDatabase,

Source§

type Transaction<'a> = <T as IRawDatabase>::Transaction<'a>

Source§

fn begin_transaction<'a, 'async_trait>( &'a self, ) -> Pin<Box<dyn Future<Output = Self::Transaction<'a>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Source§

fn checkpoint(&self, backup_path: &Path) -> Result<()>

Implementors§