fedimint_core::db

Trait IDatabase

source
pub trait IDatabase:
    Debug
    + MaybeSend
    + MaybeSync
    + 'static {
    // Required methods
    fn begin_transaction<'a, 'async_trait>(
        &'a self,
    ) -> Pin<Box<dyn Future<Output = Box<dyn IDatabaseTransaction + 'a>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
    fn register<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn notify<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn is_global(&self) -> bool;
    fn checkpoint(&self, backup_path: &Path) -> Result<()>;
}
Expand description

A database that on top of a raw database operation, implements key notification system.

Required Methods§

source

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

Start a database transaction

source

fn register<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Register (and wait) for key updates

source

fn notify<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Notify about key update (creation, modification, deletion)

source

fn is_global(&self) -> bool

The prefix len of this database refers to the global (as opposed to module-isolated) key space

source

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

Checkpoints the database to a backup directory

Implementations on Foreign Types§

source§

impl<T> IDatabase for Arc<T>
where T: IDatabase + ?Sized,

source§

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

source§

fn register<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn notify<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn is_global(&self) -> bool

source§

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

Implementors§

source§

impl<Inner> IDatabase for PrefixDatabase<Inner>
where Inner: Debug + MaybeSend + MaybeSync + 'static + IDatabase,

source§

impl<RawDatabase: IRawDatabase + MaybeSend + 'static> IDatabase for BaseDatabase<RawDatabase>