reth_network_api/
downloaders.rs

1//! API related to syncing blocks.
2
3use std::fmt::Debug;
4
5use futures::Future;
6use reth_network_p2p::BlockClient;
7use tokio::sync::oneshot;
8
9/// Provides client for downloading blocks.
10#[auto_impl::auto_impl(&, Arc)]
11pub trait BlockDownloaderProvider {
12    /// The client this type can provide.
13    type Client: BlockClient<Header: Debug, Body: Debug> + Send + Sync + Clone + 'static;
14
15    /// Returns a new [`BlockClient`], used for fetching blocks from peers.
16    ///
17    /// The client is the entrypoint for sending block requests to the network.
18    fn fetch_client(
19        &self,
20    ) -> impl Future<Output = Result<Self::Client, oneshot::error::RecvError>> + Send;
21}