Trait BodiesClient

pub trait BodiesClient: DownloadClient {
    type Body: BlockBody;
    type Output: Future<Output = Result<WithPeerId<Vec<Self::Body>>, RequestError>> + Sync + Send + Unpin;

    // Required method
    fn get_block_bodies_with_priority_and_range_hint(
        &self,
        hashes: Vec<FixedBytes<32>>,
        priority: Priority,
        range_hint: Option<RangeInclusive<u64>>,
    ) -> Self::Output;

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

A client capable of downloading block bodies.

Required Associated Types§

type Body: BlockBody

The body type this client fetches.

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

The output of the request future for querying block bodies.

Required Methods§

fn get_block_bodies_with_priority_and_range_hint( &self, hashes: Vec<FixedBytes<32>>, priority: Priority, range_hint: Option<RangeInclusive<u64>>, ) -> Self::Output

Fetches the block body for the requested block with priority and a range hint for the requested blocks.

The range hint is not required, but can be used to optimize the routing of the request if the hashes are continuous or close together and the range hint is [earliest, latest] for the requested blocks.

Provided Methods§

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

Fetches the block body for the requested block.

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

Fetches the block body for the requested block with priority

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

Fetches a single block body for the requested hash.

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

Fetches a single block body for the requested hash with priority

Implementations on Foreign Types§

Source§

impl BodiesClient for TestBodiesClient

Source§

type Body = BlockBody<EthereumTxEnvelope<TxEip4844>>

Source§

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

Source§

fn get_block_bodies_with_priority_and_range_hint( &self, hashes: Vec<FixedBytes<32>>, _priority: Priority, _range_hint: Option<RangeInclusive<u64>>, ) -> <TestBodiesClient as BodiesClient>::Output

§

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

Source§

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

Source§

type Body = <B as Block>::Body

Source§

type Output = Pin<Box<dyn Future<Output = Result<WithPeerId<Vec<<B as Block>::Body>>, RequestError>> + Send + Sync>>

Source§

fn get_block_bodies_with_priority_and_range_hint( &self, hashes: Vec<FixedBytes<32>>, _priority: Priority, _range_hint: Option<RangeInclusive<u64>>, ) -> <FileClient<B> as BodiesClient>::Output

§

impl<T> BodiesClient for Box<T>

§

type Body = <T as BodiesClient>::Body

§

type Output = <T as BodiesClient>::Output

§

fn get_block_bodies( &self, hashes: Vec<FixedBytes<32>>, ) -> <Box<T> as BodiesClient>::Output

§

fn get_block_bodies_with_priority( &self, hashes: Vec<FixedBytes<32>>, priority: Priority, ) -> <Box<T> as BodiesClient>::Output

§

fn get_block_bodies_with_priority_and_range_hint( &self, hashes: Vec<FixedBytes<32>>, priority: Priority, range_hint: Option<RangeInclusive<u64>>, ) -> <Box<T> as BodiesClient>::Output

§

fn get_block_body( &self, hash: FixedBytes<32>, ) -> SingleBodyRequest<<Box<T> as BodiesClient>::Output>

§

fn get_block_body_with_priority( &self, hash: FixedBytes<32>, priority: Priority, ) -> SingleBodyRequest<<Box<T> as BodiesClient>::Output>

§

impl<T> BodiesClient for Arc<T>

§

type Body = <T as BodiesClient>::Body

§

type Output = <T as BodiesClient>::Output

§

fn get_block_bodies( &self, hashes: Vec<FixedBytes<32>>, ) -> <Arc<T> as BodiesClient>::Output

§

fn get_block_bodies_with_priority( &self, hashes: Vec<FixedBytes<32>>, priority: Priority, ) -> <Arc<T> as BodiesClient>::Output

§

fn get_block_bodies_with_priority_and_range_hint( &self, hashes: Vec<FixedBytes<32>>, priority: Priority, range_hint: Option<RangeInclusive<u64>>, ) -> <Arc<T> as BodiesClient>::Output

§

fn get_block_body( &self, hash: FixedBytes<32>, ) -> SingleBodyRequest<<Arc<T> as BodiesClient>::Output>

§

fn get_block_body_with_priority( &self, hash: FixedBytes<32>, priority: Priority, ) -> SingleBodyRequest<<Arc<T> as BodiesClient>::Output>

Implementors§

§

impl BodiesClient for TestFullBlockClient

Implements the BodiesClient trait for the TestFullBlockClient struct.

§

type Body = BlockBody<EthereumTxEnvelope<TxEip4844>>

§

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

§

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

§

impl<F> BodiesClient for reth::network::p2p::test_utils::TestBodiesClient<F>
where F: Fn(Vec<FixedBytes<32>>) -> Result<WithPeerId<Vec<BlockBody<EthereumTxEnvelope<TxEip4844>>>>, RequestError> + Send + Sync,

§

type Body = BlockBody<EthereumTxEnvelope<TxEip4844>>

§

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

Source§

impl<N> BodiesClient for FetchClient<N>

§

impl<Net> BodiesClient for NoopFullBlockClient<Net>
where Net: NetworkPrimitives,

Implements the BodiesClient trait for the NoopFullBlockClient struct.

§

type Body = <Net as NetworkPrimitives>::BlockBody

§

type Output = Ready<Result<WithPeerId<Vec<<NoopFullBlockClient<Net> as BodiesClient>::Body>>, RequestError>>