Trait storage_interface::DbReader [−][src]
pub trait DbReader: Send + Sync {
Show 32 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_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_account_state(
&self,
address: AccountAddress
) -> Result<Option<AccountStateBlob>> { ... }
fn get_latest_ledger_info(&self) -> Result<LedgerInfoWithSignatures> { ... }
fn get_latest_version(&self) -> Result<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_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_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_account_count(&self, version: Version) -> Result<usize> { ... }
fn get_account_chunk_with_proof(
&self,
version: Version,
start_idx: usize,
chunk_size: usize
) -> Result<AccountStatesChunkWithProof> { ... }
fn get_state_prune_window(&self) -> Option<usize> { ... }
}Expand description
Trait that is implemented by a DB that supports certain public (to client) read APIs expected of a Diem DB
Provided methods
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>
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>
fn get_transaction_by_hash(
&self,
hash: HashValue,
ledger_version: Version,
fetch_events: bool
) -> Result<Option<TransactionWithProof>>
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_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_txn_version(&self) -> Result<Option<Version>>
See [DiemDB::get_txn_set_version].
fn get_first_write_set_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_transaction_outputs(
&self,
start_version: Version,
limit: u64,
ledger_version: Version
) -> Result<TransactionOutputListWithProof>
Returns events by given event key
Returns events by given event key
fn get_block_timestamp(&self, version: u64) -> Result<u64>
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_event_by_version_with_proof(
&self,
event_key: &EventKey,
event_version: u64,
proof_version: u64
) -> Result<EventByVersionWithProof>
Returns the [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 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).
fn get_latest_account_state(
&self,
address: AccountAddress
) -> Result<Option<AccountStateBlob>>
fn get_latest_account_state(
&self,
address: AccountAddress
) -> Result<Option<AccountStateBlob>>
fn get_latest_ledger_info(&self) -> Result<LedgerInfoWithSignatures>
fn get_latest_ledger_info(&self) -> Result<LedgerInfoWithSignatures>
Returns the latest ledger info.
fn get_latest_version(&self) -> Result<Version>
fn get_latest_version(&self) -> Result<Version>
Returns the latest ledger info.
Returns the latest version and committed block timestamp
fn get_startup_info(&self) -> Result<Option<StartupInfo>>
fn get_startup_info(&self) -> Result<Option<StartupInfo>>
Gets information needed from storage during the main node startup.
See DiemDB::get_startup_info.
fn get_account_transaction(
&self,
address: AccountAddress,
seq_num: u64,
include_events: bool,
ledger_version: Version
) -> Result<Option<TransactionWithProof>>
fn get_account_transaction(
&self,
address: AccountAddress,
seq_num: u64,
include_events: bool,
ledger_version: Version
) -> Result<Option<TransactionWithProof>>
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.
fn get_account_transactions(
&self,
address: AccountAddress,
seq_num: u64,
limit: u64,
include_events: bool,
ledger_version: Version
) -> Result<AccountTransactionsWithProof>
fn get_account_transactions(
&self,
address: AccountAddress,
seq_num: u64,
limit: u64,
include_events: bool,
ledger_version: Version
) -> Result<AccountTransactionsWithProof>
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.
fn get_state_proof_with_ledger_info(
&self,
known_version: u64,
ledger_info: LedgerInfoWithSignatures
) -> Result<StateProof>
fn get_state_proof_with_ledger_info(
&self,
known_version: u64,
ledger_info: LedgerInfoWithSignatures
) -> Result<StateProof>
Returns proof of new state for a given ledger info with signatures relative to version known to client
fn get_state_proof(&self, known_version: u64) -> Result<StateProof>
fn get_state_proof(&self, known_version: u64) -> Result<StateProof>
Returns proof of new state relative to version known to client
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_version
fn get_account_state_with_proof_by_version(
&self,
address: AccountAddress,
version: Version
) -> Result<(Option<AccountStateBlob>, SparseMerkleProof<AccountStateBlob>)>
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.
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.
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.
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_accumulator_consistency_proof(
&self,
_client_known_version: Option<Version>,
_ledger_version: Version
) -> Result<AccumulatorConsistencyProof>
fn get_accumulator_consistency_proof(
&self,
_client_known_version: Option<Version>,
_ledger_version: Version
) -> Result<AccumulatorConsistencyProof>
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.
fn get_accumulator_summary(
&self,
ledger_version: Version
) -> Result<TransactionAccumulatorSummary>
fn get_accumulator_summary(
&self,
ledger_version: Version
) -> Result<TransactionAccumulatorSummary>
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).
fn get_account_count(&self, version: Version) -> Result<usize>
fn get_account_count(&self, version: Version) -> Result<usize>
Returns total number of accounts at given version.
fn get_account_chunk_with_proof(
&self,
version: Version,
start_idx: usize,
chunk_size: usize
) -> Result<AccountStatesChunkWithProof>
fn get_account_chunk_with_proof(
&self,
version: Version,
start_idx: usize,
chunk_size: usize
) -> Result<AccountStatesChunkWithProof>
Get a chunk of account data, addressed by the index of the account.
fn get_state_prune_window(&self) -> Option<usize>
fn get_state_prune_window(&self) -> Option<usize>
Get the state prune window config value.
Trait Implementations
Returns a Move resources as a serialized byte array.
fn fetch_resource_by_version(
&self,
access_path: AccessPath,
version: Version
) -> Result<Vec<u8>>
fn fetch_resource_by_version(
&self,
access_path: AccessPath,
version: Version
) -> Result<Vec<u8>>
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.