pub trait HeaderClient: ClientT {
// Provided methods
fn header_get_by_hash<'a, 'fut>(
&'a self,
hash: Hash,
) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
where Self: Sized + Sync + 'fut,
'a: 'fut { ... }
fn header_get_by_height<'a, 'fut>(
&'a self,
height: u64,
) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
where Self: Sized + Sync + 'fut,
'a: 'fut { ... }
fn header_get_range_by_height<'a, 'b, 'fut>(
&'a self,
from: ExtendedHeader,
to: u64,
) -> impl Future<Output = Result<Vec<ExtendedHeader>, Error>> + Send + 'fut
where Self: Sized + Sync + 'fut,
'a: 'fut,
'b: 'fut { ... }
fn header_local_head<'a, 'fut>(
&'a self,
) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
where Self: Sized + Sync + 'fut,
'a: 'fut { ... }
fn header_network_head<'a, 'fut>(
&'a self,
) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
where Self: Sized + Sync + 'fut,
'a: 'fut { ... }
fn header_subscribe<'a>(
&'a self,
) -> Pin<Box<dyn Stream<Item = Result<ExtendedHeader, Error>> + Send + 'a>>
where Self: SubscriptionClientT + Sized + Sync { ... }
fn header_sync_state<'a, 'fut>(
&'a self,
) -> impl Future<Output = Result<SyncState, Error>> + Send + 'fut
where Self: Sized + Sync + 'fut,
'a: 'fut { ... }
fn header_sync_wait<'a, 'fut>(
&'a self,
) -> impl Future<Output = Result<(), Error>> + Send + 'fut
where Self: Sized + Sync + 'fut,
'a: 'fut { ... }
fn header_wait_for_height<'a, 'fut>(
&'a self,
height: u64,
) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
where Self: Sized + Sync + 'fut,
'a: 'fut { ... }
}Expand description
Client implementation for the Header RPC API.
Provided Methods§
Sourcefn header_get_by_hash<'a, 'fut>(
&'a self,
hash: Hash,
) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
fn header_get_by_hash<'a, 'fut>( &'a self, hash: Hash, ) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
GetByHash returns the header of the given hash from the node’s header store.
Sourcefn header_get_by_height<'a, 'fut>(
&'a self,
height: u64,
) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
fn header_get_by_height<'a, 'fut>( &'a self, height: u64, ) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
GetByHeight returns the ExtendedHeader at the given height if it is currently available.
Sourcefn header_get_range_by_height<'a, 'b, 'fut>(
&'a self,
from: ExtendedHeader,
to: u64,
) -> impl Future<Output = Result<Vec<ExtendedHeader>, Error>> + Send + 'fut
fn header_get_range_by_height<'a, 'b, 'fut>( &'a self, from: ExtendedHeader, to: u64, ) -> impl Future<Output = Result<Vec<ExtendedHeader>, Error>> + Send + 'fut
GetRangeByHeight returns the given range (from:to) of ExtendedHeaders from the node’s header store and verifies that the returned headers are adjacent to each other.
Sourcefn header_local_head<'a, 'fut>(
&'a self,
) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
fn header_local_head<'a, 'fut>( &'a self, ) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
LocalHead returns the ExtendedHeader of the chain head.
Sourcefn header_network_head<'a, 'fut>(
&'a self,
) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
fn header_network_head<'a, 'fut>( &'a self, ) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
NetworkHead provides the Syncer’s view of the current network head.
Sourcefn header_subscribe<'a>(
&'a self,
) -> Pin<Box<dyn Stream<Item = Result<ExtendedHeader, Error>> + Send + 'a>>
fn header_subscribe<'a>( &'a self, ) -> Pin<Box<dyn Stream<Item = Result<ExtendedHeader, Error>> + Send + 'a>>
Subscribe to recent ExtendedHeaders from the network.
§Notes
If client returns Error::HttpNotImplemented, the subscription will fallback to
using HeaderClient::header_wait_for_height for streaming the headers.
Sourcefn header_sync_state<'a, 'fut>(
&'a self,
) -> impl Future<Output = Result<SyncState, Error>> + Send + 'fut
fn header_sync_state<'a, 'fut>( &'a self, ) -> impl Future<Output = Result<SyncState, Error>> + Send + 'fut
SyncState returns the current state of the header Syncer.
Sourcefn header_sync_wait<'a, 'fut>(
&'a self,
) -> impl Future<Output = Result<(), Error>> + Send + 'fut
fn header_sync_wait<'a, 'fut>( &'a self, ) -> impl Future<Output = Result<(), Error>> + Send + 'fut
SyncWait blocks until the header Syncer is synced to network head.
Sourcefn header_wait_for_height<'a, 'fut>(
&'a self,
height: u64,
) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
fn header_wait_for_height<'a, 'fut>( &'a self, height: u64, ) -> impl Future<Output = Result<ExtendedHeader, Error>> + Send + 'fut
WaitForHeight blocks until the header at the given height has been processed by the store or context deadline is exceeded.
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.