pub trait DbReader: Send + Sync {
Show 38 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_transaction_by_hash(
        &self,
        hash: HashValue,
        ledger_version: Version,
        fetch_events: bool
    ) -> Result<Option<TransactionWithProof>> { ... } fn get_transaction_by_version(
        &self,
        version: Version,
        ledger_version: Version,
        fetch_events: bool
    ) -> Result<TransactionWithProof> { ... } fn get_first_txn_version(&self) -> Result<Option<Version>> { ... } fn get_first_write_set_version(&self) -> Result<Option<Version>> { ... } fn get_transaction_outputs(
        &self,
        start_version: Version,
        limit: u64,
        ledger_version: Version
    ) -> Result<TransactionOutputListWithProof> { ... } fn get_write_sets(
        &self,
        start_version: Version,
        end_version: Version
    ) -> Result<Vec<WriteSet>> { ... } fn get_events(
        &self,
        event_key: &EventKey,
        start: u64,
        order: Order,
        limit: u64
    ) -> Result<Vec<(u64, ContractEvent)>> { ... } fn get_events_with_proofs(
        &self,
        event_key: &EventKey,
        start: u64,
        order: Order,
        limit: u64,
        known_version: Option<u64>
    ) -> Result<Vec<EventWithProof>> { ... } fn get_block_timestamp(&self, version: u64) -> Result<u64> { ... } fn get_event_by_version_with_proof(
        &self,
        event_key: &EventKey,
        event_version: u64,
        proof_version: u64
    ) -> Result<EventByVersionWithProof> { ... } fn get_last_version_before_timestamp(
        &self,
        _timestamp: u64,
        _ledger_version: Version
    ) -> Result<Version> { ... } fn get_latest_state_value(
        &self,
        state_key: StateKey
    ) -> Result<Option<StateValue>> { ... } fn get_state_values_by_key_prefix(
        &self,
        key_prefix: &StateKeyPrefix,
        version: Version
    ) -> Result<HashMap<StateKey, StateValue>> { ... } fn get_latest_ledger_info_option(
        &self
    ) -> Result<Option<LedgerInfoWithSignatures>> { ... } fn get_latest_ledger_info(&self) -> Result<LedgerInfoWithSignatures> { ... } fn get_latest_version_option(&self) -> Result<Option<Version>> { ... } fn get_latest_version(&self) -> Result<Version> { ... } fn get_latest_state_checkpoint_version(&self) -> Result<Option<Version>> { ... } fn get_latest_commit_metadata(&self) -> Result<(Version, u64)> { ... } fn get_startup_info(&self) -> Result<Option<StartupInfo>> { ... } fn get_account_transaction(
        &self,
        address: AccountAddress,
        seq_num: u64,
        include_events: bool,
        ledger_version: Version
    ) -> Result<Option<TransactionWithProof>> { ... } fn get_account_transactions(
        &self,
        address: AccountAddress,
        seq_num: u64,
        limit: u64,
        include_events: bool,
        ledger_version: Version
    ) -> Result<AccountTransactionsWithProof> { ... } fn get_state_proof_with_ledger_info(
        &self,
        known_version: u64,
        ledger_info: LedgerInfoWithSignatures
    ) -> Result<StateProof> { ... } fn get_state_proof(&self, known_version: u64) -> Result<StateProof> { ... } fn get_state_value_with_proof(
        &self,
        state_key: StateKey,
        version: Version,
        ledger_version: Version
    ) -> Result<StateValueWithProof> { ... } fn get_state_value_with_proof_by_version(
        &self,
        state_key: &StateKey,
        version: Version
    ) -> Result<(Option<StateValue>, SparseMerkleProof)> { ... } fn get_latest_tree_state(&self) -> Result<TreeState> { ... } fn get_epoch_ending_ledger_info(
        &self,
        known_version: u64
    ) -> Result<LedgerInfoWithSignatures> { ... } fn get_latest_transaction_info_option(
        &self
    ) -> Result<Option<(Version, TransactionInfo)>> { ... } fn get_accumulator_root_hash(&self, _version: Version) -> Result<HashValue> { ... } fn get_accumulator_consistency_proof(
        &self,
        _client_known_version: Option<Version>,
        _ledger_version: Version
    ) -> Result<AccumulatorConsistencyProof> { ... } fn get_accumulator_summary(
        &self,
        ledger_version: Version
    ) -> Result<TransactionAccumulatorSummary> { ... } fn get_state_leaf_count(&self, version: Version) -> Result<usize> { ... } fn get_state_value_chunk_with_proof(
        &self,
        version: Version,
        start_idx: usize,
        chunk_size: usize
    ) -> Result<StateValueChunkWithProof> { ... } fn get_state_prune_window(&self) -> Result<Option<usize>> { ... } fn get_ledger_prune_window(&self) -> Result<Option<usize>> { ... }
}
Expand description

