Trait storage_interface::DbWriter
source · [−]pub trait DbWriter: Send + Sync {
fn get_state_snapshot_receiver(
&self,
version: Version,
expected_root_hash: HashValue
) -> Result<Box<dyn StateSnapshotReceiver<StateKey, StateKeyAndValue>>> { ... }
fn finalize_state_snapshot(
&self,
version: Version,
output_with_proof: TransactionOutputListWithProof
) -> Result<()> { ... }
fn save_ledger_infos(
&self,
ledger_infos: &[LedgerInfoWithSignatures]
) -> Result<()> { ... }
fn save_transactions(
&self,
txns_to_commit: &[TransactionToCommit],
first_version: Version,
ledger_info_with_sigs: Option<&LedgerInfoWithSignatures>
) -> 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
fn get_state_snapshot_receiver(
&self,
version: Version,
expected_root_hash: HashValue
) -> Result<Box<dyn StateSnapshotReceiver<StateKey, StateKeyAndValue>>>
fn get_state_snapshot_receiver(
&self,
version: Version,
expected_root_hash: HashValue
) -> Result<Box<dyn StateSnapshotReceiver<StateKey, StateKeyAndValue>>>
Get a (stateful) state snapshot receiver.
Chunk of accounts need to be added via add_chunk() before finishing up with finish_box()
fn finalize_state_snapshot(
&self,
version: Version,
output_with_proof: TransactionOutputListWithProof
) -> Result<()>
fn finalize_state_snapshot(
&self,
version: Version,
output_with_proof: TransactionOutputListWithProof
) -> Result<()>
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.
fn save_ledger_infos(
&self,
ledger_infos: &[LedgerInfoWithSignatures]
) -> Result<()>
fn save_ledger_infos(
&self,
ledger_infos: &[LedgerInfoWithSignatures]
) -> Result<()>
Persists the specified ledger infos.
Note: this assumes that the ledger infos have already been verified.
fn save_transactions(
&self,
txns_to_commit: &[TransactionToCommit],
first_version: Version,
ledger_info_with_sigs: Option<&LedgerInfoWithSignatures>
) -> Result<()>
fn save_transactions(
&self,
txns_to_commit: &[TransactionToCommit],
first_version: Version,
ledger_info_with_sigs: Option<&LedgerInfoWithSignatures>
) -> Result<()>
Persist transactions. Called by the executor module when either syncing nodes or committing
blocks during normal operation.
See AptosDB::save_transactions.
fn delete_genesis(&self) -> Result<()>
fn delete_genesis(&self) -> Result<()>
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…