Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type DataEntryPrefix ¶
type DataEntryPrefix byte
DataEntryPrefix
const ( // DATA DATA_BLOCK DataEntryPrefix = 0x00 //Block height => block hash key prefix DATA_HEADER = 0x01 //Block hash => block hash key prefix DATA_TRANSACTION = 0x02 //Transction hash = > transaction key prefix DATA_STATE_MERKLE_ROOT = 0x21 // block height => write set hash + state merkle root // Transaction ST_BOOKKEEPER DataEntryPrefix = 0x03 //BookKeeper state key prefix ST_CONTRACT DataEntryPrefix = 0x04 //Smart contract state key prefix ST_STORAGE DataEntryPrefix = 0x05 //Smart contract storage key prefix ST_VALIDATOR DataEntryPrefix = 0x07 //no use ST_VOTE DataEntryPrefix = 0x08 //Vote state key prefix IX_HEADER_HASH_LIST DataEntryPrefix = 0x09 //Block height => block hash key prefix //SYSTEM SYS_CURRENT_BLOCK DataEntryPrefix = 0x10 //Current block key prefix SYS_VERSION DataEntryPrefix = 0x11 //Store version key prefix SYS_CURRENT_STATE_ROOT DataEntryPrefix = 0x12 //no use SYS_BLOCK_MERKLE_TREE DataEntryPrefix = 0x13 // Block merkle tree root key prefix SYS_STATE_MERKLE_TREE DataEntryPrefix = 0x20 // state merkle tree root key prefix EVENT_NOTIFY DataEntryPrefix = 0x14 //Event notify key prefix )
type EventStore ¶
type EventStore interface { //SaveEventNotifyByTx save event notify gen by smart contract execution SaveEventNotifyByTx(txHash common.Uint256, notify *event.ExecuteNotify) error //Save transaction hashes which have event notify gen SaveEventNotifyByBlock(height uint32, txHashs []common.Uint256) //GetEventNotifyByTx return event notify by transaction hash GetEventNotifyByTx(txHash common.Uint256) (*event.ExecuteNotify, error) //Commit event notify to store CommitTo() error }
EventStore save event notify
type MemoryCacheStore ¶
type MemoryCacheStore interface { //Put the key-value pair to store Put(prefix byte, key []byte, value states.StateValue, state ItemState) //Get the value if key in store Get(prefix byte, key []byte) *StateItem //Delete the key in store Delete(prefix byte, key []byte) //Get all updated key-value set GetChangeSet() map[string]*StateItem // Get all key-value in store Find() []*StateItem }
MemoryCacheStore
type PersistStore ¶
type PersistStore interface { Put(key []byte, value []byte) error //Put the key-value pair to store Get(key []byte) ([]byte, error) //Get the value if key in store Has(key []byte) (bool, error) //Whether the key is exist in store Delete(key []byte) error //Delete the key in store NewBatch() //Start commit batch BatchPut(key []byte, value []byte) //Put a key-value pair to batch BatchDelete(key []byte) //Delete the key in batch BatchCommit() error //Commit batch to store Close() error //Close store NewIterator(prefix []byte) StoreIterator //Return the iterator of store }
PersistStore of ledger
type StateItem ¶
type StateItem struct { Key string //State key Value states.StateValue //State value State ItemState //Status Trie bool //no use }
State item struct
type StateStore ¶
type StateStore interface { //Add key-value pair to store TryAdd(prefix DataEntryPrefix, key []byte, value states.StateValue) //Get key from state store, if not exist, add it to store TryGetOrAdd(prefix DataEntryPrefix, key []byte, value states.StateValue) error //Get key from state store TryGet(prefix DataEntryPrefix, key []byte) (*StateItem, error) //Delete key in store TryDelete(prefix DataEntryPrefix, key []byte) //iterator key in store Find(prefix DataEntryPrefix, key []byte) ([]*StateItem, error) }
StateStore save result of smart contract execution, before commit to store
type StoreIterator ¶
type StoreIterator interface { Next() bool //Next item. If item available return true, otherwise return false //Prev() bool //previous item. If item available return true, otherwise return false First() bool //First item. If item available return true, otherwise return false //Last() bool //Last item. If item available return true, otherwise return false //Seek(key []byte) bool //Seek key. If item available return true, otherwise return false Key() []byte //Return the current item key Value() []byte //Return the current item value Release() //Close iterator Error() error // Error returns any accumulated error. }
Store iterator for iterate store
Click to show internal directories.
Click to hide internal directories.