ForgeSdk v0.28.2 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
t()
View Source
t() :: ForgeSdk.StateDb.t()
t() :: ForgeSdk.StateDb.t()
Link to this section Functions
close(handler) View Source
Close the database
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.
get(handler, address) View Source
Retrieve the state from an address
get(handler, address, height) View Source
Retrieve the state from an address by given height
get_info(handler, height \\ 0) View Source
Retrieve the last block height and the app_hash of the states db for a given height
get_raw(handler, address) View Source
Retrieve the raw state (not final) from an address, used internally for migration. No cache is needed.
open(handler) View Source
Open a database for write/read
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(handler, height) View Source
Travel to different block height. The returned db handler could be used to retrieve old state from the db.