[][src]Trait storage_interface::DbReader

pub trait DbReader: Send + Sync {
    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_events(
        &self,
        event_key: &EventKey,
        start: u64,
        order: Order,
        limit: u64
    ) -> Result<Vec<(u64, ContractEvent)>>;
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) -> 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)>;
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>; 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> { ... } }

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

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_events(
    &self,
    event_key: &EventKey,
    start: u64,
    order: Order,
    limit: u64
) -> Result<Vec<(u64, ContractEvent)>>

Returns events by given event key

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>

Returns the latest ledger info.

fn get_startup_info(&self) -> Result<Option<StartupInfo>>

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

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)>

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<(LedgerInfoWithSignatures, EpochChangeProof, AccumulatorConsistencyProof)>

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>

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)>

fn get_latest_state_root(&self) -> Result<(Version, HashValue)>

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>

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

Loading content...

Provided methods

fn get_latest_version(&self) -> Result<Version>

Returns the latest ledger info.

fn get_latest_commit_metadata(&self) -> Result<(Version, u64)>

Returns the latest version and committed block timestamp

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>

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

Loading content...

Trait Implementations

impl<'_> MoveStorage for &'_ dyn DbReader[src]

Implementors

impl DbReader for MockDbReader[src]

fn get_events(
    &self,
    _event_key: &EventKey,
    _start: u64,
    _order: Order,
    _limit: u64
) -> Result<Vec<(u64, ContractEvent)>>
[src]

Returns events by given event key

fn get_latest_ledger_info(&self) -> Result<LedgerInfoWithSignatures>[src]

Returns the latest ledger info.

Loading content...