BodiesClient

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_and_range_hint(
        &self,
        hashes: Vec<B256>,
        priority: Priority,
        range_hint: Option<RangeInclusive<u64>>,
    ) -> Self::Output;

    // Provided methods
    fn get_block_bodies(&self, hashes: Vec<B256>) -> Self::Output { ... }
    fn get_block_bodies_with_priority(
        &self,
        hashes: Vec<B256>,
        priority: Priority,
    ) -> 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_and_range_hint( &self, hashes: Vec<B256>, 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§

Source

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

Fetches the block body for the requested block.

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

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_bodies_with_priority_and_range_hint( &self, hashes: Vec<B256>, priority: Priority, range_hint: Option<RangeInclusive<u64>>, ) -> 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_bodies_with_priority_and_range_hint( &self, hashes: Vec<B256>, priority: Priority, range_hint: Option<RangeInclusive<u64>>, ) -> 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_bodies_with_priority_and_range_hint( &self, hashes: Vec<B256>, priority: Priority, range_hint: Option<RangeInclusive<u64>>, ) -> 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 TestFullBlockClient

Available on crate features test-utils only.

Implements the BodiesClient trait for the TestFullBlockClient struct.

Source§

type Body = BlockBody<EthereumTxEnvelope<TxEip4844>>

Source§

type Output = Ready<Result<WithPeerId<Vec<BlockBody<EthereumTxEnvelope<TxEip4844>>>>, 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 features test-utils only.
Source§

type Body = BlockBody<EthereumTxEnvelope<TxEip4844>>

Source§

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

Source§

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

Implements the BodiesClient trait for the NoopFullBlockClient struct.

Source§

type Body = <Net as NetworkPrimitives>::BlockBody

Source§

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