pub trait HeadersClient: DownloadClient {
type Header: Send + Sync + Unpin;
type Output: Future<Output = PeerRequestResult<Vec<Self::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§
Required Methods§
Sourcefn get_headers_with_priority(
&self,
request: HeadersRequest,
priority: Priority,
) -> Self::Output
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§
Sourcefn get_headers(&self, request: HeadersRequest) -> Self::Output
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.
Sourcefn get_header(
&self,
start: BlockHashOrNumber,
) -> SingleHeaderRequest<Self::Output> ⓘ
fn get_header( &self, start: BlockHashOrNumber, ) -> SingleHeaderRequest<Self::Output> ⓘ
Fetches a single header for the requested number or hash.
Sourcefn get_header_with_priority(
&self,
start: BlockHashOrNumber,
priority: Priority,
) -> SingleHeaderRequest<Self::Output> ⓘ
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 Twhere
&'a T: DownloadClient,
impl<'a, T: 'a + HeadersClient + ?Sized> HeadersClient for &'a Twhere
&'a T: DownloadClient,
type Header = <T as HeadersClient>::Header
type Output = <T as HeadersClient>::Output
fn get_headers(&self, request: HeadersRequest) -> Self::Output
fn get_headers_with_priority( &self, request: HeadersRequest, priority: Priority, ) -> Self::Output
fn get_header( &self, start: BlockHashOrNumber, ) -> SingleHeaderRequest<Self::Output> ⓘ
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,
impl<T: HeadersClient + ?Sized> HeadersClient for Box<T>where
Box<T>: DownloadClient,
type Header = <T as HeadersClient>::Header
type Output = <T as HeadersClient>::Output
fn get_headers(&self, request: HeadersRequest) -> Self::Output
fn get_headers_with_priority( &self, request: HeadersRequest, priority: Priority, ) -> Self::Output
fn get_header( &self, start: BlockHashOrNumber, ) -> SingleHeaderRequest<Self::Output> ⓘ
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,
impl<T: HeadersClient + ?Sized> HeadersClient for Arc<T>where
Arc<T>: DownloadClient,
type Header = <T as HeadersClient>::Header
type Output = <T as HeadersClient>::Output
fn get_headers(&self, request: HeadersRequest) -> Self::Output
fn get_headers_with_priority( &self, request: HeadersRequest, priority: Priority, ) -> Self::Output
fn get_header( &self, start: BlockHashOrNumber, ) -> SingleHeaderRequest<Self::Output> ⓘ
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.
impl HeadersClient for NoopFullBlockClient
Available on crate feature
test-utils
only.Source§impl HeadersClient for TestFullBlockClient
Available on crate feature test-utils
only.
impl HeadersClient for TestFullBlockClient
Available on crate feature
test-utils
only.Implements the HeadersClient
trait for the TestFullBlockClient
struct.
Source§impl HeadersClient for TestHeadersClient
Available on crate feature test-utils
only.
impl HeadersClient for TestHeadersClient
Available on crate feature
test-utils
only.