Documentation
¶
Index ¶
Constants ¶
View Source
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" )
Variables ¶
View Source
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") //DefaultConfig is the default config for state factory DefaultConfig = Config{ Chain: blockchain.DefaultConfig, Genesis: genesis.Default, } )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Chain blockchain.Config Genesis genesis.Genesis }
Config contains the config for factory
func GenerateConfig ¶
func GenerateConfig(chain blockchain.Config, g genesis.Genesis) Config
GenerateConfig generates the factory config
type Factory ¶
type Factory interface { lifecycle.StartStopper protocol.StateReader Register(protocol.Protocol) error Validate(context.Context, *block.Block) error Mint(context.Context, actpool.ActPool, crypto.PrivateKey) (*block.Block, error) PutBlock(context.Context, *block.Block) error WorkingSet(context.Context) (protocol.StateManager, error) WorkingSetAtHeight(context.Context, uint64, ...*action.SealedEnvelope) (protocol.StateManager, error) StateReaderAt(blkHeight uint64, blkHash hash.Hash256) (protocol.StateReader, error) }
Factory defines an interface for managing states
func NewStateDB ¶
NewStateDB creates a new state db
type MintOption ¶ added in v2.0.8
type MintOption func(*Minter)
MintOption defines an option to configure Minter
func WithTimeoutOption ¶ added in v2.0.8
func WithTimeoutOption(timeout time.Duration) MintOption
WithTimeoutOption sets the timeout for NewBlockBuilder
type Minter ¶ added in v2.2.0
type Minter struct {
// contains filtered or unexported fields
}
Minter is a wrapper of Factory to mint blocks
func NewMinter ¶
func NewMinter(f Factory, ap actpool.ActPool, opts ...MintOption) *Minter
NewMinter creates a wrapper instance
type StateDBOption ¶
StateDBOption sets stateDB construction parameter
func DisableWorkingSetCacheOption ¶
func DisableWorkingSetCacheOption() StateDBOption
DisableWorkingSetCacheOption disable workingset cache
func RegistryStateDBOption ¶
func RegistryStateDBOption(reg *protocol.Registry) StateDBOption
RegistryStateDBOption sets the registry in state db
func SkipBlockValidationStateDBOption ¶
func SkipBlockValidationStateDBOption() StateDBOption
SkipBlockValidationStateDBOption skips block validation on PutBlock
Click to show internal directories.
Click to hide internal directories.