storage_interface/
mock.rs1use crate::{DBReaderForPoW, DbReader, StartupInfo, TreeState};
11use anyhow::Result;
12use diem_crypto::HashValue;
13use diem_types::{
14 account_address::AccountAddress,
15 account_state_blob::{AccountStateBlob, AccountStateWithProof},
16 committed_block::CommittedBlock,
17 contract_event::ContractEvent,
18 epoch_change::EpochChangeProof,
19 ledger_info::LedgerInfoWithSignatures,
20 proof::{AccumulatorConsistencyProof, SparseMerkleProof},
21 reward_distribution_event::RewardDistributionEventV2,
22 transaction::{TransactionListWithProof, TransactionWithProof, Version},
23};
24
25pub struct MockDbReader;
27
28impl DbReader for MockDbReader {
29 fn get_epoch_ending_ledger_infos(
30 &self, _start_epoch: u64, _end_epoch: u64,
31 ) -> Result<EpochChangeProof> {
32 unimplemented!()
33 }
34
35 fn get_transactions(
36 &self, _start_version: Version, _batch_size: u64,
37 _ledger_version: Version, _fetch_events: bool,
38 ) -> Result<TransactionListWithProof> {
39 unimplemented!()
40 }
41
42 fn get_block_timestamp(&self, _version: u64) -> Result<u64> {
43 unimplemented!()
44 }
45
46 fn get_latest_account_state(
47 &self, _address: AccountAddress,
48 ) -> Result<Option<AccountStateBlob>> {
49 unimplemented!()
50 }
51
52 fn get_latest_ledger_info(&self) -> Result<LedgerInfoWithSignatures> {
54 unimplemented!()
55 }
56
57 fn get_startup_info(
58 &self, _need_pos_state: bool,
59 ) -> Result<Option<StartupInfo>> {
60 unimplemented!()
61 }
62
63 fn get_txn_by_account(
64 &self, _address: AccountAddress, _seq_num: u64,
65 _ledger_version: Version, _fetch_events: bool,
66 ) -> Result<Option<TransactionWithProof>> {
67 unimplemented!()
68 }
69
70 fn get_state_proof_with_ledger_info(
71 &self, _known_version: u64, _ledger_info: LedgerInfoWithSignatures,
72 ) -> Result<(EpochChangeProof, AccumulatorConsistencyProof)> {
73 unimplemented!()
74 }
75
76 fn get_state_proof(
77 &self, _known_version: u64,
78 ) -> Result<(
79 LedgerInfoWithSignatures,
80 EpochChangeProof,
81 AccumulatorConsistencyProof,
82 )> {
83 unimplemented!()
84 }
85
86 fn get_account_state_with_proof(
87 &self, _address: AccountAddress, _version: Version,
88 _ledger_version: Version,
89 ) -> Result<AccountStateWithProof> {
90 unimplemented!()
91 }
92
93 fn get_account_state_with_proof_by_version(
94 &self, _address: AccountAddress, _version: Version,
95 ) -> Result<(
96 Option<AccountStateBlob>,
97 SparseMerkleProof<AccountStateBlob>,
98 )> {
99 unimplemented!()
100 }
101
102 fn get_latest_state_root(&self) -> Result<(Version, HashValue)> {
103 unimplemented!()
104 }
105
106 fn get_latest_tree_state(&self) -> Result<TreeState> { unimplemented!() }
107
108 fn get_epoch_ending_ledger_info(
109 &self, _known_version: u64,
110 ) -> Result<LedgerInfoWithSignatures> {
111 unimplemented!()
112 }
113}
114
115impl DBReaderForPoW for MockDbReader {
116 fn get_latest_ledger_info_option(
117 &self,
118 ) -> Option<LedgerInfoWithSignatures> {
119 todo!()
120 }
121
122 fn get_block_ledger_info(
123 &self, _consensus_block_id: &HashValue,
124 ) -> anyhow::Result<LedgerInfoWithSignatures> {
125 todo!()
126 }
127
128 fn get_events_by_version(
129 &self, _start_version: u64, _end_version: u64,
130 ) -> anyhow::Result<Vec<ContractEvent>> {
131 todo!()
132 }
133
134 fn get_epoch_ending_blocks(
135 &self, _start_epoch: u64, _end_epoch: u64,
136 ) -> anyhow::Result<Vec<HashValue>> {
137 todo!()
138 }
139
140 fn get_reward_event(
141 &self, _epoch: u64,
142 ) -> anyhow::Result<RewardDistributionEventV2> {
143 todo!()
144 }
145
146 fn get_committed_block_by_hash(
147 &self, _block_hash: &HashValue,
148 ) -> anyhow::Result<CommittedBlock> {
149 todo!()
150 }
151
152 fn get_committed_block_hash_by_view(
153 &self, _view: u64,
154 ) -> Result<HashValue> {
155 todo!()
156 }
157
158 fn get_ledger_info_by_voted_block(
159 &self, _block_id: &HashValue,
160 ) -> Result<LedgerInfoWithSignatures> {
161 todo!()
162 }
163
164 fn get_block_hash_by_epoch_and_round(
165 &self, _epoch: u64, _round: u64,
166 ) -> Result<HashValue> {
167 todo!()
168 }
169}