[−][src]Struct sc_service::ServiceBuilder
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<TGen, TCSExt> ServiceBuilder<(), (), TGen, TCSExt, (), (), (), (), (), (), (), (), ()> where
TGen: RuntimeGenesis,
TCSExt: Extension,
[src]
TGen: RuntimeGenesis,
TCSExt: Extension,
pub fn new_full<TBl: BlockT, TRtApi, TExecDisp: NativeExecutionDispatch + 'static>(
config: Configuration<TGen, TCSExt>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TFullClient<TBl, TRtApi, TExecDisp>, Arc<OnDemand<TBl>>, (), (), BoxFinalityProofRequestBuilder<TBl>, Arc<dyn FinalityProofProvider<TBl>>, (), (), TFullBackend<TBl>>, Error>
[src]
config: Configuration<TGen, TCSExt>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TFullClient<TBl, TRtApi, TExecDisp>, Arc<OnDemand<TBl>>, (), (), BoxFinalityProofRequestBuilder<TBl>, Arc<dyn FinalityProofProvider<TBl>>, (), (), TFullBackend<TBl>>, Error>
Start the service builder with a configuration.
pub fn new_light<TBl: BlockT, TRtApi, TExecDisp: NativeExecutionDispatch + 'static>(
config: Configuration<TGen, TCSExt>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TLightClient<TBl, TRtApi, TExecDisp>, Arc<OnDemand<TBl>>, (), (), BoxFinalityProofRequestBuilder<TBl>, Arc<dyn FinalityProofProvider<TBl>>, (), (), TLightBackend<TBl>>, Error>
[src]
config: Configuration<TGen, TCSExt>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TLightClient<TBl, TRtApi, TExecDisp>, Arc<OnDemand<TBl>>, (), (), BoxFinalityProofRequestBuilder<TBl>, Arc<dyn FinalityProofProvider<TBl>>, (), (), TLightBackend<TBl>>, Error>
Start the service builder with a configuration.
impl<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend> ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, 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 keystore(&self) -> Arc<RwLock<Keystore>>
[src]
Returns a reference to the keystore
pub fn pool(&self) -> Arc<TExPool>
[src]
Returns a reference to the transaction pool stored in this builder
pub fn fetcher(&self) -> Option<TFchr> where
TFchr: Clone,
[src]
TFchr: Clone,
Returns a reference to the fetcher, only available if builder
was created with new_light
.
pub fn remote_backend(&self) -> Option<Arc<dyn RemoteBlockchain<TBl>>>
[src]
Returns a reference to the remote_backend, only available if builder
was created with new_light
.
pub fn with_opt_select_chain<USc>(
self,
select_chain_builder: impl FnOnce(&Configuration<TGen, TCSExt>, &Arc<Backend>) -> Result<Option<USc>, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, USc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>, Error>
[src]
self,
select_chain_builder: impl FnOnce(&Configuration<TGen, TCSExt>, &Arc<Backend>) -> Result<Option<USc>, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, USc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>, Error>
Defines which head-of-chain strategy to use.
pub fn with_select_chain<USc>(
self,
builder: impl FnOnce(&Configuration<TGen, TCSExt>, &Arc<Backend>) -> Result<USc, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, USc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>, Error>
[src]
self,
builder: impl FnOnce(&Configuration<TGen, TCSExt>, &Arc<Backend>) -> Result<USc, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, USc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>, Error>
Defines which head-of-chain strategy to use.
pub fn with_import_queue<UImpQu>(
self,
builder: impl FnOnce(&Configuration<TGen, TCSExt>, Arc<TCl>, Option<TSc>, Arc<TExPool>) -> Result<UImpQu, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, UImpQu, TFprb, TFpp, TExPool, TRpc, Backend>, Error> where
TSc: Clone,
[src]
self,
builder: impl FnOnce(&Configuration<TGen, TCSExt>, Arc<TCl>, Option<TSc>, Arc<TExPool>) -> Result<UImpQu, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, UImpQu, TFprb, TFpp, TExPool, TRpc, Backend>, Error> where
TSc: Clone,
Defines which import queue 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, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, Arc<dyn FinalityProofProvider<TBl>>, TExPool, TRpc, Backend>, Error>
[src]
self,
builder: impl FnOnce(Arc<TCl>, Arc<Backend>) -> Result<Option<Arc<dyn FinalityProofProvider<TBl>>>, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, Arc<dyn FinalityProofProvider<TBl>>, TExPool, TRpc, Backend>, Error>
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, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, Arc<dyn FinalityProofProvider<TBl>>, TExPool, TRpc, Backend>, Error>
[src]
self,
build: impl FnOnce(Arc<TCl>, Arc<Backend>) -> Result<Arc<dyn FinalityProofProvider<TBl>>, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, Arc<dyn FinalityProofProvider<TBl>>, TExPool, TRpc, Backend>, Error>
Defines which strategy to use for providing finality proofs.
pub fn with_import_queue_and_opt_fprb<UImpQu, UFprb>(
self,
builder: impl FnOnce(&Configuration<TGen, TCSExt>, Arc<TCl>, Arc<Backend>, Option<TFchr>, Option<TSc>, Arc<TExPool>) -> Result<(UImpQu, Option<UFprb>), Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, UImpQu, UFprb, TFpp, TExPool, TRpc, Backend>, Error> where
TSc: Clone,
TFchr: Clone,
[src]
self,
builder: impl FnOnce(&Configuration<TGen, TCSExt>, Arc<TCl>, Arc<Backend>, Option<TFchr>, Option<TSc>, Arc<TExPool>) -> Result<(UImpQu, Option<UFprb>), Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, UImpQu, UFprb, TFpp, TExPool, TRpc, Backend>, Error> where
TSc: Clone,
TFchr: Clone,
Defines which import queue to use.
pub fn with_import_queue_and_fprb<UImpQu, UFprb>(
self,
builder: impl FnOnce(&Configuration<TGen, TCSExt>, Arc<TCl>, Arc<Backend>, Option<TFchr>, Option<TSc>, Arc<TExPool>) -> Result<(UImpQu, UFprb), Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, UImpQu, UFprb, TFpp, TExPool, TRpc, Backend>, Error> where
TSc: Clone,
TFchr: Clone,
[src]
self,
builder: impl FnOnce(&Configuration<TGen, TCSExt>, Arc<TCl>, Arc<Backend>, Option<TFchr>, Option<TSc>, Arc<TExPool>) -> Result<(UImpQu, UFprb), Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, UImpQu, UFprb, TFpp, TExPool, TRpc, Backend>, Error> where
TSc: Clone,
TFchr: Clone,
Defines which import queue to use.
pub fn with_transaction_pool<UExPool>(
self,
transaction_pool_builder: impl FnOnce(Options, Arc<TCl>, Option<TFchr>) -> Result<(UExPool, Option<Pin<Box<dyn Future<Output = ()> + Send>>>), Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, UExPool, TRpc, Backend>, Error> where
TSc: Clone,
TFchr: Clone,
[src]
self,
transaction_pool_builder: impl FnOnce(Options, Arc<TCl>, Option<TFchr>) -> Result<(UExPool, Option<Pin<Box<dyn Future<Output = ()> + Send>>>), Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, UExPool, TRpc, Backend>, Error> where
TSc: Clone,
TFchr: Clone,
Defines which transaction pool to use.
pub fn with_rpc_extensions<URpc>(
self,
rpc_ext_builder: impl FnOnce(&Self) -> Result<URpc, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, URpc, Backend>, Error> where
TSc: Clone,
TFchr: Clone,
[src]
self,
rpc_ext_builder: impl FnOnce(&Self) -> Result<URpc, Error>
) -> Result<ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, URpc, Backend>, Error> where
TSc: Clone,
TFchr: Clone,
Defines the RPC extensions to use.
pub fn with_prometheus_registry(self, registry: Registry) -> Self
[src]
Use an existing prometheus Registry
to record metrics into.
impl<TBl, TRtApi, TGen, TCSExt, TBackend, TExec, TSc, TImpQu, TExPool, TRpc> ServiceBuilder<TBl, TRtApi, TGen, TCSExt, Client<TBackend, TExec, TBl, TRtApi>, Arc<OnDemand<TBl>>, TSc, TImpQu, BoxFinalityProofRequestBuilder<TBl>, Arc<dyn FinalityProofProvider<TBl>>, TExPool, TRpc, TBackend> where
Client<TBackend, TExec, TBl, TRtApi>: ProvideRuntimeApi<TBl>,
<Client<TBackend, TExec, TBl, TRtApi> as ProvideRuntimeApi<TBl>>::Api: Metadata<TBl> + OffchainWorkerApi<TBl> + TaggedTransactionQueue<TBl> + SessionKeys<TBl> + ApiErrorExt<Error = Error> + ApiExt<TBl, StateBackend = TBackend::State>,
TBl: BlockT,
TRtApi: 'static + Send + Sync,
TGen: RuntimeGenesis,
TCSExt: Extension,
TBackend: 'static + Backend<TBl> + Send,
TExec: 'static + CallExecutor<TBl> + Send + Sync + Clone,
TSc: Clone,
TImpQu: 'static + ImportQueue<TBl>,
TExPool: MaintainedTransactionPool<Block = TBl, Hash = <TBl as BlockT>::Hash> + MallocSizeOfWasm + 'static,
TRpc: RpcExtension<Metadata> + Clone,
[src]
Client<TBackend, TExec, TBl, TRtApi>: ProvideRuntimeApi<TBl>,
<Client<TBackend, TExec, TBl, TRtApi> as ProvideRuntimeApi<TBl>>::Api: Metadata<TBl> + OffchainWorkerApi<TBl> + TaggedTransactionQueue<TBl> + SessionKeys<TBl> + ApiErrorExt<Error = Error> + ApiExt<TBl, StateBackend = TBackend::State>,
TBl: BlockT,
TRtApi: 'static + Send + Sync,
TGen: RuntimeGenesis,
TCSExt: Extension,
TBackend: 'static + Backend<TBl> + Send,
TExec: 'static + CallExecutor<TBl> + Send + Sync + Clone,
TSc: Clone,
TImpQu: 'static + ImportQueue<TBl>,
TExPool: MaintainedTransactionPool<Block = TBl, Hash = <TBl as BlockT>::Hash> + MallocSizeOfWasm + 'static,
TRpc: RpcExtension<Metadata> + Clone,
pub fn with_execution_extensions_factory(
self,
execution_extensions_factory: Box<dyn ExtensionsFactory>
) -> Result<Self, Error>
[src]
self,
execution_extensions_factory: Box<dyn ExtensionsFactory>
) -> Result<Self, Error>
Set an ExecutionExtensionsFactory
pub fn build(
self
) -> Result<Service<TBl, Client<TBackend, TExec, TBl, TRtApi>, TSc, NetworkStatus<TBl>, NetworkService<TBl, <TBl as BlockT>::Hash>, TExPool, OffchainWorkers<Client<TBackend, TExec, TBl, TRtApi>, TBackend::OffchainStorage, TBl>>, Error>
[src]
self
) -> Result<Service<TBl, Client<TBackend, TExec, TBl, TRtApi>, TSc, NetworkStatus<TBl>, NetworkService<TBl, <TBl as BlockT>::Hash>, TExPool, OffchainWorkers<Client<TBackend, TExec, TBl, TRtApi>, TBackend::OffchainStorage, TBl>>, Error>
Builds the service.
Trait Implementations
impl<TBl, TRtApi, TGen, TCSExt, TBackend, TExecDisp, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend> ServiceBuilderCommand for ServiceBuilder<TBl, TRtApi, TGen, TCSExt, Client<TBackend, LocalCallExecutor<TBackend, NativeExecutor<TExecDisp>>, TBl, TRtApi>, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend> where
TBl: BlockT,
TBackend: 'static + Backend<TBl> + Send,
TExecDisp: 'static + NativeExecutionDispatch,
TImpQu: 'static + ImportQueue<TBl>,
TRtApi: 'static + Send + Sync,
[src]
TBl: BlockT,
TBackend: 'static + Backend<TBl> + Send,
TExecDisp: 'static + NativeExecutionDispatch,
TImpQu: 'static + ImportQueue<TBl>,
TRtApi: 'static + Send + Sync,
type Block = TBl
Block type this API operates on.
type NativeDispatch = TExecDisp
Native execution dispatch required by some commands.
fn import_blocks(
self,
input: impl Read + Seek + Send + 'static,
force: bool
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>
[src]
self,
input: impl Read + Seek + Send + 'static,
force: bool
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>
fn export_blocks(
self,
output: impl Write + 'static,
from: NumberFor<TBl>,
to: Option<NumberFor<TBl>>,
json: bool
) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>
[src]
self,
output: impl Write + 'static,
from: NumberFor<TBl>,
to: Option<NumberFor<TBl>>,
json: bool
) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>
fn revert_chain(&self, blocks: NumberFor<TBl>) -> Result<(), Error>
[src]
fn check_block(
self,
block_id: BlockId<TBl>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>
[src]
self,
block_id: BlockId<TBl>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>
Auto Trait Implementations
impl<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend> !RefUnwindSafe for ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>
impl<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend> Send for ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend> where
Backend: Send + Sync,
TBl: Send,
TCSExt: Send,
TCl: Send + Sync,
TExPool: Send + Sync,
TFchr: Send,
TFpp: Send,
TFprb: Send,
TImpQu: Send,
TRpc: Send,
TRtApi: Send,
TSc: Send,
Backend: Send + Sync,
TBl: Send,
TCSExt: Send,
TCl: Send + Sync,
TExPool: Send + Sync,
TFchr: Send,
TFpp: Send,
TFprb: Send,
TImpQu: Send,
TRpc: Send,
TRtApi: Send,
TSc: Send,
impl<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend> !Sync for ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>
impl<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend> Unpin for ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend> where
TBl: Unpin,
TCSExt: Unpin,
TFchr: Unpin,
TFpp: Unpin,
TFprb: Unpin,
TImpQu: Unpin,
TRpc: Unpin,
TRtApi: Unpin,
TSc: Unpin,
TBl: Unpin,
TCSExt: Unpin,
TFchr: Unpin,
TFpp: Unpin,
TFprb: Unpin,
TImpQu: Unpin,
TRpc: Unpin,
TRtApi: Unpin,
TSc: Unpin,
impl<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend> !UnwindSafe for ServiceBuilder<TBl, TRtApi, TGen, TCSExt, TCl, TFchr, TSc, TImpQu, TFprb, TFpp, TExPool, TRpc, Backend>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedConversion for T
[src]
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
[src]
Self: TryFrom<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
[src]
Self: TryInto<T>,
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
[src]
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
type Output = T
Should always be Self
impl<T> SaturatedConversion for T
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Self: UniqueSaturatedFrom<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Self: UniqueSaturatedInto<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
[src]
T: UncheckedFrom<S>,
fn unchecked_into(self) -> T
[src]
impl<T, S> UniqueSaturatedInto<T> for S where
S: TryInto<T>,
T: Bounded,
S: TryInto<T>,
T: Bounded,
fn unique_saturated_into(self) -> T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,