Trait RpcServer

Source
pub trait RpcServer:
    Sized
    + Send
    + Sync
    + 'static {
Show 26 methods // Required methods fn parameters(&self) -> RpcResult<VersionedParameters>; fn best_block(&self) -> RpcResult<BlockDesc>; fn finalized_block(&self) -> RpcResult<BlockDesc>; fn parent(&self, header_hash: HeaderHash) -> RpcResult<BlockDesc>; fn state_root(&self, header_hash: HeaderHash) -> RpcResult<StateRootHash>; fn statistics(&self, header_hash: HeaderHash) -> RpcResult<Vec<u8>>; fn service_data( &self, header_hash: HeaderHash, id: ServiceId, ) -> RpcResult<Option<Vec<u8>>>; fn service_value( &self, header_hash: HeaderHash, id: ServiceId, key: Vec<u8>, ) -> RpcResult<Option<Vec<u8>>>; fn service_preimage( &self, header_hash: HeaderHash, id: ServiceId, hash: Hash, ) -> RpcResult<Option<Vec<u8>>>; fn service_request( &self, header_hash: HeaderHash, id: ServiceId, hash: Hash, len: u32, ) -> RpcResult<Option<Vec<Slot>>>; fn beefy_root(&self, header_hash: HeaderHash) -> RpcResult<MmrPeakHash>; fn submit_work_package<'life0, 'async_trait>( &'life0 self, core: CoreIndex, package: Vec<u8>, extrinsics: Vec<Vec<u8>>, ) -> Pin<Box<dyn Future<Output = RpcResult<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn submit_preimage( &self, requester: ServiceId, preimage: Vec<u8>, ) -> RpcResult<()>; fn list_services( &self, header_hash: HeaderHash, ) -> RpcResult<Vec<ServiceId>>; fn fetch_work_package_segments<'life0, 'async_trait>( &'life0 self, wp_hash: WorkPackageHash, indices: Vec<u16>, ) -> Pin<Box<dyn Future<Output = RpcResult<Vec<Segment>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn fetch_segments<'life0, 'async_trait>( &'life0 self, segment_root: SegmentTreeRoot, indices: Vec<u16>, ) -> Pin<Box<dyn Future<Output = RpcResult<Vec<Segment>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn sync_state(&self) -> RpcResult<SyncState>; fn subscribe_best_block<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn subscribe_finalized_block<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn subscribe_statistics<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, finalized: bool, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn subscribe_service_data<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, id: ServiceId, finalized: bool, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn subscribe_service_value<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, id: ServiceId, key: Vec<u8>, finalized: bool, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn subscribe_service_preimage<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, id: ServiceId, hash: Hash, finalized: bool, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn subscribe_service_request<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, id: ServiceId, hash: Hash, len: u32, finalized: bool, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn subscribe_sync_status<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided method fn into_rpc(self) -> RpcModule<Self> { ... }
}
Expand description

Server trait implementation for the Rpc RPC API.

Required Methods§

Source

fn parameters(&self) -> RpcResult<VersionedParameters>

Parameters of the chain, version 1.

Source

fn best_block(&self) -> RpcResult<BlockDesc>

Returns the header hash and slot of the head of the “best” chain.

Source

fn finalized_block(&self) -> RpcResult<BlockDesc>

Returns the header hash and slot of the latest finalized block.

Source

fn parent(&self, header_hash: HeaderHash) -> RpcResult<BlockDesc>

Returns the header hash and slot of the parent of the block with the given header hash.

Source

fn state_root(&self, header_hash: HeaderHash) -> RpcResult<StateRootHash>

Returns the posterior state root of the block with the given header hash.

Source

fn statistics(&self, header_hash: HeaderHash) -> RpcResult<Vec<u8>>

Returns the activity statistics stored in the posterior state of the block with the given header hash.

The statistics are encoded as per the GP.

Source

fn service_data( &self, header_hash: HeaderHash, id: ServiceId, ) -> RpcResult<Option<Vec<u8>>>

Returns the storage data for the service of the given service ID.

The data are encoded as per the GP. None is returned if there is no value associated with the given service ID.

Source

fn service_value( &self, header_hash: HeaderHash, id: ServiceId, key: Vec<u8>, ) -> RpcResult<Option<Vec<u8>>>

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.

Source

fn service_preimage( &self, header_hash: HeaderHash, id: ServiceId, hash: Hash, ) -> RpcResult<Option<Vec<u8>>>

Returns the preimage associated with the given service ID and hash in the posterior state of the block with the given header hash.

None is returned if there is no preimage associated with the given service ID and hash.

