reth_network_p2p/snap/
client.rs1use crate::{download::DownloadClient, error::PeerRequestResult, priority::Priority};
2use futures::Future;
3use reth_eth_wire_types::snap::{
4 AccountRangeMessage, GetAccountRangeMessage, GetByteCodesMessage, GetStorageRangesMessage,
5 GetTrieNodesMessage,
6};
7
8#[auto_impl::auto_impl(&, Arc, Box)]
10pub trait SnapClient: DownloadClient {
11 type Output: Future<Output = PeerRequestResult<AccountRangeMessage>> + Send + Sync + Unpin;
13
14 fn get_account_range(&self, request: GetAccountRangeMessage) -> Self::Output {
17 self.get_account_range_with_priority(request, Priority::Normal)
18 }
19
20 fn get_account_range_with_priority(
23 &self,
24 request: GetAccountRangeMessage,
25 priority: Priority,
26 ) -> Self::Output;
27
28 fn get_storage_ranges(&self, request: GetStorageRangesMessage) -> Self::Output;
31
32 fn get_storage_ranges_with_priority(
35 &self,
36 request: GetStorageRangesMessage,
37 priority: Priority,
38 ) -> Self::Output;
39
40 fn get_byte_codes(&self, request: GetByteCodesMessage) -> Self::Output;
43
44 fn get_byte_codes_with_priority(
47 &self,
48 request: GetByteCodesMessage,
49 priority: Priority,
50 ) -> Self::Output;
51
52 fn get_trie_nodes(&self, request: GetTrieNodesMessage) -> Self::Output;
55
56 fn get_trie_nodes_with_priority(
59 &self,
60 request: GetTrieNodesMessage,
61 priority: Priority,
62 ) -> Self::Output;
63}