[][src]Struct sc_service::config::Configuration

pub struct Configuration {
    pub impl_name: &'static str,
    pub impl_version: &'static str,
    pub impl_commit: &'static str,
    pub roles: Roles,
    pub task_executor: Option<Arc<dyn Fn(Pin<Box<dyn Future<Output = ()> + Send>>) + Send + Sync>>,
    pub transaction_pool: TransactionPoolOptions,
    pub network: NetworkConfiguration,
    pub config_dir: Option<PathBuf>,
    pub keystore: KeystoreConfig,
    pub database: Option<DatabaseConfig>,
    pub state_cache_size: usize,
    pub state_cache_child_ratio: Option<usize>,
    pub pruning: PruningMode,
    pub chain_spec: Option<Box<dyn ChainSpec>>,
    pub name: String,
    pub wasm_method: WasmExecutionMethod,
    pub execution_strategies: ExecutionStrategies,
    pub rpc_http: Option<SocketAddr>,
    pub rpc_ws: Option<SocketAddr>,
    pub rpc_ws_max_connections: Option<usize>,
    pub rpc_cors: Option<Vec<String>>,
    pub prometheus_config: Option<PrometheusConfig>,
    pub telemetry_endpoints: Option<TelemetryEndpoints>,
    pub telemetry_external_transport: Option<ExtTransport>,
    pub default_heap_pages: Option<u64>,
    pub offchain_worker: bool,
    pub sentry_mode: bool,
    pub force_authoring: bool,
    pub disable_grandpa: bool,
    pub dev_key_seed: Option<String>,
    pub tracing_targets: Option<String>,
    pub tracing_receiver: TracingReceiver,
    pub max_runtime_instances: usize,

Service configuration.


impl_name: &'static str

Implementation name

impl_version: &'static str

Implementation version

impl_commit: &'static str

Git commit if any.

roles: Roles

Node roles.

task_executor: Option<Arc<dyn Fn(Pin<Box<dyn Future<Output = ()> + Send>>) + Send + Sync>>

How to spawn background tasks. Mandatory, otherwise creating a Service will error.

transaction_pool: TransactionPoolOptions

Extrinsic pool configuration.

network: NetworkConfiguration

Network configuration.

config_dir: Option<PathBuf>

Path to the base configuration directory.

keystore: KeystoreConfig

Configuration for the keystore.

database: Option<DatabaseConfig>

Configuration for the database.

state_cache_size: usize

Size of internal state cache in Bytes

state_cache_child_ratio: Option<usize>

Size in percent of cache size dedicated to child tries

pruning: PruningMode

Pruning settings.

chain_spec: Option<Box<dyn ChainSpec>>

Chain configuration.

name: String

Node name.

wasm_method: WasmExecutionMethod

Wasm execution method.

execution_strategies: ExecutionStrategies

Execution strategies.

rpc_http: Option<SocketAddr>

RPC over HTTP binding address. None if disabled.

rpc_ws: Option<SocketAddr>

RPC over Websockets binding address. None if disabled.

rpc_ws_max_connections: Option<usize>

Maximum number of connections for WebSockets RPC server. None if default.

rpc_cors: Option<Vec<String>>

CORS settings for HTTP & WS servers. None if all origins are allowed.

prometheus_config: Option<PrometheusConfig>

Prometheus endpoint configuration. None if disabled.

telemetry_endpoints: Option<TelemetryEndpoints>

Telemetry service URL. None if disabled.

telemetry_external_transport: Option<ExtTransport>

External WASM transport for the telemetry. If Some, when connection to a telemetry endpoint, this transport will be tried in priority before all others.

default_heap_pages: Option<u64>

The default number of 64KB pages to allocate for Wasm execution

offchain_worker: bool

Should offchain workers be executed.

sentry_mode: bool

Sentry mode is enabled, the node's role is AUTHORITY but it should not actively participate in consensus (i.e. no keystores should be passed to consensus modules).

force_authoring: bool

Enable authoring even when offline.

disable_grandpa: bool

Disable GRANDPA when running in validator mode

dev_key_seed: Option<String>

Development key seed.

When running in development mode, the seed will be used to generate authority keys by the keystore.

Should only be set when node is running development mode.

tracing_targets: Option<String>

Tracing targets

tracing_receiver: TracingReceiver

Tracing receiver

max_runtime_instances: usize

The size of the instances cache.

The default value is 8.


impl Configuration[src]

pub fn from_version(version: &VersionInfo) -> Self[src]

Create a default config using VersionInfo

pub fn full_version(&self) -> String[src]

Returns full version string of this configuration.

pub fn client_id(&self) -> String[src]

Implementation id and version.

pub fn in_chain_config_dir(&self, sub: &str) -> Option<PathBuf>[src]

Generate a PathBuf to sub in the chain configuration directory if given

pub fn expect_chain_spec(&self) -> &dyn ChainSpec[src]

Return a reference to the ChainSpec of this Configuration.


This method panic if the chain_spec is None

pub fn expect_database(&self) -> &DatabaseConfig[src]

Return a reference to the DatabaseConfig of this Configuration.


This method panic if the database is None

pub fn display_role(&self) -> String[src]

Returns a string displaying the node role, special casing the sentry mode (returning SENTRY), since the node technically has an AUTHORITY role but doesn't participate.

pub fn use_in_memory_keystore(&mut self) -> Result<(), String>[src]

Use in memory keystore config when it is not required at all.

This function returns an error if the keystore is already set to something different than KeystoreConfig::None.

Trait Implementations

impl Default for Configuration[src]

fn default() -> Self[src]

Create a default config

Auto Trait Implementations

impl !RefUnwindSafe for Configuration

impl Send for Configuration

impl !Sync for Configuration

impl Unpin for Configuration

impl !UnwindSafe for Configuration

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> CheckedConversion for T[src]

impl<T> Clear for T where
    T: InitializableFromZeroed + ?Sized

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T> InitializableFromZeroed for T where
    T: Default

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, Outer> IsWrappedBy<Outer> for T where
    Outer: AsRef<T> + AsMut<T> + From<T>,
    T: From<Outer>, 

fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> SaturatedConversion for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 

impl<T, S> UniqueSaturatedInto<T> for S where
    S: TryInto<T>,
    T: Bounded

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,