Trait reth_network_p2p::headers::client::HeadersClient

source ·
pub trait HeadersClient: DownloadClient {
    type Output: Future<Output = PeerRequestResult<Vec<Header>>> + 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: BlockHashOrNumber,
    ) -> SingleHeaderRequest<Self::Output>  { ... }
    fn get_header_with_priority(
        &self,
        start: BlockHashOrNumber,
        priority: Priority,
    ) -> SingleHeaderRequest<Self::Output>  { ... }
}
Expand description

The block headers downloader client

Required Associated Types§

source

type Output: Future<Output = PeerRequestResult<Vec<Header>>> + 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: BlockHashOrNumber, ) -> SingleHeaderRequest<Self::Output>

Fetches a single header for the requested number or hash.

source

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

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

Implementations on Foreign Types§

source§

impl<'a, T: 'a + HeadersClient + ?Sized> HeadersClient for &'a T

§

type Output = <T as HeadersClient>::Output

source§

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

source§

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

source§

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

source§

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

source§

impl<T: HeadersClient + ?Sized> HeadersClient for Box<T>
where Box<T>: DownloadClient,

§

type Output = <T as HeadersClient>::Output

source§

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

source§

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

source§

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

source§

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

source§

impl<T: HeadersClient + ?Sized> HeadersClient for Arc<T>
where Arc<T>: DownloadClient,

§

type Output = <T as HeadersClient>::Output

source§

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

source§

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

source§

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

source§

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

Implementors§

source§

impl HeadersClient for NoopFullBlockClient

Available on crate feature test-utils only.
§

type Output = Ready<Result<WithPeerId<Vec<Header>>, RequestError>>

source§

impl HeadersClient for TestFullBlockClient

Available on crate feature test-utils only.

Implements the HeadersClient trait for the TestFullBlockClient struct.

§

type Output = Ready<Result<WithPeerId<Vec<Header>>, RequestError>>

source§

impl HeadersClient for TestHeadersClient

Available on crate feature test-utils only.
§

type Output = Pin<Box<dyn Future<Output = Result<WithPeerId<Vec<Header>>, RequestError>> + Send + Sync>>

source§

impl<A, B> HeadersClient for Either<A, B>