Trait sc_cli::CliConfiguration

source ·
pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
Show 55 methods // Required method fn shared_params(&self) -> &SharedParams; // Provided methods fn import_params(&self) -> Option<&ImportParams> { ... } fn pruning_params(&self) -> Option<&PruningParams> { ... } fn keystore_params(&self) -> Option<&KeystoreParams> { ... } fn network_params(&self) -> Option<&NetworkParams> { ... } fn offchain_worker_params(&self) -> Option<&OffchainWorkerParams> { ... } fn node_key_params(&self) -> Option<&NodeKeyParams> { ... } fn database_params(&self) -> Option<&DatabaseParams> { ... } fn base_path(&self) -> Result<Option<BasePath>> { ... } fn is_dev(&self) -> Result<bool> { ... } fn role(&self, _is_dev: bool) -> Result<Role> { ... } fn transaction_pool(&self, _is_dev: bool) -> Result<TransactionPoolOptions> { ... } fn network_config( &self, chain_spec: &Box<dyn ChainSpec>, is_dev: bool, is_validator: bool, net_config_dir: PathBuf, client_id: &str, node_name: &str, node_key: NodeKeyConfig, default_listen_port: u16, ) -> Result<NetworkConfiguration> { ... } fn keystore_config(&self, config_dir: &PathBuf) -> Result<KeystoreConfig> { ... } fn database_cache_size(&self) -> Result<Option<usize>> { ... } fn database(&self) -> Result<Option<Database>> { ... } fn database_config( &self, base_path: &PathBuf, cache_size: usize, database: Database, ) -> Result<DatabaseSource> { ... } fn trie_cache_maximum_size(&self) -> Result<Option<usize>> { ... } fn state_pruning(&self) -> Result<Option<PruningMode>> { ... } fn blocks_pruning(&self) -> Result<BlocksPruning> { ... } fn chain_id(&self, is_dev: bool) -> Result<String> { ... } fn node_name(&self) -> Result<String> { ... } fn wasm_method(&self) -> Result<WasmExecutionMethod> { ... } fn wasm_runtime_overrides(&self) -> Option<PathBuf> { ... } fn rpc_addr( &self, _default_listen_port: u16, ) -> Result<Option<Vec<RpcEndpoint>>> { ... } fn rpc_methods(&self) -> Result<RpcMethods> { ... } fn rpc_max_connections(&self) -> Result<u32> { ... } fn rpc_cors(&self, _is_dev: bool) -> Result<Option<Vec<String>>> { ... } fn rpc_max_request_size(&self) -> Result<u32> { ... } fn rpc_max_response_size(&self) -> Result<u32> { ... } fn rpc_max_subscriptions_per_connection(&self) -> Result<u32> { ... } fn rpc_buffer_capacity_per_connection(&self) -> Result<u32> { ... } fn rpc_batch_config(&self) -> Result<RpcBatchRequestConfig> { ... } fn rpc_rate_limit(&self) -> Result<Option<NonZeroU32>> { ... } fn rpc_rate_limit_whitelisted_ips(&self) -> Result<Vec<IpNetwork>> { ... } fn rpc_rate_limit_trust_proxy_headers(&self) -> Result<bool> { ... } fn prometheus_config( &self, _default_listen_port: u16, _chain_spec: &Box<dyn ChainSpec>, ) -> Result<Option<PrometheusConfig>> { ... } fn telemetry_endpoints( &self, chain_spec: &Box<dyn ChainSpec>, ) -> Result<Option<TelemetryEndpoints>> { ... } fn default_heap_pages(&self) -> Result<Option<u64>> { ... } fn offchain_worker(&self, role: &Role) -> Result<OffchainWorkerConfig> { ... } fn force_authoring(&self) -> Result<bool> { ... } fn disable_grandpa(&self) -> Result<bool> { ... } fn dev_key_seed(&self, _is_dev: bool) -> Result<Option<String>> { ... } fn tracing_targets(&self) -> Result<Option<String>> { ... } fn tracing_receiver(&self) -> Result<TracingReceiver> { ... } fn node_key(&self, net_config_dir: &PathBuf) -> Result<NodeKeyConfig> { ... } fn max_runtime_instances(&self) -> Result<Option<usize>> { ... } fn runtime_cache_size(&self) -> Result<u8> { ... } fn announce_block(&self) -> Result<bool> { ... } fn create_configuration<C: SubstrateCli>( &self, cli: &C, tokio_handle: Handle, ) -> Result<Configuration> { ... } fn log_filters(&self) -> Result<String> { ... } fn detailed_log_output(&self) -> Result<bool> { ... } fn enable_log_reloading(&self) -> Result<bool> { ... } fn disable_log_color(&self) -> Result<bool> { ... } fn init<F>( &self, support_url: &String, impl_version: &String, logger_hook: F, ) -> Result<()> where F: FnOnce(&mut LoggerBuilder) { ... }
}
Expand description

