diff --git a/crates/configuration/src/network.rs b/crates/configuration/src/network.rs index 78974754f24b243ece542f0fcf110208d686fa36..b35c6ceafbba205d94a0ed681100f64eaa709141 100644 --- a/crates/configuration/src/network.rs +++ b/crates/configuration/src/network.rs @@ -47,6 +47,77 @@ states! { } /// A network configuration builder, used to build a `NetworkConfig` declaratively with fields validation. +/// +/// # Example: +/// +/// ``` +/// # use configuration::NetworkConfigBuilder; +/// let network_config = NetworkConfigBuilder::new() +/// .with_relaychain(|relaychain| { +/// relaychain +/// .with_chain("polkadot") +/// .with_random_nominators_count(10) +/// .with_default_resources(|resources| { +/// resources +/// .with_limit_cpu("1000m") +/// .with_request_memory("1Gi") +/// .with_request_cpu(100_000) +/// }) +/// .with_node(|node| { +/// node +/// .with_name("node") +/// .with_command("command") +/// .validator(true) +/// }) +/// }) +/// .with_parachain(|parachain| { +/// parachain +/// .with_id(1000) +/// .with_chain("myparachain1") +/// .with_initial_balance(100_000) +/// .with_default_image("myimage:version") +/// .with_collator(|collator| { +/// collator +/// .with_name("collator1") +/// .with_command("command1") +/// .validator(true) +/// }) +/// }) +/// .with_parachain(|parachain| { +/// parachain +/// .with_id(2000) +/// .with_chain("myparachain2") +/// .with_initial_balance(50_0000) +/// .with_collator(|collator| { +/// collator +/// .with_name("collator2") +/// .with_command("command2") +/// .validator(true) +/// }) +/// }) +/// .with_hrmp_channel(|hrmp_channel1| { +/// hrmp_channel1 +/// .with_sender(1) +/// .with_recipient(2) +/// .with_max_capacity(200) +/// .with_max_message_size(500) +/// }) +/// .with_hrmp_channel(|hrmp_channel2| { +/// hrmp_channel2 +/// .with_sender(2) +/// .with_recipient(1) +/// .with_max_capacity(100) +/// .with_max_message_size(250) +/// }) +/// .with_global_settings(|global_settings| { +/// global_settings +/// .with_network_spawn_timeout(1200) +/// .with_node_spawn_timeout(240) +/// }) +/// .build(); +/// +/// assert!(network_config.is_ok()) +/// ``` #[derive(Debug)] pub struct NetworkConfigBuilder<State> { config: NetworkConfig,