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>