fedimint_client::module::init

Trait ClientModuleInit

Source
pub trait ClientModuleInit: ModuleInit + Sized {
    type Module: ClientModule;

    // Required methods
    fn supported_api_versions(&self) -> MultiApiVersion;
    fn init<'life0, 'life1, 'async_trait>(
        &'life0 self,
        args: &'life1 ClientModuleInitArgs<Self>,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Module>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn recover<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _args: &'life1 ClientModuleRecoverArgs<Self>,
        _snapshot: Option<&'life2 <Self::Module as ClientModule>::Backup>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn get_database_migrations(
        &self,
    ) -> BTreeMap<DatabaseVersion, ClientMigrationFn> { ... }
}

Required Associated Types§

Required Methods§

Source

fn supported_api_versions(&self) -> MultiApiVersion

Api versions of the corresponding server side module’s API that this client module implementation can use.

Source

fn init<'life0, 'life1, 'async_trait>( &'life0 self, args: &'life1 ClientModuleInitArgs<Self>, ) -> Pin<Box<dyn Future<Output = Result<Self::Module>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Initialize a ClientModule instance from its config

Provided Methods§

Source

fn recover<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _args: &'life1 ClientModuleRecoverArgs<Self>, _snapshot: Option<&'life2 <Self::Module as ClientModule>::Backup>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Recover the state of the client module, optionally from an existing snapshot.

If Err is returned, the higher level client/application might try again at a different time (client restarted, code version changed, etc.)

Source

fn get_database_migrations( &self, ) -> BTreeMap<DatabaseVersion, ClientMigrationFn>

Retrieves the database migrations from the module to be applied to the database before the module is initialized. The database migrations map is indexed on the “from” version.

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.

Implementors§