Trait that is implemented by a DB that supports certain public (to client) read APIs expected of an Aptos DB

Provided Methods

Returns events by given event key

Returns events by given event key

Returns the aptos_types::account_config::events::new_block::NewBlockEvent for the block containing the requested version and proof that the block actually contains the 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).

Returns the key, value pairs for a particular state key prefix at at desired version. This API can be used to get all resources of an account by passing the account address as the key prefix.

Returns the latest ledger info, if any.

Returns the latest ledger info.

Returns the latest version, None for non-bootstrapped DB.

Returns the latest version, error on on non-bootstrapped DB.

Returns the latest state checkpoint version if any.

Returns the latest version and committed block timestamp

Gets information needed from storage during the main node startup. See AptosDB::get_startup_info.

Returns a transaction that is the seq_num-th one associated with the given account. If the transaction with given seq_num doesn’t exist, returns None.

Returns the list of transactions sent by an account with address starting at sequence number seq_num. Will return no more than limit transactions. Will ignore transactions with txn.version > ledger_version. Optionally fetch events for each transaction when fetch_events is true.

Returns proof of new state for a given ledger info with signatures relative to version known to client

Returns proof of new state relative to version known to client

Returns the account state corresponding to the given version and account address with proof based on ledger_version

Gets an account state by account address, out of the ledger state indicated by the state Merkle tree root with a sparse merkle proof proving state tree root. See AptosDB::get_account_state_with_proof_by_version.

This is used by aptos core (executor) internally.

Gets the latest TreeState no matter if db has been bootstrapped. Used by the Db-bootstrapper.

Get the ledger info of the epoch that known_version belongs to.

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.

Gets the transaction accumulator root hash at specified version. Caller must guarantee the version is not greater than the latest version.

Gets an AccumulatorConsistencyProof starting from client_known_version (or pre-genesis if None) until ledger_version.

In other words, if the client has an accumulator summary for client_known_version, they can use the result from this API to efficiently extend their accumulator to ledger_version and prove that the new accumulator is consistent with their old accumulator. By consistent, we mean that by appending the actual ledger_version - client_known_version transactions to the old accumulator summary you get the new accumulator summary.

If the client is starting up for the first time and has no accumulator summary yet, they can call this with client_known_version=None, i.e., pre-genesis, to get the complete accumulator summary up to ledger_version.

A convenience function for building a TransactionAccumulatorSummary at the given ledger_version.

Note: this is roughly equivalent to calling DbReader::get_accumulator_consistency_proof(None, ledger_version).

Returns total number of leaves in state store at given version.

Get a chunk of state store value, addressed by the index.

Get the state prune window config value.

Get the ledger prune window config value.

Trait Implementations

Returns a Move resources as a serialized byte array.

Returns a Move resources as serialized byte array from a specified version of the database. Read more

Returns an on-chain resource as a serialized byte array from a specified version of the database. Read more

Get the version on the latest transaction info.

Get the version of the latest state checkpoint

Implementors