pub struct MockDbReader;Expand description
This is a mock of the dbreader in tests.
Trait Implementations§
Source§impl DBReaderForPoW for MockDbReader
 
impl DBReaderForPoW for MockDbReader
fn get_latest_ledger_info_option(&self) -> Option<LedgerInfoWithSignatures>
Source§fn get_block_ledger_info(
    &self,
    _consensus_block_id: &HashValue,
) -> Result<LedgerInfoWithSignatures>
 
fn get_block_ledger_info( &self, _consensus_block_id: &HashValue, ) -> Result<LedgerInfoWithSignatures>
TODO(lpl): It’s possible to use round number?
fn get_events_by_version( &self, _start_version: u64, _end_version: u64, ) -> Result<Vec<ContractEvent>>
fn get_epoch_ending_blocks( &self, _start_epoch: u64, _end_epoch: u64, ) -> Result<Vec<HashValue>>
fn get_reward_event(&self, _epoch: u64) -> Result<RewardDistributionEventV2>
fn get_committed_block_by_hash( &self, _block_hash: &HashValue, ) -> Result<CommittedBlock>
fn get_committed_block_hash_by_view(&self, _view: u64) -> Result<HashValue>
fn get_ledger_info_by_voted_block( &self, _block_id: &HashValue, ) -> Result<LedgerInfoWithSignatures>
fn get_block_hash_by_epoch_and_round( &self, _epoch: u64, _round: u64, ) -> Result<HashValue>
Source§impl DbReader for MockDbReader
 
impl DbReader for MockDbReader
Source§fn get_latest_ledger_info(&self) -> Result<LedgerInfoWithSignatures>
 
fn get_latest_ledger_info(&self) -> Result<LedgerInfoWithSignatures>
Returns the latest ledger info.
Source§fn get_epoch_ending_ledger_infos(
    &self,
    _start_epoch: u64,
    _end_epoch: u64,
) -> Result<EpochChangeProof>
 
fn get_epoch_ending_ledger_infos( &self, _start_epoch: u64, _end_epoch: u64, ) -> Result<EpochChangeProof>
Source§fn get_transactions(
    &self,
    _start_version: Version,
    _batch_size: u64,
    _ledger_version: Version,
    _fetch_events: bool,
) -> Result<TransactionListWithProof>
 
fn get_transactions( &self, _start_version: Version, _batch_size: u64, _ledger_version: Version, _fetch_events: bool, ) -> Result<TransactionListWithProof>
Source§fn get_latest_account_state(
    &self,
    _address: AccountAddress,
) -> Result<Option<AccountStateBlob>>
 
fn get_latest_account_state( &self, _address: AccountAddress, ) -> Result<Option<AccountStateBlob>>
Source§fn get_startup_info(&self, _need_pos_state: bool) -> Result<Option<StartupInfo>>
 
fn get_startup_info(&self, _need_pos_state: bool) -> Result<Option<StartupInfo>>
Gets information needed from storage during the main node startup.
See 
DiemDB::get_startup_info.fn get_txn_by_account( &self, _address: AccountAddress, _seq_num: u64, _ledger_version: Version, _fetch_events: bool, ) -> Result<Option<TransactionWithProof>>
Source§fn get_state_proof_with_ledger_info(
    &self,
    _known_version: u64,
    _ledger_info: LedgerInfoWithSignatures,
) -> Result<(EpochChangeProof, AccumulatorConsistencyProof)>
 
fn get_state_proof_with_ledger_info( &self, _known_version: u64, _ledger_info: LedgerInfoWithSignatures, ) -> Result<(EpochChangeProof, AccumulatorConsistencyProof)>
Returns proof of new state for a given ledger info with signatures
relative to version known to client
Source§fn get_state_proof(
    &self,
    _known_version: u64,
) -> Result<(LedgerInfoWithSignatures, EpochChangeProof, AccumulatorConsistencyProof)>
 
fn get_state_proof( &self, _known_version: u64, ) -> Result<(LedgerInfoWithSignatures, EpochChangeProof, AccumulatorConsistencyProof)>
Returns proof of new state relative to version known to client
Source§fn get_account_state_with_proof(
    &self,
    _address: AccountAddress,
    _version: Version,
    _ledger_version: Version,
) -> Result<AccountStateWithProof>
 
fn get_account_state_with_proof( &self, _address: AccountAddress, _version: Version, _ledger_version: Version, ) -> Result<AccountStateWithProof>
Returns the account state corresponding to the given version and account
address with proof based on 
ledger_versionfn get_account_state_with_proof_by_version( &self, _address: AccountAddress, _version: Version, ) -> Result<(Option<AccountStateBlob>, SparseMerkleProof<AccountStateBlob>)>
Source§fn get_latest_state_root(&self) -> Result<(Version, HashValue)>
 
