docs: add docs about call order of config trait (#5340)

This commit is contained in:
Matthias Seitz
2023-11-07 16:30:14 +01:00
committed by GitHub
parent ef2f96afe8
commit 04c0d6f003

View File

@ -32,8 +32,18 @@ impl RethCliExt for () {
/// A trait that allows for extending and customizing parts of the node command
/// [NodeCommand](crate::node::NodeCommand).
///
/// The functions are invoked during the initialization of the node command in the following order:
///
/// 1. [on_components_initialized](RethNodeCommandConfig::on_components_initialized)
/// 2. [spawn_payload_builder_service](RethNodeCommandConfig::spawn_payload_builder_service)
/// 3. [extend_rpc_modules](RethNodeCommandConfig::extend_rpc_modules)
/// 4. [on_rpc_server_started](RethNodeCommandConfig::on_rpc_server_started)
/// 5. [on_node_started](RethNodeCommandConfig::on_node_started)
pub trait RethNodeCommandConfig: fmt::Debug {
/// Event hook called once all components have been initialized.
///
/// This is called as soon as the node components have been initialized.
fn on_components_initialized<Reth: RethNodeComponents>(
&mut self,
components: &Reth,
@ -43,12 +53,16 @@ pub trait RethNodeCommandConfig: fmt::Debug {
}
/// Event hook called once the node has been launched.
///
/// This is called last after the node has been launched.
fn on_node_started<Reth: RethNodeComponents>(&mut self, components: &Reth) -> eyre::Result<()> {
let _ = components;
Ok(())
}
/// Event hook called once the rpc servers has been started.
///
/// This is called after the rpc server has been started.
fn on_rpc_server_started<Conf, Reth>(
&mut self,
config: &Conf,
@ -70,7 +84,9 @@ pub trait RethNodeCommandConfig: fmt::Debug {
/// Allows for registering additional RPC modules for the transports.
///
/// This is expected to call the merge functions of [reth_rpc_builder::TransportRpcModules], for
/// example [reth_rpc_builder::TransportRpcModules::merge_configured]
/// example [reth_rpc_builder::TransportRpcModules::merge_configured].
///
/// This is called before the rpc server will be started [Self::on_rpc_server_started].
fn extend_rpc_modules<Conf, Reth>(
&mut self,
config: &Conf,