reth_network_p2p::bodies::client

Trait BodiesClient

Source
pub trait BodiesClient: DownloadClient {
    type Body: BlockBody;
    type Output: Future<Output = PeerRequestResult<Vec<Self::Body>>> + 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 Body: BlockBody

The body type this client fetches.

Source

type Output: Future<Output = PeerRequestResult<Vec<Self::Body>>> + 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 Body = <T as BodiesClient>::Body

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 Body = <T as BodiesClient>::Body

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 Body = <T as BodiesClient>::Body

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 Body = BlockBody

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 Body = BlockBody

Source§

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

Source§

impl<A, B> BodiesClient for Either<A, B>
where A: BodiesClient, B: BodiesClient<Body = A::Body>,

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 Body = BlockBody

Source§

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