pub trait IServerModuleInit: IDynCommonModuleInit {
// Required methods
fn as_common(&self) -> &(dyn IDynCommonModuleInit + Send + Sync + 'static);
fn supported_api_versions(&self) -> SupportedModuleApiVersions;
fn init<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_num: NumPeers,
cfg: ServerModuleConfig,
db: Database,
task_group: &'life1 TaskGroup,
our_peer_id: PeerId,
module_api: DynModuleApi,
server_bitcoin_rpc_monitor: ServerBitcoinRpcMonitor,
) -> 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],
args: &ConfigGenModuleArgs,
) -> BTreeMap<PeerId, ServerModuleConfig>;
fn distributed_gen<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
peers: &'life1 (dyn PeerHandleOps + Send + Sync),
args: &'life2 ConfigGenModuleArgs,
) -> Pin<Box<dyn Future<Output = Result<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>;
fn get_database_migrations(
&self,
) -> BTreeMap<DatabaseVersion, DynServerDbMigrationFn>;
fn used_db_prefixes(&self) -> Option<BTreeSet<u8>>;
fn is_enabled_by_default(&self) -> bool;
}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§
fn as_common(&self) -> &(dyn IDynCommonModuleInit + Send + Sync + 'static)
fn supported_api_versions(&self) -> SupportedModuleApiVersions
Sourcefn init<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_num: NumPeers,
cfg: ServerModuleConfig,
db: Database,
task_group: &'life1 TaskGroup,
our_peer_id: PeerId,
module_api: DynModuleApi,
server_bitcoin_rpc_monitor: ServerBitcoinRpcMonitor,
) -> Pin<Box<dyn Future<Output = Result<DynServerModule>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn init<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_num: NumPeers,
cfg: ServerModuleConfig,
db: Database,
task_group: &'life1 TaskGroup,
our_peer_id: PeerId,
module_api: DynModuleApi,
server_bitcoin_rpc_monitor: ServerBitcoinRpcMonitor,
) -> 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
fn trusted_dealer_gen( &self, peers: &[PeerId], args: &ConfigGenModuleArgs, ) -> BTreeMap<PeerId, ServerModuleConfig>
fn distributed_gen<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
peers: &'life1 (dyn PeerHandleOps + Send + Sync),
args: &'life2 ConfigGenModuleArgs,
) -> Pin<Box<dyn Future<Output = Result<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>
Sourcefn get_database_migrations(
&self,
) -> BTreeMap<DatabaseVersion, DynServerDbMigrationFn>
fn get_database_migrations( &self, ) -> BTreeMap<DatabaseVersion, DynServerDbMigrationFn>
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.
Sourcefn used_db_prefixes(&self) -> Option<BTreeSet<u8>>
fn used_db_prefixes(&self) -> Option<BTreeSet<u8>>
Sourcefn is_enabled_by_default(&self) -> bool
fn is_enabled_by_default(&self) -> bool
Whether this module should be enabled by default in the setup UI
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".