iotex-core: Index | Files

package factory

import ""


Package Files

factory.go statedb.go statetx.go util.go workingset.go


const (
    // AccountKVNameSpace is the bucket name for account trie
    AccountKVNameSpace = "Account"
    // CurrentHeightKey indicates the key of current factory height in underlying DB
    CurrentHeightKey = "currentHeight"
    // AccountTrieRootKey indicates the key of accountTrie root hash in underlying DB
    AccountTrieRootKey = "accountTrieRoot"

type Factory Uses

type Factory interface {
    Height() (uint64, error)
    // TODO : erase this interface
    NewWorkingSet() (WorkingSet, error)
    RunActions(context.Context, []action.SealedEnvelope) ([]*action.Receipt, WorkingSet, error)
    PickAndRunActions(context.Context, map[string][]action.SealedEnvelope, []action.SealedEnvelope) ([]*action.Receipt, []action.SealedEnvelope, WorkingSet, error)
    SimulateExecution(context.Context, address.Address, *action.Execution, evm.GetBlockHash) ([]byte, *action.Receipt, error)
    Commit(WorkingSet) error
    State(hash.Hash160, interface{}) error

Factory defines an interface for managing states

func NewFactory Uses

func NewFactory(cfg config.Config, opts ...Option) (Factory, error)

NewFactory creates a new state factory

func NewStateDB Uses

func NewStateDB(cfg config.Config, opts ...StateDBOption) (Factory, error)

NewStateDB creates a new state db

type Option Uses

type Option func(*factory, config.Config) error

Option sets Factory construction parameter

func DefaultTrieOption Uses

func DefaultTrieOption() Option

DefaultTrieOption creates trie from config for state factory

func InMemTrieOption Uses

func InMemTrieOption() Option

InMemTrieOption creates in memory trie for state factory

func PrecreatedTrieDBOption Uses

func PrecreatedTrieDBOption(kv db.KVStore) Option

PrecreatedTrieDBOption uses pre-created trie DB for state factory

type StateDBOption Uses

type StateDBOption func(*stateDB, config.Config) error

StateDBOption sets stateDB construction parameter

func DefaultStateDBOption Uses

func DefaultStateDBOption() StateDBOption

DefaultStateDBOption creates default state db from config

func InMemStateDBOption Uses

func InMemStateDBOption() StateDBOption

InMemStateDBOption creates in memory state db

func PrecreatedStateDBOption Uses

func PrecreatedStateDBOption(kv db.KVStore) StateDBOption

PrecreatedStateDBOption uses pre-created state db

type WorkingSet Uses

type WorkingSet interface {
    // states and actions
    RunAction(context.Context, action.SealedEnvelope) (*action.Receipt, error)
    RunActions(context.Context, []action.SealedEnvelope) ([]*action.Receipt, error)
    Finalize() error
    Snapshot() int
    Revert(int) error
    Commit() error
    RootHash() (hash.Hash256, error)
    Digest() (hash.Hash256, error)
    Version() uint64
    Height() (uint64, error)
    History() bool
    // General state
    State(hash.Hash160, interface{}) error
    PutState(hash.Hash160, interface{}) error
    DelState(pkHash hash.Hash160) error
    GetDB() db.KVStore
    GetCachedBatch() batch.CachedBatch

WorkingSet defines an interface for working set of states changes

Package factory imports 23 packages (graph) and is imported by 5 packages. Updated 2019-12-13. Refresh now. Tools for package owners.