[−][src]Trait sc_service::AbstractService
Abstraction over a Substrate service.
Associated Types
type Block: BlockT
Type of block of this chain.
type Backend: 'static + BackendT<Self::Block>
Backend storage for the client.
type CallExecutor: 'static + CallExecutor<Self::Block> + Send + Sync + Clone
How to execute calls towards the runtime.
type RuntimeApi: Send + Sync
API that the runtime provides.
type SelectChain: SelectChain<Self::Block>
Chain selection algorithm.
type TransactionPool: TransactionPool<Block = Self::Block> + MallocSizeOfWasm
Transaction pool.
type Client: HeaderMetadata<Self::Block, Error = Error> + UsageProvider<Self::Block> + BlockchainEvents<Self::Block> + HeaderBackend<Self::Block> + Send + Sync
The generic Client type, the bounds here are the ones specifically required by internal crates like sc_informant.
Required methods
fn telemetry_on_connect_stream(&self) -> TracingUnboundedReceiver<()>
Get event stream for telemetry connection established events.
fn telemetry(&self) -> Option<Telemetry>
return a shared instance of Telemetry (if enabled)
fn spawn_task(
&self,
name: &'static str,
task: impl Future<Output = ()> + Send + 'static
)
&self,
name: &'static str,
task: impl Future<Output = ()> + Send + 'static
)
Use `spawn_task_handle().spawn() instead.
Spawns a task in the background that runs the future passed as parameter.
Information about this task will be reported to Prometheus.
The task name is a &'static str
as opposed to a String
. The reason for that is that
in order to avoid memory consumption issues with the Prometheus metrics, the set of
possible task names has to be bounded.
fn spawn_essential_task(
&self,
name: &'static str,
task: impl Future<Output = ()> + Send + 'static
)
&self,
name: &'static str,
task: impl Future<Output = ()> + Send + 'static
)
Use `spawn_essential_task_handle().spawn() instead.
Spawns a task in the background that runs the future passed as parameter. The given task is considered essential, i.e. if it errors we trigger a service exit.
fn spawn_essential_task_handle(&self) -> SpawnEssentialTaskHandle
Returns a handle for spawning essential tasks. Any task spawned through this handle is considered essential, i.e. if it errors we trigger a service exit.
fn spawn_task_handle(&self) -> SpawnTaskHandle
Returns a handle for spawning tasks.
fn keystore(&self) -> KeyStorePtr
Returns the keystore that stores keys.
fn rpc_query(
&self,
mem: &RpcSession,
request: &str
) -> Pin<Box<dyn Future<Output = Option<String>> + Send>>
&self,
mem: &RpcSession,
request: &str
) -> Pin<Box<dyn Future<Output = Option<String>> + Send>>
Starts an RPC query.
The query is passed as a string and must be a JSON text similar to what an HTTP client would for example send.
Returns a Future
that contains the optional response.
If the request subscribes you to events, the Sender
in the RpcSession
object is used to
send back spontaneous events.
fn client(&self) -> Arc<Self::Client>
Get shared client instance.
fn select_chain(&self) -> Option<Self::SelectChain>
Get clone of select chain.
fn network(
&self
) -> Arc<NetworkService<Self::Block, <Self::Block as BlockT>::Hash>>
&self
) -> Arc<NetworkService<Self::Block, <Self::Block as BlockT>::Hash>>
Get shared network instance.
fn network_status(
&self,
interval: Duration
) -> TracingUnboundedReceiver<(NetworkStatus<Self::Block>, NetworkState)>
&self,
interval: Duration
) -> TracingUnboundedReceiver<(NetworkStatus<Self::Block>, NetworkState)>
Returns a receiver that periodically receives a status of the network.
fn transaction_pool(&self) -> Arc<Self::TransactionPool>
Get shared transaction pool instance.
fn on_exit(&self) -> Exit
Use spawn_task
/spawn_essential_task
instead, those functions will attach on_exit signal.
Get a handle to a future that will resolve on exit.
fn prometheus_registry(&self) -> Option<Registry>
Get the prometheus metrics registry, if available.
fn base_path(&self) -> Option<Arc<BasePath>>
Get a clone of the base_path
Implementors
impl<TBl, TBackend, TExec, TRtApi, TSc, TExPool, TOc> AbstractService for Service<TBl, Client<TBackend, TExec, TBl, TRtApi>, TSc, NetworkStatus<TBl>, NetworkService<TBl, TBl::Hash>, TExPool, TOc> where
TBl: BlockT,
TBackend: 'static + BackendT<TBl>,
TExec: 'static + CallExecutor<TBl, Backend = TBackend> + Send + Sync + Clone,
TRtApi: 'static + Send + Sync + ConstructRuntimeApi<TBl, Client<TBackend, TExec, TBl, TRtApi>>,
<TRtApi as ConstructRuntimeApi<TBl, Client<TBackend, TExec, TBl, TRtApi>>>::RuntimeApi: Core<TBl> + ApiExt<TBl, StateBackend = TBackend::State> + ApiErrorExt<Error = Error> + BlockBuilder<TBl>,
TSc: SelectChain<TBl> + 'static + Clone + Send + Unpin,
TExPool: 'static + TransactionPool<Block = TBl> + MallocSizeOfWasm,
TOc: 'static + Send + Sync,
[src]
TBl: BlockT,
TBackend: 'static + BackendT<TBl>,
TExec: 'static + CallExecutor<TBl, Backend = TBackend> + Send + Sync + Clone,
TRtApi: 'static + Send + Sync + ConstructRuntimeApi<TBl, Client<TBackend, TExec, TBl, TRtApi>>,
<TRtApi as ConstructRuntimeApi<TBl, Client<TBackend, TExec, TBl, TRtApi>>>::RuntimeApi: Core<TBl> + ApiExt<TBl, StateBackend = TBackend::State> + ApiErrorExt<Error = Error> + BlockBuilder<TBl>,
TSc: SelectChain<TBl> + 'static + Clone + Send + Unpin,
TExPool: 'static + TransactionPool<Block = TBl> + MallocSizeOfWasm,
TOc: 'static + Send + Sync,
type Block = TBl
type Backend = TBackend
type CallExecutor = TExec
type RuntimeApi = TRtApi
type SelectChain = TSc
type TransactionPool = TExPool
type Client = Client<Self::Backend, Self::CallExecutor, Self::Block, Self::RuntimeApi>
fn telemetry_on_connect_stream(&self) -> TracingUnboundedReceiver<()>
[src]
fn telemetry(&self) -> Option<Telemetry>
[src]
fn keystore(&self) -> KeyStorePtr
[src]
fn spawn_task(
&self,
name: &'static str,
task: impl Future<Output = ()> + Send + 'static
)
[src]
&self,
name: &'static str,
task: impl Future<Output = ()> + Send + 'static
)
fn spawn_essential_task(
&self,
name: &'static str,
task: impl Future<Output = ()> + Send + 'static
)
[src]
&self,
name: &'static str,
task: impl Future<Output = ()> + Send + 'static
)
fn spawn_task_handle(&self) -> SpawnTaskHandle
[src]
fn spawn_essential_task_handle(&self) -> SpawnEssentialTaskHandle
[src]
fn rpc_query(
&self,
mem: &RpcSession,
request: &str
) -> Pin<Box<dyn Future<Output = Option<String>> + Send>>
[src]
&self,
mem: &RpcSession,
request: &str
) -> Pin<Box<dyn Future<Output = Option<String>> + Send>>
fn client(&self) -> Arc<Self::Client>
[src]
fn select_chain(&self) -> Option<Self::SelectChain>
[src]
fn network(
&self
) -> Arc<NetworkService<Self::Block, <Self::Block as BlockT>::Hash>>
[src]
&self
) -> Arc<NetworkService<Self::Block, <Self::Block as BlockT>::Hash>>
fn network_status(
&self,
interval: Duration
) -> TracingUnboundedReceiver<(NetworkStatus<Self::Block>, NetworkState)>
[src]
&self,
interval: Duration
) -> TracingUnboundedReceiver<(NetworkStatus<Self::Block>, NetworkState)>