pub trait DbReader: Send + Sync {
// Required methods
fn get_epoch_ending_ledger_infos(
&self,
start_epoch: u64,
end_epoch: u64,
) -> Result<EpochChangeProof>;
fn get_block_timestamp(&self, version: u64) -> Result<u64>;
fn get_latest_ledger_info(&self) -> Result<LedgerInfoWithSignatures>;
fn get_startup_info(
&self,
need_pos_state: bool,
) -> Result<Option<StartupInfo>>;
fn get_latest_tree_state(&self) -> Result<TreeState>;
fn get_epoch_ending_ledger_info(
&self,
known_version: u64,
) -> Result<LedgerInfoWithSignatures>;
// Provided methods
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_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_block_timestamp(&self, version: u64) -> Result<u64>
fn get_block_timestamp(&self, version: u64) -> Result<u64>
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.
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_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.