[][src]Struct substrate_service::ServiceBuilder

pub struct ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend> { /* fields omitted */ }

Aggregator for the components required to build a service.

Usage

Call ServiceBuilder::new_full or ServiceBuilder::new_light, then call the various with_ methods to add the required components that you built yourself:

After this is done, call build to construct the service.

The order in which the with_* methods are called doesn't matter, as the correct binding of generics is done when you call build.

Methods

impl<TCfg, TGen, TCSExt> ServiceBuilder<(), (), TCfg, TGen, TCSExt, (), (), (), (), (), (), (), (), (), ()> where
    TGen: RuntimeGenesis,
    TCSExt: Extension
[src]

pub fn new_full<TBl: BlockT<Hash = H256>, TRtApi, TExecDisp: NativeExecutionDispatch>(
    config: Configuration<TCfg, TGen, TCSExt>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, Client<Backend<TBl>, LocalCallExecutor<Backend<TBl>, NativeExecutor<TExecDisp>>, TBl, TRtApi>, Arc<OnDemand<TBl>>, (), (), BoxFinalityProofRequestBuilder<TBl>, Arc<dyn FinalityProofProvider<TBl>>, (), (), (), Backend<TBl>>, Error>
[src]

Start the service builder with a configuration.

pub fn new_light<TBl: BlockT<Hash = H256>, TRtApi, TExecDisp: NativeExecutionDispatch + 'static>(
    config: Configuration<TCfg, TGen, TCSExt>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, Client<Backend<LightStorage<TBl>, Blake2Hasher>, GenesisCallExecutor<Backend<LightStorage<TBl>, Blake2Hasher>, LocalCallExecutor<Backend<LightStorage<TBl>, Blake2Hasher>, NativeExecutor<TExecDisp>>>, TBl, TRtApi>, Arc<OnDemand<TBl>>, (), (), BoxFinalityProofRequestBuilder<TBl>, Arc<dyn FinalityProofProvider<TBl>>, (), (), (), Backend<LightStorage<TBl>, Blake2Hasher>>, Error>
[src]

Start the service builder with a configuration.

impl<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend> ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend>[src]

pub fn client(&self) -> &Arc<TCl>[src]

Returns a reference to the client that was stored in this builder.

pub fn backend(&self) -> &Arc<Backend>[src]

Returns a reference to the backend that was used in this builder.

pub fn select_chain(&self) -> Option<&TSc>[src]

Returns a reference to the select-chain that was stored in this builder.

pub fn with_opt_select_chain<USc>(
    self,
    select_chain_builder: impl FnOnce(&Configuration<TCfg, TGen, TCSExt>, &Arc<Backend>) -> Result<Option<USc>, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, USc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend>, Error>
[src]

Defines which head-of-chain strategy to use.

pub fn with_select_chain<USc>(
    self,
    builder: impl FnOnce(&Configuration<TCfg, TGen, TCSExt>, &Arc<Backend>) -> Result<USc, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, USc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend>, Error>
[src]

Defines which head-of-chain strategy to use.

pub fn with_import_queue<UImpQu>(
    self,
    builder: impl FnOnce(&Configuration<TCfg, TGen, TCSExt>, Arc<TCl>, Option<TSc>, Arc<TExPool>) -> Result<UImpQu, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, UImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend>, Error> where
    TSc: Clone
[src]

Defines which import queue to use.

pub fn with_network_protocol<UNetP>(
    self,
    network_protocol_builder: impl FnOnce(&Configuration<TCfg, TGen, TCSExt>) -> Result<UNetP, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, UNetP, TExPool, TRpc, Backend>, Error>
[src]

Defines which network specialization protocol to use.

pub fn with_opt_finality_proof_provider(
    self,
    builder: impl FnOnce(Arc<TCl>, Arc<Backend>) -> Result<Option<Arc<dyn FinalityProofProvider<TBl>>>, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, Arc<dyn FinalityProofProvider<TBl>>, TNetP, TExPool, TRpc, Backend>, Error>
[src]

Defines which strategy to use for providing finality proofs.

pub fn with_finality_proof_provider(
    self,
    build: impl FnOnce(Arc<TCl>, Arc<Backend>) -> Result<Arc<dyn FinalityProofProvider<TBl>>, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, Arc<dyn FinalityProofProvider<TBl>>, TNetP, TExPool, TRpc, Backend>, Error>
[src]

Defines which strategy to use for providing finality proofs.

pub fn with_import_queue_and_opt_fprb<UImpQu, UFprb>(
    self,
    builder: impl FnOnce(&Configuration<TCfg, TGen, TCSExt>, Arc<TCl>, Arc<Backend>, Option<TFchr>, Option<TSc>, Arc<TExPool>) -> Result<(UImpQu, Option<UFprb>), Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, UImpQu, UFprb, TFpp, TNetP, TExPool, TRpc, Backend>, Error> where
    TSc: Clone,
    TFchr: Clone
[src]

Defines which import queue to use.

pub fn with_import_queue_and_fprb<UImpQu, UFprb>(
    self,
    builder: impl FnOnce(&Configuration<TCfg, TGen, TCSExt>, Arc<TCl>, Arc<Backend>, Option<TFchr>, Option<TSc>, Arc<TExPool>) -> Result<(UImpQu, UFprb), Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, UImpQu, UFprb, TFpp, TNetP, TExPool, TRpc, Backend>, Error> where
    TSc: Clone,
    TFchr: Clone
[src]

Defines which import queue to use.

pub fn with_transaction_pool<UExPool>(
    self,
    transaction_pool_builder: impl FnOnce(Options, Arc<TCl>) -> Result<UExPool, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, UExPool, TRpc, Backend>, Error>
[src]

Defines which transaction pool to use.

pub fn with_rpc_extensions<URpc>(
    self,
    rpc_ext_builder: impl FnOnce(Arc<TCl>, Arc<TExPool>, Arc<Backend>) -> URpc
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, URpc, Backend>, Error>
[src]

Defines the RPC extensions to use.

pub fn with_dht_event_tx(
    self,
    dht_event_tx: Sender<DhtEvent>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend>, Error>
[src]

Adds a dht event sender to builder to be used by the network to send dht events to the authority discovery module.

impl<TBl, TRtApi, TCfg, TGen, TCSExt, TBackend, TExec, TSc, TImpQu, TNetP, TExPoolApi, TRpc> ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, Client<TBackend, TExec, TBl, TRtApi>, Arc<OnDemand<TBl>>, TSc, TImpQu, BoxFinalityProofRequestBuilder<TBl>, Arc<dyn FinalityProofProvider<TBl>>, TNetP, TransactionPool<TExPoolApi>, TRpc, TBackend> where
    Client<TBackend, TExec, TBl, TRtApi>: ProvideRuntimeApi,
    <Client<TBackend, TExec, TBl, TRtApi> as ProvideRuntimeApi>::Api: Metadata<TBl> + OffchainWorkerApi<TBl> + TaggedTransactionQueue<TBl> + SessionKeys<TBl>,
    TBl: BlockT<Hash = <Blake2Hasher as Hasher>::Out>,
    TRtApi: 'static + Send + Sync,
    TCfg: Default,
    TGen: RuntimeGenesis,
    TCSExt: Extension,
    TBackend: 'static + Backend<TBl, Blake2Hasher> + Send,
    TExec: 'static + CallExecutor<TBl, Blake2Hasher> + Send + Sync + Clone,
    TSc: Clone,
    TImpQu: 'static + ImportQueue<TBl>,
    TNetP: NetworkSpecialization<TBl>,
    TExPoolApi: 'static + ChainApi<Block = TBl, Hash = <TBl as BlockT>::Hash>,
    TRpc: RpcExtension<Metadata> + Clone
[src]

pub fn build(
    self
) -> Result<Service<TBl, Client<TBackend, TExec, TBl, TRtApi>, TSc, NetworkStatus<TBl>, NetworkService<TBl, TNetP, <TBl as BlockT>::Hash>, TransactionPool<TExPoolApi>, OffchainWorkers<Client<TBackend, TExec, TBl, TRtApi>, TBackend::OffchainStorage, TBl>>, Error>
[src]

Builds the service.

Trait Implementations

impl<TBl, TRtApi, TCfg, TGen, TCSExt, TBackend, TExec, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend> ServiceBuilderImport for ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, Client<TBackend, TExec, TBl, TRtApi>, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend> where
    TBl: BlockT<Hash = <Blake2Hasher as Hasher>::Out>,
    TBackend: 'static + Backend<TBl, Blake2Hasher> + Send,
    TExec: 'static + CallExecutor<TBl, Blake2Hasher> + Send + Sync + Clone,
    TImpQu: 'static + ImportQueue<TBl>,
    TRtApi: 'static + Send + Sync
[src]

impl<TBl, TRtApi, TCfg, TGen, TCSExt, TBackend, TExec, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc> ServiceBuilderExport for ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, Client<TBackend, TExec, TBl, TRtApi>, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TBackend> where
    TBl: BlockT<Hash = <Blake2Hasher as Hasher>::Out>,
    TBackend: 'static + Backend<TBl, Blake2Hasher> + Send,
    TExec: 'static + CallExecutor<TBl, Blake2Hasher> + Send + Sync + Clone
[src]

type Block = TBl

Type of block of the builder.

impl<TBl, TRtApi, TCfg, TGen, TCSExt, TBackend, TExec, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc> ServiceBuilderRevert for ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, Client<TBackend, TExec, TBl, TRtApi>, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TBackend> where
    TBl: BlockT<Hash = <Blake2Hasher as Hasher>::Out>,
    TBackend: 'static + Backend<TBl, Blake2Hasher> + Send,
    TExec: 'static + CallExecutor<TBl, Blake2Hasher> + Send + Sync + Clone
[src]

type Block = TBl

Type of block of the builder.

Auto Trait Implementations

impl<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend> !Send for ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend>

impl<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend> !Sync for ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend>

impl<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend> Unpin for ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend> where
    TBl: Unpin,
    TCSExt: Unpin,
    TCfg: Unpin,
    TFchr: Unpin,
    TFpp: Unpin,
    TFprb: Unpin,
    TImpQu: Unpin,
    TNetP: Unpin,
    TRpc: Unpin,
    TRtApi: Unpin,
    TSc: Unpin

impl<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend> !UnwindSafe for ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend>

impl<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend> !RefUnwindSafe for ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, Backend>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

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

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> CheckedConversion for T[src]

impl<T> SaturatedConversion for T[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

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

type Output = T

Should always be Self

impl<T> Erased for T[src]

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

impl<T> Typeable for T where
    T: Any
[src]