Skip to main content

HeadersClient

Trait HeadersClient 

Source
pub trait HeadersClient: DownloadClient {
    type Header: BlockHeader;
    type Output: Future<Output = Result<WithPeerId<Vec<Self::Header>>, RequestError>> + Sync + Send + Unpin;

    // Required method
    fn get_headers_with_priority(
        &self,
        request: HeadersRequest,
        priority: Priority,
    ) -> Self::Output;

    // Provided methods
    fn get_headers(&self, request: HeadersRequest) -> Self::Output { ... }
    fn get_header(
        &self,
        start: HashOrNumber,
    ) -> SingleHeaderRequest<Self::Output>  { ... }
    fn get_header_with_priority(
        &self,
        start: HashOrNumber,
        priority: Priority,
    ) -> SingleHeaderRequest<Self::Output>  { ... }
}
Available on crate feature network only.
Expand description

The block headers downloader client

Required Associated Types§

Source

type Header: BlockHeader

The header type this client fetches.

Source

type Output: Future<Output = Result<WithPeerId<Vec<Self::Header>>, RequestError>> + Sync + Send + Unpin

The headers future type

Required Methods§

Source

fn get_headers_with_priority( &self, request: HeadersRequest, priority: Priority, ) -> Self::Output

Sends the header request to the p2p network with priority set and returns the header response received from a peer.

Provided Methods§

Source

fn get_headers(&self, request: HeadersRequest) -> Self::Output

Sends the header request to the p2p network and returns the header response received from a peer.

Source

fn get_header(&self, start: HashOrNumber) -> SingleHeaderRequest<Self::Output>

Fetches a single header for the requested number or hash.

Source

fn get_header_with_priority( &self, start: HashOrNumber, priority: Priority, ) -> SingleHeaderRequest<Self::Output>

Fetches a single header for the requested number or hash with priority

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, T> HeadersClient for &'a T

Source§

impl<B> HeadersClient for FileClient<B>
where B: FullBlock,

Source§

impl<T> HeadersClient for Arc<T>

Source§

impl<T> HeadersClient for Box<T>

Implementors§