A trait that allows converting an object to a Configuration

Required Methods§

source

fn shared_params(&self) -> &SharedParams

Get the SharedParams for this object

Provided Methods§

source

fn import_params(&self) -> Option<&ImportParams>

Get the ImportParams for this object

source

fn pruning_params(&self) -> Option<&PruningParams>

Get the PruningParams for this object

source

fn keystore_params(&self) -> Option<&KeystoreParams>

Get the KeystoreParams for this object

source

fn network_params(&self) -> Option<&NetworkParams>

Get the NetworkParams for this object

source

fn offchain_worker_params(&self) -> Option<&OffchainWorkerParams>

Get a reference to OffchainWorkerParams for this object.

source

fn node_key_params(&self) -> Option<&NodeKeyParams>

Get the NodeKeyParams for this object

source

fn database_params(&self) -> Option<&DatabaseParams>

Get the DatabaseParams for this object

source

fn base_path(&self) -> Result<Option<BasePath>>

Get the base path of the configuration (if any)

By default this is retrieved from SharedParams.

source

fn is_dev(&self) -> Result<bool>

Returns true if the node is for development or not

By default this is retrieved from SharedParams.

source

fn role(&self, _is_dev: bool) -> Result<Role>

Gets the role

By default this is Role::Full.

source

fn transaction_pool(&self, _is_dev: bool) -> Result<TransactionPoolOptions>

Get the transaction pool options

By default this is TransactionPoolOptions::default().

source

fn network_config( &self, chain_spec: &Box<dyn ChainSpec>, is_dev: bool, is_validator: bool, net_config_dir: PathBuf, client_id: &str, node_name: &str, node_key: NodeKeyConfig, default_listen_port: u16, ) -> Result<NetworkConfiguration>

Get the network configuration

By default this is retrieved from NetworkParams if it is available otherwise it creates a default NetworkConfiguration based on node_name, client_id, node_key and net_config_dir.

source

fn keystore_config(&self, config_dir: &PathBuf) -> Result<KeystoreConfig>

Get the keystore configuration.

By default this is retrieved from KeystoreParams if it is available. Otherwise it uses KeystoreConfig::InMemory.

source

fn database_cache_size(&self) -> Result<Option<usize>>

Get the database cache size.

By default this is retrieved from DatabaseParams if it is available. Otherwise its None.

source

fn database(&self) -> Result<Option<Database>>

Get the database backend variant.

By default this is retrieved from DatabaseParams if it is available. Otherwise its None.

source

fn database_config( &self, base_path: &PathBuf, cache_size: usize, database: Database, ) -> Result<DatabaseSource>

Get the database configuration object for the parameters provided

source

fn trie_cache_maximum_size(&self) -> Result<Option<usize>>

Get the trie cache maximum size.

By default this is retrieved from ImportParams if it is available. Otherwise its 0. If None is returned the trie cache is disabled.

source

fn state_pruning(&self) -> Result<Option<PruningMode>>

Get the state pruning mode.

By default this is retrieved from PruningMode if it is available. Otherwise its PruningMode::default().

source

fn blocks_pruning(&self) -> Result<BlocksPruning>

Get the block pruning mode.

By default this is retrieved from block_pruning if it is available. Otherwise its BlocksPruning::KeepFinalized.

source

fn chain_id(&self, is_dev: bool) -> Result<String>

Get the chain ID (string).

By default this is retrieved from SharedParams.

source

fn node_name(&self) -> Result<String>

Get the name of the node.

By default a random name is generated.

source

fn wasm_method(&self) -> Result<WasmExecutionMethod>

Get the WASM execution method.

By default this is retrieved from ImportParams if it is available. Otherwise its WasmExecutionMethod::default().

source

fn wasm_runtime_overrides(&self) -> Option<PathBuf>

Get the path where WASM overrides live.

By default this is None.

source

fn rpc_addr( &self, _default_listen_port: u16, ) -> Result<Option<Vec<RpcEndpoint>>>

Get the RPC address.

source

fn rpc_methods(&self) -> Result<RpcMethods>

Returns the RPC method set to expose.

By default this is RpcMethods::Auto (unsafe RPCs are denied iff rpc_external returns true, respectively).

source

fn rpc_max_connections(&self) -> Result<u32>

Get the maximum number of RPC server connections.

source

fn rpc_cors(&self, _is_dev: bool) -> Result<Option<Vec<String>>>

Get the RPC cors (None if disabled)

By default this is Some(Vec::new()).

source

fn rpc_max_request_size(&self) -> Result<u32>

