reth_network_p2p::bodies::client

Trait BodiesClient

source
pub trait BodiesClient: DownloadClient {
    type Output: Future<Output = PeerRequestResult<Vec<BlockBody>>> + Sync + Send + Unpin;

    // Required method
    fn get_block_bodies_with_priority(
        &self,
        hashes: Vec<B256>,
        priority: Priority,
    ) -> Self::Output;

    // Provided methods
    fn get_block_bodies(&self, hashes: Vec<B256>) -> Self::Output { ... }
    fn get_block_body(&self, hash: B256) -> SingleBodyRequest<Self::Output>  { ... }
    fn get_block_body_with_priority(
        &self,
        hash: B256,
        priority: Priority,
    ) -> SingleBodyRequest<Self::Output>  { ... }
}
Expand description

A client capable of downloading block bodies.

Required Associated Types§

source

type Output: Future<Output = PeerRequestResult<Vec<BlockBody>>> + Sync + Send + Unpin

The output of the request future for querying block bodies.

Required Methods§

source

fn get_block_bodies_with_priority( &self, hashes: Vec<B256>, priority: Priority, ) -> Self::Output

Fetches the block body for the requested block with priority

Provided Methods§

source

fn get_block_bodies(&self, hashes: Vec<B256>) -> Self::Output

Fetches the block body for the requested block.

source

fn get_block_body(&self, hash: B256) -> SingleBodyRequest<Self::Output>

Fetches a single block body for the requested hash.

source

fn get_block_body_with_priority( &self, hash: B256, priority: Priority, ) -> SingleBodyRequest<Self::Output>

Fetches a single block body for the requested hash with priority

Implementations on Foreign Types§

source§

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

source§

type Output = <T as BodiesClient>::Output

source§

fn get_block_bodies(&self, hashes: Vec<B256>) -> Self::Output

source§

fn get_block_bodies_with_priority( &self, hashes: Vec<B256>, priority: Priority, ) -> Self::Output

source§

fn get_block_body(&self, hash: B256) -> SingleBodyRequest<Self::Output>

source§

fn get_block_body_with_priority( &self, hash: B256, priority: Priority, ) -> SingleBodyRequest<Self::Output>

source§

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

source§

type Output = <T as BodiesClient>::Output

source§

fn get_block_bodies(&self, hashes: Vec<B256>) -> Self::Output

source§

fn get_block_bodies_with_priority( &self, hashes: Vec<B256>, priority: Priority, ) -> Self::Output

source§

fn get_block_body(&self, hash: B256) -> SingleBodyRequest<Self::Output>

source§

fn get_block_body_with_priority( &self, hash: B256, priority: Priority, ) -> SingleBodyRequest<Self::Output>

source§

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

source§

type Output = <T as BodiesClient>::Output

source§

fn get_block_bodies(&self, hashes: Vec<B256>) -> Self::Output

source§

fn get_block_bodies_with_priority( &self, hashes: Vec<B256>, priority: Priority, ) -> Self::Output

source§

fn get_block_body(&self, hash: B256) -> SingleBodyRequest<Self::Output>

source§

fn get_block_body_with_priority( &self, hash: B256, priority: Priority, ) -> SingleBodyRequest<Self::Output>

Implementors§

source§

impl BodiesClient for NoopFullBlockClient

Available on crate feature test-utils only.

Implements the BodiesClient trait for the NoopFullBlockClient struct.

source§

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

source§

impl BodiesClient for TestFullBlockClient

Available on crate feature test-utils only.

Implements the BodiesClient trait for the TestFullBlockClient struct.

source§

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

source§

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

source§

impl<F> BodiesClient for TestBodiesClient<F>
where F: Fn(Vec<B256>) -> PeerRequestResult<Vec<BlockBody>> + Send + Sync,

Available on crate feature test-utils only.
source§

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