pub trait IServerModuleInit: IDynCommonModuleInit {
    // Required methods
    fn as_common(&self) -> &(dyn IDynCommonModuleInit + Send + Sync + 'static);
    fn supported_api_versions(&self) -> SupportedModuleApiVersions;
    fn database_version(&self) -> DatabaseVersion;
    fn init<'life0, 'life1, 'async_trait>(
        &'life0 self,
        cfg: ServerModuleConfig,
        db: Database,
        task_group: &'life1 mut TaskGroup,
        our_peer_id: PeerId
    ) -> Pin<Box<dyn Future<Output = Result<DynServerModule>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_database_migrations(&self) -> MigrationMap;
    fn validate_params(&self, params: &ConfigGenModuleParams) -> Result<()>;
    fn trusted_dealer_gen(
        &self,
        peers: &[PeerId],
        params: &ConfigGenModuleParams
    ) -> BTreeMap<PeerId, ServerModuleConfig>;
    fn distributed_gen<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        peers: &'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,
        module_instance_id: ModuleInstanceId,
        config: &ServerModuleConsensusConfig
    ) -> Result<ClientModuleConfig>;
}
Expand description

Interface for Module Generation

This trait contains the methods responsible for the module’s

  • initialization
  • config generation
  • config validation

Once the module configuration is ready, the module can be instantiated via [Self::init].

Required Methods§

source

fn as_common(&self) -> &(dyn IDynCommonModuleInit + Send + Sync + 'static)

source

fn supported_api_versions(&self) -> SupportedModuleApiVersions

source

fn database_version(&self) -> DatabaseVersion

source

fn init<'life0, 'life1, 'async_trait>( &'life0 self, cfg: ServerModuleConfig, db: Database, task_group: &'life1 mut TaskGroup, our_peer_id: PeerId ) -> 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 get_database_migrations(&self) -> MigrationMap

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

source

fn validate_params(&self, params: &ConfigGenModuleParams) -> Result<()>

source

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

source

fn distributed_gen<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, peers: &'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, module_instance_id: ModuleInstanceId, config: &ServerModuleConsensusConfig ) -> Result<ClientModuleConfig>

Implementors§

source§

impl<T> IServerModuleInit for T
where T: ServerModuleInit + 'static + Sync,