pub trait DbWriter: Send + Sync {
    fn get_state_snapshot_receiver(
        &self,
        version: Version,
        expected_root_hash: HashValue
    ) -> Result<Box<dyn StateSnapshotReceiver<StateKey, StateValue>>> { ... } fn finalize_state_snapshot(
        &self,
        version: Version,
        output_with_proof: TransactionOutputListWithProof
    ) -> Result<()> { ... } fn save_ledger_infos(
        &self,
        ledger_infos: &[LedgerInfoWithSignatures]
    ) -> Result<()> { ... } fn save_transactions_ext(
        &self,
        txns_to_commit: &[TransactionToCommit],
        first_version: Version,
        base_state_version: Option<Version>,
        ledger_info_with_sigs: Option<&LedgerInfoWithSignatures>,
        save_state_snapshots: bool,
        state_tree: SparseMerkleTree<StateValue>
    ) -> Result<()> { ... } fn save_transactions(
        &self,
        txns_to_commit: &[TransactionToCommit],
        first_version: Version,
        base_state_version: Option<Version>,
        ledger_info_with_sigs: Option<&LedgerInfoWithSignatures>,
        state_tree: SparseMerkleTree<StateValue>
    ) -> Result<()> { ... } fn save_state_snapshot(
        &self,
        jmt_updates: Vec<(HashValue, (HashValue, StateKey))>,
        node_hashes: Option<&HashMap<NibblePath, HashValue>>,
        version: Version,
        base_version: Option<Version>,
        state_tree_at_snapshot: SparseMerkleTree<StateValue>
    ) -> Result<()> { ... } fn delete_genesis(&self) -> Result<()> { ... } }
Expand description

Trait that is implemented by a DB that supports certain public (to client) write APIs expected of an Aptos DB. This adds write APIs to DbReader.

Provided Methods

Get a (stateful) state snapshot receiver.

Chunk of accounts need to be added via add_chunk() before finishing up with finish_box()

Finalizes a state snapshot that has already been restored to the database through a state snapshot receiver. This is required to bootstrap the transaction accumulator and populate transaction and event information.

Note: this assumes that the output with proof has already been verified and that the state snapshot was restored at the same version.

Persists the specified ledger infos.

Note: this assumes that the ledger infos have already been verified.

Persist transactions. Called by the executor module when either syncing nodes or committing blocks during normal operation. See AptosDB::save_transactions.

Persists merklized states as authenticated state checkpoint. See AptosDB::save_state_snapshot.

Deletes transaction data associated with the genesis transaction. This is useful for cleaning up the database after a node has bootstrapped all accounts through state sync.

TODO(joshlind): find a cleaner (long term) solution to avoid us having to expose this…

Implementors