reth_network_p2p/snap/
client.rs

1use crate::{download::DownloadClient, error::PeerRequestResult, priority::Priority};
2use futures::Future;
3use reth_eth_wire_types::snap::{AccountRangeMessage, GetAccountRangeMessage};
4
5/// The snap sync downloader client
6#[auto_impl::auto_impl(&, Arc, Box)]
7pub trait SnapClient: DownloadClient {
8    /// The output future type for account range requests
9    type Output: Future<Output = PeerRequestResult<AccountRangeMessage>> + Send + Sync + Unpin;
10
11    /// Sends the account range request to the p2p network and returns the account range
12    /// response received from a peer.
13    fn get_account_range(&self, request: GetAccountRangeMessage) -> Self::Output {
14        self.get_account_range_with_priority(request, Priority::Normal)
15    }
16
17    /// Sends the account range request to the p2p network with priority set and returns
18    /// the account range response received from a peer.
19    fn get_account_range_with_priority(
20        &self,
21        request: GetAccountRangeMessage,
22        priority: Priority,
23    ) -> Self::Output;
24}