fn get_latest_state_root(&self) -> Result<(Version, HashValue)>
Source§fn get_latest_tree_state(&self) -> Result<TreeState>
 
fn get_latest_tree_state(&self) -> Result<TreeState>
Gets the latest TreeState no matter if db has been bootstrapped.
Used by the Db-bootstrapper.
Source§fn get_epoch_ending_ledger_info(
    &self,
    _known_version: u64,
) -> Result<LedgerInfoWithSignatures>
 
fn get_epoch_ending_ledger_info( &self, _known_version: u64, ) -> Result<LedgerInfoWithSignatures>
Get the ledger info of the epoch that 
known_version belongs to.Source§fn get_last_version_before_timestamp(
    &self,
    _timestamp: u64,
    _ledger_version: Version,
) -> Result<Version>
 
fn get_last_version_before_timestamp( &self, _timestamp: u64, _ledger_version: Version, ) -> Result<Version>
Gets the version of the last transaction committed before timestamp,
a committed block at or after the required timestamp must exist
(otherwise it’s possible the next block committed as a timestamp
smaller than the one in the request).
Source§fn get_latest_version(&self) -> Result<Version>
 
fn get_latest_version(&self) -> Result<Version>
Returns the latest ledger info.
Source§fn get_latest_commit_metadata(&self) -> Result<(Version, u64)>
 
fn get_latest_commit_metadata(&self) -> Result<(Version, u64)>
Returns the latest version and committed block timestamp
Source§fn get_latest_transaction_info_option(
    &self,
) -> Result<Option<(Version, TransactionInfo)>>
 
fn get_latest_transaction_info_option( &self, ) -> Result<Option<(Version, TransactionInfo)>>
Gets the latest transaction info.
N.B. Unlike get_startup_info(), even if the db is not bootstrapped, this
can return 
Some – those from a db-restore run.Source§fn get_accumulator_root_hash(&self, _version: Version) -> Result<HashValue>
 
fn get_accumulator_root_hash(&self, _version: Version) -> Result<HashValue>
Gets the transaction accumulator root hash at specified version.
Caller must guarantee the version is not greater than the latest
version.
fn get_pos_state(&self, _block_id: &HashValue) -> Result<PosState>
fn get_latest_pos_state(&self) -> Arc<PosState>
Auto Trait Implementations§
impl Freeze for MockDbReader
impl RefUnwindSafe for MockDbReader
impl Send for MockDbReader
impl Sync for MockDbReader
impl Unpin for MockDbReader
impl UnwindSafe for MockDbReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Conv for T
 
impl<T> Conv for T
§impl<T> FmtForward for T
 
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
    Self: Binary,
 
fn fmt_binary(self) -> FmtBinary<Self>where
    Self: Binary,
Causes 
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
    Self: Display,
 
fn fmt_display(self) -> FmtDisplay<Self>where
    Self: Display,
Causes 
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
    Self: LowerExp,
 
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
    Self: LowerExp,
Causes 
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
    Self: LowerHex,
 
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
    Self: LowerHex,
Causes 
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
    Self: Octal,
 
fn fmt_octal(self) -> FmtOctal<Self>where
    Self: Octal,
Causes 
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
    Self: Pointer,
 
fn fmt_pointer(self) -> FmtPointer<Self>where
    Self: Pointer,
Causes 
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
    Self: UpperExp,
 
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
    Self: UpperExp,
Causes 
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
    Self: UpperHex,
 
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
    Self: UpperHex,
Causes 
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
    &'a Self: for<'a> IntoIterator,
 
fn fmt_list(self) -> FmtList<Self>where
    &'a Self: for<'a> IntoIterator,
Formats each item in a sequence. Read more
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pipe for Twhere
    T: ?Sized,
 
impl<T> Pipe for Twhere
    T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
    Self: Sized,
 
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
    Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
    R: 'a,
 
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
    R: 'a,
Borrows 
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
    R: 'a,
 
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
    R: 'a,
Mutably borrows 
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
 
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
    &'a mut self,
    func: impl FnOnce(&'a mut B) -> R,
) -> R
 
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
 
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows 
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
 
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows 
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
 
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows 
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
 
impl<T> Pointable for T
§impl<T> Tap for T
 
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
 
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the 
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
 
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the 
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
 
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the 
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
 
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the 
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
 
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the 
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
 
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the 
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
 
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls 
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
 
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls 
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
 
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls 
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
 
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls 
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
 
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls 
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
 
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls 
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
 
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls 
.tap_deref() only in debug builds, and is erased in release
builds.