Get maximum RPC request payload size.

source

fn rpc_max_response_size(&self) -> Result<u32>

Get maximum RPC response payload size.

source

fn rpc_max_subscriptions_per_connection(&self) -> Result<u32>

Get maximum number of subscriptions per connection.

source

fn rpc_buffer_capacity_per_connection(&self) -> Result<u32>

The number of messages the RPC server is allowed to keep in memory per connection.

source

fn rpc_batch_config(&self) -> Result<RpcBatchRequestConfig>

RPC server batch request configuration.

source

fn rpc_rate_limit(&self) -> Result<Option<NonZeroU32>>

RPC rate limit configuration.

source

fn rpc_rate_limit_whitelisted_ips(&self) -> Result<Vec<IpNetwork>>

RPC rate limit whitelisted ip addresses.

source

fn rpc_rate_limit_trust_proxy_headers(&self) -> Result<bool>

RPC rate limit trust proxy headers.

source

fn prometheus_config( &self, _default_listen_port: u16, _chain_spec: &Box<dyn ChainSpec>, ) -> Result<Option<PrometheusConfig>>

Get the prometheus configuration (None if disabled)

By default this is None.

source

fn telemetry_endpoints( &self, chain_spec: &Box<dyn ChainSpec>, ) -> Result<Option<TelemetryEndpoints>>

Get the telemetry endpoints (if any)

By default this is retrieved from the chain spec loaded by load_spec.

source

fn default_heap_pages(&self) -> Result<Option<u64>>

Get the default value for heap pages

By default this is None.

source

fn offchain_worker(&self, role: &Role) -> Result<OffchainWorkerConfig>

Returns an offchain worker config wrapped in Ok(_)

By default offchain workers are disabled.

source

fn force_authoring(&self) -> Result<bool>

Returns Ok(true) if authoring should be forced

By default this is false.

source

fn disable_grandpa(&self) -> Result<bool>

Returns Ok(true) if grandpa should be disabled

By default this is false.

source

fn dev_key_seed(&self, _is_dev: bool) -> Result<Option<String>>

Get the development key seed from the current object

By default this is None.

source

fn tracing_targets(&self) -> Result<Option<String>>

Get the tracing targets from the current object (if any)

By default this is retrieved from SharedParams if it is available. Otherwise its None.

source

fn tracing_receiver(&self) -> Result<TracingReceiver>

Get the TracingReceiver value from the current object

By default this is retrieved from SharedParams if it is available. Otherwise its TracingReceiver::default().

source

fn node_key(&self, net_config_dir: &PathBuf) -> Result<NodeKeyConfig>

Get the node key from the current object

By default this is retrieved from NodeKeyParams if it is available. Otherwise its NodeKeyConfig::default().

source

fn max_runtime_instances(&self) -> Result<Option<usize>>

Get maximum runtime instances

By default this is None.

source

fn runtime_cache_size(&self) -> Result<u8>

Get maximum different runtimes in cache

By default this is 2.

source

fn announce_block(&self) -> Result<bool>

Activate or not the automatic announcing of blocks after import

By default this is false.

source

fn create_configuration<C: SubstrateCli>( &self, cli: &C, tokio_handle: Handle, ) -> Result<Configuration>

Create a Configuration object from the current object

source

fn log_filters(&self) -> Result<String>

Get the filters for the logging.

This should be a list of comma-separated values. Example: foo=trace,bar=debug,baz=info

By default this is retrieved from SharedParams.

source

fn detailed_log_output(&self) -> Result<bool>

Should the detailed log output be enabled.

source

fn enable_log_reloading(&self) -> Result<bool>

Is log reloading enabled?

source

fn disable_log_color(&self) -> Result<bool>

Should the log color output be disabled?

source

fn init<F>( &self, support_url: &String, impl_version: &String, logger_hook: F, ) -> Result<()>
where F: FnOnce(&mut LoggerBuilder),

Initialize substrate. This must be done only once per process.

This method:

  1. Sets the panic handler
  2. Optionally customize logger/profiling
  3. Initializes the logger
  4. Raises the FD limit

The logger_hook closure is executed before the logger is constructed and initialized. It is useful for setting up a custom profiler.

Example:

use sc_tracing::{SpanDatum, TraceEvent};
struct TestProfiler;

impl sc_tracing::TraceHandler for TestProfiler {
 	fn handle_span(&self, sd: &SpanDatum) {}
		fn handle_event(&self, _event: &TraceEvent) {}
};

fn logger_hook() -> impl FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration) -> () {
	|logger_builder, config| {
			logger_builder.with_custom_profiling(Box::new(TestProfiler{}));
	}
}

Object Safety§

This trait is not object safe.

Implementors§