iotex-core: Index | Files

package factory

import ""


Package Files

factory.go historyfactory.go statedb.go util.go workingset.go


const (
    // AccountKVNamespace is the bucket name for account
    AccountKVNamespace = "Account"
    // ArchiveNamespacePrefix is the prefix of the buckets storing history data
    ArchiveNamespacePrefix = "Archive"
    // CurrentHeightKey indicates the key of current factory height in underlying DB
    CurrentHeightKey = "currentHeight"
    // ArchiveTrieNamespace is the bucket for the latest state view
    ArchiveTrieNamespace = "AccountTrie"
    // ArchiveTrieRootKey indicates the key of accountTrie root hash in underlying DB
    ArchiveTrieRootKey = "archiveTrieRoot"


var (
    // ErrNotSupported is the error that the statedb is not for archive mode
    ErrNotSupported = errors.New("not supported")
    // ErrNoArchiveData is the error that the node have no archive data
    ErrNoArchiveData = errors.New("no archive data")

func NewHistoryStateReader Uses

func NewHistoryStateReader(sf Factory, h uint64) protocol.StateReader

NewHistoryStateReader creates new history state reader by given state factory and height

type Factory Uses

type Factory interface {
    Register(protocol.Protocol) error
    Validate(context.Context, *block.Block) error
    // NewBlockBuilder creates block builder
    NewBlockBuilder(context.Context, map[string][]action.SealedEnvelope, func(action.Envelope) (action.SealedEnvelope, error)) (*block.Builder, error)
    SimulateExecution(context.Context, address.Address, *action.Execution, evm.GetBlockHash) ([]byte, *action.Receipt, error)
    PutBlock(context.Context, *block.Block) error
    DeleteTipBlock(*block.Block) error
    StateAtHeight(uint64, interface{}, ...protocol.StateOption) error
    StatesAtHeight(uint64, ...protocol.StateOption) (state.Iterator, 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

func RegistryOption Uses

func RegistryOption(reg *protocol.Registry) Option

RegistryOption sets the registry in state db

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

func RegistryStateDBOption Uses

func RegistryStateDBOption(reg *protocol.Registry) StateDBOption

RegistryStateDBOption sets the registry in state db

Package factory imports 30 packages (graph) and is imported by 6 packages. Updated 2020-03-29. Refresh now. Tools for package owners.