Source

fn service_request( &self, header_hash: HeaderHash, id: ServiceId, hash: Hash, len: u32, ) -> RpcResult<Option<Vec<Slot>>>

Returns the preimage request associated with the given service ID and hash/len in the posterior state of the block with the given header hash.

None is returned if there is no preimage request associated with the given service ID, hash and length.

Source

fn beefy_root(&self, header_hash: HeaderHash) -> RpcResult<MmrPeakHash>

Returns the BEEFY root of the block with the given header hash.

Source

fn submit_work_package<'life0, 'async_trait>( &'life0 self, core: CoreIndex, package: Vec<u8>, extrinsics: Vec<Vec<u8>>, ) -> Pin<Box<dyn Future<Output = RpcResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Submit a work-package to the guarantors currently assigned to the given core.

Source

fn submit_preimage( &self, requester: ServiceId, preimage: Vec<u8>, ) -> RpcResult<()>

Submit a preimage which is being requested by a given service.

Note that this method does not wait for the preimage to be distributed or integrated on-chain; it returns immediately.

Source

fn list_services(&self, header_hash: HeaderHash) -> RpcResult<Vec<ServiceId>>

Returns a list of all services currently known to be on JAM. This is a best-effort list and may not reflect the true state. Nodes could e.g. reasonably hide services which are not recently active from this list.

Source

fn fetch_work_package_segments<'life0, 'async_trait>( &'life0 self, wp_hash: WorkPackageHash, indices: Vec<u16>, ) -> Pin<Box<dyn Future<Output = RpcResult<Vec<Segment>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetches a list of exported segments from the DA layer for the given work package hash.

Source

fn fetch_segments<'life0, 'async_trait>( &'life0 self, segment_root: SegmentTreeRoot, indices: Vec<u16>, ) -> Pin<Box<dyn Future<Output = RpcResult<Vec<Segment>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetches a list of exported segments from the DA layer for the given segment root hash.

Source

fn sync_state(&self) -> RpcResult<SyncState>

Returns the sync status of the node.

Source

fn subscribe_best_block<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to updates of the head of the “best” chain, as returned by bestBlock.

Source

fn subscribe_finalized_block<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to updates of the latest finalized block, as returned by finalizedBlock.

Source

fn subscribe_statistics<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, finalized: bool, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to updates of the activity statistics stored in chain state.

If finalized is true, the subscription will track the latest finalized block. If finalized is false, the subscription will track the head of the “best” chain. Note that in the latter case the reported statistics may never be included in the finalized chain.

The statistics are encoded as per the GP.

Source

fn subscribe_service_data<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, id: ServiceId, finalized: bool, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to updates of the storage data for the service of the given service ID.

If finalized is true, the subscription will track the latest finalized block. If finalized is false, the subscription will track the head of the “best” chain. Note that in the latter case the reported service data may never be included in the finalized chain.

The value field of subscription messages will contain service data encoded as per the GP. It will be None when there is no data associated with the given ID.

Source

fn subscribe_service_value<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, id: ServiceId, key: Vec<u8>, finalized: bool, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to updates of the value associated with the given service ID and key.

If finalized is true, the subscription will track the latest finalized block. If finalized is false, the subscription will track the head of the “best” chain. Note that in the latter case reported value changes may never be included in the finalized chain.

The value field of subscription messages will be None when there is no value associated with the given service ID and key.

Source

fn subscribe_service_preimage<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, id: ServiceId, hash: Hash, finalized: bool, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to updates of the preimage associated with the given service ID and hash.

If finalized is true, the subscription will track the latest finalized block. If finalized is false, the subscription will track the head of the “best” chain. Note that in the latter case reported preimage changes may never be included in the finalized chain.

The value field of subscription messages will be None when there is no preimage associated with the given service ID and hash.

Source

fn subscribe_service_request<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, id: ServiceId, hash: Hash, len: u32, finalized: bool, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to updates of the preimage request associated with the given service ID and hash/len.

If finalized is true, the subscription will track the latest finalized block. If finalized is false, the subscription will track the head of the “best” chain. Note that in the latter case reported preimage request changes may never be included in the finalized chain.

The value field of subscription messages will be None when there is no preimage request associated with the given service ID, hash and length.

Source

fn subscribe_sync_status<'life0, 'async_trait>( &'life0 self, subscription_sink: PendingSubscriptionSink, ) -> Pin<Box<dyn Future<Output = SubscriptionResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to changes in sync status.

Provided Methods§

Source

fn into_rpc(self) -> RpcModule<Self>

Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule.

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.

Implementors§