reth_network_api/downloaders.rs
1//! API related to syncing blocks.
2
3use std::fmt::Debug;
4
5use futures::Future;
6use reth_network_p2p::{BlockAccessListsClient, 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>
14 + BlockAccessListsClient
15 + Send
16 + Sync
17 + Clone
18 + 'static;
19
20 /// Returns a new [`BlockClient`], used for fetching blocks from peers.
21 ///
22 /// The client is the entrypoint for sending block requests to the network.
23 fn fetch_client(
24 &self,
25 ) -> impl Future<Output = Result<Self::Client, oneshot::error::RecvError>> + Send;
26}