Trait fedimint_core::module::ServerModuleInit

source ·
pub trait ServerModuleInit: ModuleInit + Sized {
    type Params: ModuleInitParams;

    // Required methods
    fn versions(&self, core: CoreConsensusVersion) -> &[ModuleConsensusVersion];
    fn supported_api_versions(&self) -> SupportedModuleApiVersions;
    fn init<'life0, 'life1, 'async_trait>(
        &'life0 self,
        args: &'life1 ServerModuleInitArgs<Self>,
    ) -> Pin<Box<dyn Future<Output = Result<DynServerModule>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn trusted_dealer_gen(
        &self,
        peers: &[PeerId],
        params: &ConfigGenModuleParams,
    ) -> BTreeMap<PeerId, ServerModuleConfig>;
    fn distributed_gen<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        peer: &'life1 PeerHandle<'_>,
        params: &'life2 ConfigGenModuleParams,
    ) -> Pin<Box<dyn Future<Output = DkgResult<ServerModuleConfig>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn validate_config(
        &self,
        identity: &PeerId,
        config: ServerModuleConfig,
    ) -> Result<()>;
    fn get_client_config(
        &self,
        config: &ServerModuleConsensusConfig,
    ) -> Result<<<Self as ModuleInit>::Common as CommonModuleInit>::ClientConfig>;

    // Provided methods
    fn kind() -> ModuleKind { ... }
    fn parse_params(
        &self,
        params: &ConfigGenModuleParams,
    ) -> Result<Self::Params> { ... }
    fn get_database_migrations(
        &self,
    ) -> BTreeMap<DatabaseVersion, ServerMigrationFn> { ... }
}
Expand description

Module Generation trait with associated types

Needs to be implemented by module generation type

For examples, take a look at one of the MintConfigGenerator, WalletConfigGenerator, or LightningConfigGenerator structs.

Required Associated Types§

Required Methods§

source

fn versions(&self, core: CoreConsensusVersion) -> &[ModuleConsensusVersion]

Version of the module consensus supported by this implementation given a certain CoreConsensusVersion.

Refer to ModuleConsensusVersion for more information about versioning.

One module implementation (ServerModuleInit of a given ModuleKind) can potentially implement multiple versions of the consensus, and depending on the config module instance config, instantiate the desired one. This method should expose all the available versions, purely for information, setup UI and sanity checking purposes.

source

fn supported_api_versions(&self) -> SupportedModuleApiVersions

source

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

Initialize the DynServerModule instance from its config

source

fn trusted_dealer_gen( &self, peers: &[PeerId], params: &ConfigGenModuleParams, ) -> BTreeMap<PeerId, ServerModuleConfig>

source

fn distributed_gen<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, peer: &'life1 PeerHandle<'_>, params: &'life2 ConfigGenModuleParams, ) -> Pin<Box<dyn Future<Output = DkgResult<ServerModuleConfig>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

source

fn validate_config( &self, identity: &PeerId, config: ServerModuleConfig, ) -> Result<()>

source

fn get_client_config( &self, config: &ServerModuleConsensusConfig, ) -> Result<<<Self as ModuleInit>::Common as CommonModuleInit>::ClientConfig>

Converts the consensus config into the client config

Provided Methods§

source

fn kind() -> ModuleKind

source

fn parse_params(&self, params: &ConfigGenModuleParams) -> Result<Self::Params>

source

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

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

Object Safety§

This trait is not object safe.

Implementors§