Trait storage_interface::DbReader
source · pub trait DbReader: Send + Sync {
Show 21 methods
// Required methods
fn get_epoch_ending_ledger_infos(
&self,
start_epoch: u64,
end_epoch: u64
) -> Result<EpochChangeProof>;
fn get_transactions(
&self,
start_version: Version,
batch_size: u64,
ledger_version: Version,
fetch_events: bool
) -> Result<TransactionListWithProof>;
fn get_block_timestamp(&self, version: u64) -> Result<u64>;
fn get_latest_account_state(
&self,
address: AccountAddress
) -> Result<Option<AccountStateBlob>>;
fn get_latest_ledger_info(&self) -> Result<LedgerInfoWithSignatures>;
fn get_startup_info(
&self,
need_pos_state: bool
) -> Result<Option<StartupInfo>>;
fn get_txn_by_account(
&self,
address: AccountAddress,
seq_num: u64,
ledger_version: Version,
fetch_events: bool
) -> Result<Option<TransactionWithProof>>;
fn get_state_proof_with_ledger_info(
&self,
known_version: u64,
ledger_info: LedgerInfoWithSignatures
) -> Result<(EpochChangeProof, AccumulatorConsistencyProof)>;
fn get_state_proof(
&self,
known_version: u64
) -> Result<(LedgerInfoWithSignatures, EpochChangeProof, AccumulatorConsistencyProof)>;
fn get_account_state_with_proof(
&self,
address: AccountAddress,
version: Version,
ledger_version: Version
) -> Result<AccountStateWithProof>;
fn get_account_state_with_proof_by_version(
&self,
address: AccountAddress,
version: Version
) -> Result<(Option<AccountStateBlob>, SparseMerkleProof<AccountStateBlob>)>;
fn get_latest_state_root(&self) -> Result<(Version, HashValue)>;
fn get_latest_tree_state(&self) -> Result<TreeState>;
fn get_epoch_ending_ledger_info(
&self,
known_version: u64
) -> Result<LedgerInfoWithSignatures>;
// Provided methods
fn get_last_version_before_timestamp(
&self,
_timestamp: u64,
_ledger_version: Version
) -> Result<Version> { ... }
fn get_latest_version(&self) -> Result<Version> { ... }
fn get_latest_commit_metadata(&self) -> Result<(Version, u64)> { ... }
fn get_latest_transaction_info_option(
&self
) -> Result<Option<(Version, TransactionInfo)>> { ... }
fn get_accumulator_root_hash(&self, _version: Version) -> Result<HashValue> { ... }
fn get_pos_state(&self, _block_id: &HashValue) -> Result<PosState> { ... }
fn get_latest_pos_state(&self) -> Arc<PosState> { ... }
}
Expand description
Trait that is implemented by a DB that supports certain public (to client) read APIs expected of a Diem DB
Required Methods§
sourcefn 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>
sourcefn 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>
sourcefn get_block_timestamp(&self, version: u64) -> Result<u64>
fn get_block_timestamp(&self, version: u64) -> Result<u64>
sourcefn get_latest_account_state(
&self,
address: AccountAddress
) -> Result<Option<AccountStateBlob>>
fn get_latest_account_state( &self, address: AccountAddress ) -> Result<Option<AccountStateBlob>>
sourcefn get_latest_ledger_info(&self) -> Result<LedgerInfoWithSignatures>
fn get_latest_ledger_info(&self) -> Result<LedgerInfoWithSignatures>
Returns the latest ledger info.
sourcefn 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>>
sourcefn 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
sourcefn 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
sourcefn 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_version
fn get_account_state_with_proof_by_version( &self, address: AccountAddress, version: Version ) -> Result<(Option<AccountStateBlob>, SparseMerkleProof<AccountStateBlob>)>
sourcefn get_latest_state_root(&self) -> Result<(Version, HashValue)>
fn get_latest_state_root(&self) -> Result<(Version, HashValue)>
sourcefn 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.
sourcefn 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.
Provided Methods§
sourcefn 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 commited 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).
sourcefn get_latest_version(&self) -> Result<Version>
fn get_latest_version(&self) -> Result<Version>
Returns the latest ledger info.
sourcefn 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
sourcefn 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.
sourcefn 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>
Trait Implementations§
source§impl MoveStorage for &dyn DbReader
impl MoveStorage for &dyn DbReader
source§fn batch_fetch_resources(
&self,
access_paths: Vec<AccessPath>
) -> Result<Vec<Vec<u8>>>
fn batch_fetch_resources( &self, access_paths: Vec<AccessPath> ) -> Result<Vec<Vec<u8>>>
access_path
source§fn batch_fetch_resources_by_version(
&self,
access_paths: Vec<AccessPath>,
version: Version
) -> Result<Vec<Vec<u8>>>
fn batch_fetch_resources_by_version( &self, access_paths: Vec<AccessPath>, version: Version ) -> Result<Vec<Vec<u8>>>
access_path