ForgeSdk v0.26.5 ForgeSdk.StateDb protocol View Source

StateDb protocol for interact with kv store

Link to this section Summary

Functions

Close the database

When a block is committed, record the last block and the app hash for that block. Then return the app hash

Retrieve the state from an address

Retrieve the state from an address by given height

Retrieve the last block height and the app_hash of the states db for a given height

Retrieve the raw state (not final) from an address, used internally for migration. No cache is needed

Open a database for write/read

Put the state into to address in the db. This will lead to a change of root_hash

Travel to different block height. The returned db handler could be used to retrieve old state from the db

Link to this section Types

Link to this section Functions

Close the database

Link to this function

commit_block(handler, height) View Source

When a block is committed, record the last block and the app hash for that block. Then return the app hash.

Retrieve the state from an address

Link to this function

get(handler, address, height) View Source

Retrieve the state from an address by given height

Link to this function

get_info(handler, height \\ 0) View Source

Retrieve the last block height and the app_hash of the states db for a given height

Link to this function

get_raw(handler, address) View Source

Retrieve the raw state (not final) from an address, used internally for migration. No cache is needed.

Open a database for write/read

Link to this function

put(handler, address, data) View Source

Put the state into to address in the db. This will lead to a change of root_hash.

Travel to different block height. The returned db handler could be used to retrieve old state from the db.