@@ -38,21 +38,27 @@ pub(crate) const NODE_NAME_MAX_LENGTH: usize = 32;
3838/// default sub directory to store network config
3939pub ( crate ) const DEFAULT_NETWORK_CONFIG_PATH : & ' static str = "network" ;
4040
41+ /// A trait that allows converting an object to a Configuration
4142pub trait CliConfiguration : Sized {
43+ /// Get the base path of the configuration (if any)
4244 fn get_base_path ( & self ) -> Result < Option < & PathBuf > > ;
4345
46+ /// Returns `true` if the node is for development or not
4447 fn get_is_dev ( & self ) -> Result < bool > {
4548 Ok ( false )
4649 }
4750
51+ /// Get the roles
4852 fn get_roles ( & self , _is_dev : bool ) -> Result < Roles > {
4953 Ok ( Roles :: FULL )
5054 }
5155
56+ /// Get the transaction pool options
5257 fn get_transaction_pool ( & self ) -> Result < TransactionPoolOptions > {
5358 Ok ( Default :: default ( ) )
5459 }
5560
61+ /// Get the network configuration
5662 fn get_network_config < G , E > (
5763 & self ,
5864 _chain_spec : & ChainSpec < G , E > ,
@@ -74,117 +80,143 @@ pub trait CliConfiguration: Sized {
7480 ) )
7581 }
7682
83+ /// Get the keystore configuration
7784 fn get_keystore_config ( & self , _base_path : & PathBuf ) -> Result < KeystoreConfig > {
7885 Ok ( KeystoreConfig :: InMemory )
7986 }
8087
88+ /// Get the database cache size (None for default)
8189 fn get_database_cache_size ( & self ) -> Result < Option < usize > > {
8290 Ok ( Default :: default ( ) )
8391 }
8492
93+ /// Get the database configuration
8594 fn get_database_config (
8695 & self ,
8796 base_path : & PathBuf ,
8897 cache_size : Option < usize > ,
8998 ) -> Result < DatabaseConfig > ;
9099
100+ /// Get the state cache size
91101 fn get_state_cache_size ( & self ) -> Result < usize > {
92102 Ok ( Default :: default ( ) )
93103 }
94104
105+ /// Get the state cache child ratio (if any)
95106 fn get_state_cache_child_ratio ( & self ) -> Result < Option < usize > > {
96107 Ok ( Default :: default ( ) )
97108 }
98109
110+ /// Get the pruning mode
99111 fn get_pruning ( & self , _is_dev : bool , _roles : Roles ) -> Result < PruningMode > {
100112 Ok ( Default :: default ( ) )
101113 }
102114
115+ /// Get the chain spec
103116 fn get_chain_spec < C : SubstrateCLI < G , E > , G , E > ( & self ) -> Result < ChainSpec < G , E > >
104117 where
105118 G : RuntimeGenesis ,
106119 E : ChainSpecExtension ;
107120
121+ /// Get the name of the node
108122 fn get_node_name ( & self ) -> Result < String > {
109123 Ok ( generate_node_name ( ) )
110124 }
111125
126+ /// Get the WASM execution method
112127 fn get_wasm_method ( & self ) -> Result < WasmExecutionMethod > {
113128 Ok ( Default :: default ( ) )
114129 }
115130
131+ /// Get the execution strategies
116132 fn get_execution_strategies ( & self , _is_dev : bool ) -> Result < ExecutionStrategies > {
117133 Ok ( Default :: default ( ) )
118134 }
119135
136+ /// Get the RPC HTTP address (`None` if disabled)
120137 fn get_rpc_http ( & self ) -> Result < Option < SocketAddr > > {
121138 Ok ( Default :: default ( ) )
122139 }
123140
141+ /// Get the RPC websocket address (`None` if disabled)
124142 fn get_rpc_ws ( & self ) -> Result < Option < SocketAddr > > {
125143 Ok ( Default :: default ( ) )
126144 }
127145
146+ /// Get the RPC websockets maximum connections (`None` if unlimited)
128147 fn get_rpc_ws_max_connections ( & self ) -> Result < Option < usize > > {
129148 Ok ( Default :: default ( ) )
130149 }
131150
151+ /// Get the RPC cors (`None` if disabled)
132152 fn get_rpc_cors ( & self , _is_dev : bool ) -> Result < Option < Vec < String > > > {
133153 Ok ( Some ( Vec :: new ( ) ) )
134154 }
135155
156+ /// Get the prometheus port (`None` if disabled)
136157 fn get_prometheus_port ( & self ) -> Result < Option < SocketAddr > > {
137158 Ok ( Default :: default ( ) )
138159 }
139160
161+ /// Get the telemetry endpoints (if any)
140162 fn get_telemetry_endpoints < G , E > (
141163 & self ,
142164 chain_spec : & ChainSpec < G , E > ,
143165 ) -> Result < Option < TelemetryEndpoints > > {
144166 Ok ( chain_spec. telemetry_endpoints ( ) . clone ( ) )
145167 }
146168
169+ /// Get the telemetry external transport
147170 fn get_telemetry_external_transport ( & self ) -> Result < Option < ExtTransport > > {
148171 Ok ( Default :: default ( ) )
149172 }
150173
174+ /// Get the default value for heap pages
151175 fn get_default_heap_pages ( & self ) -> Result < Option < u64 > > {
152176 Ok ( Default :: default ( ) )
153177 }
154178
179+ /// Returns `Ok(true)` if offchain worker should be used
155180 fn get_offchain_worker ( & self , _roles : Roles ) -> Result < bool > {
156181 Ok ( Default :: default ( ) )
157182 }
158183
159- /// set sentry mode (i.e. act as an authority but **never** actively participate)
184+ /// Get sentry mode (i.e. act as an authority but **never** actively participate)
160185 fn get_sentry_mode ( & self ) -> Result < bool > {
161186 Ok ( Default :: default ( ) )
162187 }
163188
189+ /// Returns `Ok(true)` if authoring should be forced
164190 fn get_force_authoring ( & self ) -> Result < bool > {
165191 Ok ( Default :: default ( ) )
166192 }
167193
194+ /// Returns `Ok(true)` if grandpa should be disabled
168195 fn get_disable_grandpa ( & self ) -> Result < bool > {
169196 Ok ( Default :: default ( ) )
170197 }
171198
199+ /// Get the development key seed from the current object
172200 fn get_dev_key_seed ( & self , _is_dev : bool ) -> Result < Option < String > > {
173201 Ok ( Default :: default ( ) )
174202 }
175203
204+ /// Get the tracing targets from the current object (if any)
176205 fn get_tracing_targets ( & self ) -> Result < Option < String > > {
177206 Ok ( Default :: default ( ) )
178207 }
179208
209+ /// Get the TracingReceiver value from the current object
180210 fn get_tracing_receiver ( & self ) -> Result < sc_tracing:: TracingReceiver > {
181211 Ok ( Default :: default ( ) )
182212 }
183213
214+ /// Get the node key from the current object
184215 fn get_node_key ( & self , _net_config_dir : & PathBuf ) -> Result < NodeKeyConfig > {
185216 Ok ( Default :: default ( ) )
186217 }
187218
219+ /// Create a Configuration object from the current object
188220 fn create_configuration < C : SubstrateCLI < G , E > , G , E > (
189221 & self ,
190222 task_executor : Arc < dyn Fn ( Pin < Box < dyn Future < Output = ( ) > + Send > > ) + Send + Sync > ,
0 commit comments