pub trait NodeExt: Node {
// Provided methods
fn statistics(
&self,
header_hash: HeaderHash,
) -> impl Future<Output = NodeResult<Statistics>> + Send { ... }
fn subscribe_statistics(
&self,
finalized: bool,
) -> impl Future<Output = NodeResult<impl Stream<Item = NodeResult<ChainSubUpdate<Statistics>>> + Send>> + Send { ... }
fn service_data(
&self,
header_hash: HeaderHash,
id: ServiceId,
) -> impl Future<Output = NodeResult<Option<Service>>> + Send { ... }
fn subscribe_service_data(
&self,
id: ServiceId,
finalized: bool,
) -> impl Future<Output = NodeResult<impl Stream<Item = NodeResult<ChainSubUpdate<Option<Service>>>> + Send>> + Send { ... }
fn typed_service_value<V: Decode>(
&self,
header_hash: HeaderHash,
id: ServiceId,
key: &(impl Encode + Sync + ?Sized),
) -> impl Future<Output = NodeResult<Option<V>>> + Send { ... }
fn subscribe_typed_service_value<V: Decode>(
&self,
id: ServiceId,
key: &(impl Encode + Sync + ?Sized),
finalized: bool,
) -> impl Future<Output = NodeResult<impl Stream<Item = NodeResult<ChainSubUpdate<Option<V>>>> + Send>> + Send { ... }
fn submit_work_package(
&self,
core: CoreIndex,
package: &WorkPackage,
extrinsics: &[Bytes],
) -> impl Future<Output = NodeResult<()>> + Send { ... }
}Expand description
An extension trait for Nodes which provides various convenience methods. In particular, it
provides wrapper methods which encode/decode data provided to/returned from the underlying
Node methods.
Provided Methods§
Sourcefn statistics(
&self,
header_hash: HeaderHash,
) -> impl Future<Output = NodeResult<Statistics>> + Send
fn statistics( &self, header_hash: HeaderHash, ) -> impl Future<Output = NodeResult<Statistics>> + Send
Returns the activity statistics stored in the posterior state of the block with the given header hash.
Sourcefn subscribe_statistics(
&self,
finalized: bool,
) -> impl Future<Output = NodeResult<impl Stream<Item = NodeResult<ChainSubUpdate<Statistics>>> + Send>> + Send
fn subscribe_statistics( &self, finalized: bool, ) -> impl Future<Output = NodeResult<impl Stream<Item = NodeResult<ChainSubUpdate<Statistics>>> + Send>> + Send
Subscribe to updates of the activity statistics stored in chain state.
Sourcefn service_data(
&self,
header_hash: HeaderHash,
id: ServiceId,
) -> impl Future<Output = NodeResult<Option<Service>>> + Send
fn service_data( &self, header_hash: HeaderHash, id: ServiceId, ) -> impl Future<Output = NodeResult<Option<Service>>> + Send
Returns the storage data for the service with the given ID.
None is returned if there is no service with the given ID.
Sourcefn subscribe_service_data(
&self,
id: ServiceId,
finalized: bool,
) -> impl Future<Output = NodeResult<impl Stream<Item = NodeResult<ChainSubUpdate<Option<Service>>>> + Send>> + Send
fn subscribe_service_data( &self, id: ServiceId, finalized: bool, ) -> impl Future<Output = NodeResult<impl Stream<Item = NodeResult<ChainSubUpdate<Option<Service>>>> + Send>> + Send
Subscribe to updates of the storage data for the service with the given ID.
The value field of updates will be None when there is no service with the given ID.
Sourcefn typed_service_value<V: Decode>(
&self,
header_hash: HeaderHash,
id: ServiceId,
key: &(impl Encode + Sync + ?Sized),
) -> impl Future<Output = NodeResult<Option<V>>> + Send
fn typed_service_value<V: Decode>( &self, header_hash: HeaderHash, id: ServiceId, key: &(impl Encode + Sync + ?Sized), ) -> impl Future<Output = NodeResult<Option<V>>> + Send
Returns the value associated with the given service ID and key in the posterior state of the block with the given header hash.
None is returned if there is no value associated with the given service ID and key.
The key is encoded prior to lookup in the state, and the returned value is decoded as type
V.
Sourcefn subscribe_typed_service_value<V: Decode>(
&self,
id: ServiceId,
key: &(impl Encode + Sync + ?Sized),
finalized: bool,
) -> impl Future<Output = NodeResult<impl Stream<Item = NodeResult<ChainSubUpdate<Option<V>>>> + Send>> + Send
fn subscribe_typed_service_value<V: Decode>( &self, id: ServiceId, key: &(impl Encode + Sync + ?Sized), finalized: bool, ) -> impl Future<Output = NodeResult<impl Stream<Item = NodeResult<ChainSubUpdate<Option<V>>>> + Send>> + Send
Subscribe to updates of the value associated with the given service ID and key.
The value field of updates will be None when there is no value associated with the
given service ID and key.
The key is encoded prior to lookup in the state, and values are decoded as type V.
Sourcefn submit_work_package(
&self,
core: CoreIndex,
package: &WorkPackage,
extrinsics: &[Bytes],
) -> impl Future<Output = NodeResult<()>> + Send
fn submit_work_package( &self, core: CoreIndex, package: &WorkPackage, extrinsics: &[Bytes], ) -> impl Future<Output = NodeResult<()>> + Send
Submit a work-package to the guarantors currently assigned to the given core.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.