[][src]Struct substrate_service::ServiceBuilder

pub struct ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, 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> ServiceBuilder<(), (), TCfg, TGen, (), (), (), (), (), (), (), (), (), (), ()> where
    TGen: Serialize + DeserializeOwned + BuildStorage
[src]

pub fn new_full<TBl: BlockT<Hash = H256>, TRtApi, TExecDisp: NativeExecutionDispatch>(
    config: Configuration<TCfg, TGen>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, Client<Backend<TBl>, LocalCallExecutor<Backend<TBl>, NativeExecutor<TExecDisp>>, TBl, TRtApi>, Arc<OnDemand<TBl>>, (), (), BoxFinalityProofRequestBuilder<TBl>, (), (), (), (), FullRpcBuilder<TBl, TRtApi, TExecDisp>, 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>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, Client<Backend<LightStorage<TBl>, Blake2Hasher>, GenesisCallExecutor<Backend<LightStorage<TBl>, Blake2Hasher>, LocalCallExecutor<Backend<LightStorage<TBl>, Blake2Hasher>, NativeExecutor<TExecDisp>>>, TBl, TRtApi>, Arc<OnDemand<TBl>>, (), (), BoxFinalityProofRequestBuilder<TBl>, (), (), (), (), LightRpcBuilder<TBl, TRtApi, TExecDisp>, Backend<LightStorage<TBl>, Blake2Hasher>>, Error>
[src]

Start the service builder with a configuration.

impl<TBl, TRtApi, TCfg, TGen, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, Backend> ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, 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>, &Arc<Backend>) -> Result<Option<USc>, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCl, TFchr, USc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, Backend>, Error>
[src]

Defines which head-of-chain strategy to use.

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

Defines which head-of-chain strategy to use.

pub fn with_import_queue<UImpQu>(
    self,
    builder: impl FnOnce(&Configuration<TCfg, TGen>, Arc<TCl>, Option<TSc>, Arc<TExPool>) -> Result<UImpQu, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCl, TFchr, TSc, UImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, 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>) -> Result<UNetP, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, UNetP, TExPool, TRpc, TRpcB, 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, TCl, TFchr, TSc, TImpQu, TFprb, Arc<dyn FinalityProofProvider<TBl>>, TNetP, TExPool, TRpc, TRpcB, 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, TCl, TFchr, TSc, TImpQu, TFprb, Arc<dyn FinalityProofProvider<TBl>>, TNetP, TExPool, TRpc, TRpcB, 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>, Arc<TCl>, Arc<Backend>, Option<TFchr>, Option<TSc>, Arc<TExPool>) -> Result<(UImpQu, Option<UFprb>), Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCl, TFchr, TSc, UImpQu, UFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, 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>, Arc<TCl>, Arc<Backend>, Option<TFchr>, Option<TSc>, Arc<TExPool>) -> Result<(UImpQu, UFprb), Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCl, TFchr, TSc, UImpQu, UFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, 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, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, UExPool, TRpc, TRpcB, 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>) -> URpc
) -> Result<ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, URpc, TRpcB, 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, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, 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, TBackend, TExec, TSc, TImpQu, TNetP, TExPoolApi, TRpc, TRpcB> ServiceBuilder<TBl, TRtApi, TCfg, TGen, Client<TBackend, TExec, TBl, TRtApi>, Arc<OnDemand<TBl>>, TSc, TImpQu, BoxFinalityProofRequestBuilder<TBl>, Arc<dyn FinalityProofProvider<TBl>>, TNetP, TransactionPool<TExPoolApi>, TRpc, TRpcB, 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: Serialize + DeserializeOwned + BuildStorage,
    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,
    TRpcB: RpcBuilder<TBl, TBackend, TExec, TRtApi>, 
[src]

pub fn build(
    self
) -> Result<NewService<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, TBackend, TExec, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, Backend> ServiceBuilderImport for ServiceBuilder<TBl, TRtApi, TCfg, TGen, Client<TBackend, TExec, TBl, TRtApi>, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, 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, TBackend, TExec, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB> ServiceBuilderExport for ServiceBuilder<TBl, TRtApi, TCfg, TGen, Client<TBackend, TExec, TBl, TRtApi>, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, 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, TBackend, TExec, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB> ServiceBuilderRevert for ServiceBuilder<TBl, TRtApi, TCfg, TGen, Client<TBackend, TExec, TBl, TRtApi>, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, 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, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, Backend> Send for ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, Backend> where
    Backend: Send + Sync,
    TBl: Send,
    TCfg: Send,
    TCl: Send + Sync,
    TExPool: Send + Sync,
    TFchr: Send,
    TFpp: Send,
    TFprb: Send,
    TImpQu: Send,
    TNetP: Send,
    TRpc: Send,
    TRpcB: Send,
    TRtApi: Send,
    TSc: Send

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

impl<TBl, TRtApi, TCfg, TGen, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, Backend> Sync for ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, Backend> where
    Backend: Send + Sync,
    TBl: Sync,
    TCfg: Sync,
    TCl: Send + Sync,
    TExPool: Send + Sync,
    TFchr: Sync,
    TFpp: Sync,
    TFprb: Sync,
    TImpQu: Sync,
    TNetP: Sync,
    TRpc: Sync,
    TRpcB: Sync,
    TRtApi: Sync,
    TSc: Sync

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

impl<TBl, TRtApi, TCfg, TGen, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, Backend> !RefUnwindSafe for ServiceBuilder<TBl, TRtApi, TCfg, TGen, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TNetP, TExPool, TRpc, TRpcB, 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> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<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> 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> SaturatedConversion for T[src]

impl<T> CheckedConversion for T[src]

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

impl<T> Erased for T[src]

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