Documentation ¶
Index ¶
- Constants
- Variables
- func AddressStoragePrefixMpt(address ethcmn.Address, stateRoot ethcmn.Hash) []byte
- func AddressStoreKey(addr []byte) []byte
- func DisableSnapshot()
- func GetAddressFromStoragePrefix(prefix []byte) ethcmn.Address
- func GetEthDB() ethdb.Database
- func GetRawDBDeltaInstance() *rawdbDelta
- func HasVersionByDiskDB(height int64) bool
- func InstanceOfMptStore() ethstate.Database
- func IsStorageKey(key []byte) bool
- func IsStoragePrefix(prefix []byte) bool
- func NewStatKeyValueStore(db ethdb.KeyValueStore, stat *RuntimeState) ethdb.KeyValueStore
- func PutStoreKey(key []byte) []byte
- func SetApplyDelta(val bool)
- func SetProduceDelta(val bool)
- func SetSnapshotRebuild(rebuild bool)
- func UpdateCommitGapHeight(gap int64)
- type AsyncKeyValueStore
- func (store *AsyncKeyValueStore) ActionAfterWriteDone(act func(), once bool)
- func (store *AsyncKeyValueStore) Close() error
- func (store *AsyncKeyValueStore) Compact(start []byte, limit []byte) error
- func (store *AsyncKeyValueStore) Delete(key []byte) error
- func (store *AsyncKeyValueStore) Get(key []byte) ([]byte, error)
- func (store *AsyncKeyValueStore) Has(key []byte) (bool, error)
- func (store *AsyncKeyValueStore) LogInfoAfterWriteDone(msg string, args ...interface{})
- func (store *AsyncKeyValueStore) LogStats()
- func (store *AsyncKeyValueStore) NewBatch() ethdb.Batch
- func (store *AsyncKeyValueStore) NewIterator(prefix []byte, start []byte) ethdb.Iterator
- func (store *AsyncKeyValueStore) Prune()
- func (store *AsyncKeyValueStore) Put(key []byte, value []byte) error
- func (store *AsyncKeyValueStore) SetLogger(logger log.Logger)
- func (store *AsyncKeyValueStore) Stat(property string) (string, error)
- func (store *AsyncKeyValueStore) WaitCurrentWriteDone()
- type AsyncKeyValueStoreOptions
- type Batch
- type EmptyStateRootRetriever
- func (e EmptyStateRootRetriever) GetAccStateRoot(rootBytes []byte) ethcmn.Hash
- func (e EmptyStateRootRetriever) GetStateRootAndCodeHash(rootBytes []byte) (ethcmn.Hash, []byte)
- func (e EmptyStateRootRetriever) ModifyAccStateRoot(before []byte, rootHash ethcmn.Hash) []byte
- func (e EmptyStateRootRetriever) RetrieveStateRoot([]byte) ethcmn.Hash
- type ImmutableMptStore
- func (ms *ImmutableMptStore) CacheWrap() types.CacheWrap
- func (ms *ImmutableMptStore) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.CacheWrap
- func (ms *ImmutableMptStore) Delete(key []byte)
- func (ms *ImmutableMptStore) Get(key []byte) []byte
- func (ms *ImmutableMptStore) GetStoreType() types.StoreType
- func (ms *ImmutableMptStore) Has(key []byte) bool
- func (ms *ImmutableMptStore) Iterator(start, end []byte) types.Iterator
- func (ms *ImmutableMptStore) ReverseIterator(start, end []byte) types.Iterator
- func (ms *ImmutableMptStore) Set(key []byte, value []byte)
- type MptStore
- func (ms *MptStore) CacheWrap() types.CacheWrap
- func (ms *MptStore) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.CacheWrap
- func (ms *MptStore) CommitterCommit(inputDelta interface{}) (rootHash types.CommitID, outputDelta interface{})
- func (ms *MptStore) CommitterCommitMap(deltaMap iavl.TreeDeltaMap) (_ types.CommitID, _ iavl.TreeDeltaMap)
- func (ms *MptStore) CurrentVersion() int64
- func (ms *MptStore) Delete(key []byte)
- func (ms *MptStore) EndTiming(tag string)
- func (ms *MptStore) Get(key []byte) []byte
- func (ms *MptStore) GetCacheReadCount() int
- func (ms *MptStore) GetDBReadCount() int
- func (ms *MptStore) GetDBReadTime() int
- func (ms *MptStore) GetDBWriteCount() int
- func (ms *MptStore) GetFlatKVReadCount() int
- func (ms *MptStore) GetFlatKVReadTime() int
- func (ms *MptStore) GetFlatKVWriteCount() int
- func (ms *MptStore) GetFlatKVWriteTime() int
- func (ms *MptStore) GetImmutable(height int64) (*ImmutableMptStore, error)
- func (ms *MptStore) GetLatestStoredBlockHeight() uint64
- func (ms *MptStore) GetMptRootHash(height uint64) ethcmn.Hash
- func (ms *MptStore) GetNodeReadCount() int
- func (ms *MptStore) GetStoreType() types.StoreType
- func (ms *MptStore) Has(key []byte) bool
- func (ms *MptStore) HasVersion(height int64) bool
- func (ms *MptStore) Iterator(start, end []byte) types.Iterator
- func (ms *MptStore) LastCommitID() types.CommitID
- func (ms *MptStore) LastCommitVersion() int64
- func (ms *MptStore) OnStop() error
- func (ms *MptStore) PushData2Database(curHeight int64)
- func (ms *MptStore) Query(req abci.RequestQuery) (res abci.ResponseQuery)
- func (ms *MptStore) ResetCount()
- func (ms *MptStore) ReverseIterator(start, end []byte) types.Iterator
- func (ms *MptStore) Set(key, value []byte)
- func (ms *MptStore) SetLatestStoredBlockHeight(height uint64)
- func (ms *MptStore) SetMptRootHash(height uint64, hash ethcmn.Hash)
- func (ms *MptStore) SetPruning(options types.PruningOptions)
- func (ms *MptStore) SetUpgradeVersion(i int64)
- func (ms *MptStore) SnapshotAccountIterator(root, seek ethcmn.Hash) (SnapshotAccountIterator, error)
- func (ms *MptStore) SnapshotStorageIterator(root, account, seek ethcmn.Hash) (SnapshotStorageIterator, error)
- func (ms *MptStore) StartPrefetcher(namespace string)
- func (ms *MptStore) StartTiming()
- func (ms *MptStore) StopPrefetcher()
- func (ms *MptStore) StopWithVersion(targetVersion int64) error
- type ProofList
- type RuntimeState
- type SnapshotAccountIterator
- type SnapshotStorageIterator
- type StatKeyValueStore
- type StateRootRetriever
- type TriePrefetcher
Constants ¶
const ( StoreTypeMPT = types.StoreTypeMPT // StoreKey is string representation of the store key for mpt StoreKey = "mpt" )
const ( FlagTrieDirtyDisabled = "trie.dirty-disabled" FlagTrieCacheSize = "trie.cache-size" FlagTrieNodesLimit = "trie.nodes-limit" FlagTrieImgsLimit = "trie.imgs-limit" FlagTrieInMemory = "trie.in-memory" FlagTrieAsyncDB = "trie.asyncdb" FlagTrieAsyncDBInitCap = "trie.asyncdb.init-cap" FlagTrieAsyncDBAutoPruningOff = "trie.asyncdb.auto-pruning-off" FlagTrieAsyncDBSyncPruning = "trie.asyncdb.sync-pruning" )
const ( FlagTrieAccStoreCache = "trie.account-store-cache" StorageRootLen = len(ethcmn.Hash{}) )
const ProofOpMptAbsence = "mpt:a"
const ProofOpMptValue = "mpt:v"
Variables ¶
var ( TrieDirtyDisabled = false TrieCacheSize uint = 2048 // MB TrieCommitGap int64 = 100 TriesInMemory uint = 100 TrieAsyncDB = true TrieAsyncDBInitCap = 200_0000 TrieAsyncDBAutoPruningOff = false TrieAsyncDBSyncPruning = false EnableAsyncCommit = false )
var ( KeyPrefixAccRootMptHash = []byte{0x11} KeyPrefixAccLatestStoredHeight = []byte{0x12} GAccToPrefetchChannel = make(chan [][]byte, 2000) GAccTryUpdateTrieChannel = make(chan struct{}) GAccTrieUpdatedChannel = make(chan struct{}) )
var ( NilHash = ethcmn.Hash{} // EmptyCodeHash is the known hash of an empty code. EmptyCodeHash = crypto.Keccak256Hash(nil) EmptyCodeHashBytes = crypto.Keccak256(nil) )
var (
PrefixSizeInMpt = prefixSizeInMpt
)
Functions ¶
func AddressStoragePrefixMpt ¶
func AddressStoreKey ¶
func DisableSnapshot ¶
func DisableSnapshot()
func GetRawDBDeltaInstance ¶ added in v0.1.5
func GetRawDBDeltaInstance() *rawdbDelta
func HasVersionByDiskDB ¶
func InstanceOfMptStore ¶
func IsStorageKey ¶ added in v0.1.2
IsStorageKey used for wasm contract storage key.
func IsStoragePrefix ¶
func NewStatKeyValueStore ¶
func NewStatKeyValueStore(db ethdb.KeyValueStore, stat *RuntimeState) ethdb.KeyValueStore
func PutStoreKey ¶ added in v0.1.4
func SetApplyDelta ¶
func SetApplyDelta(val bool)
func SetProduceDelta ¶
func SetProduceDelta(val bool)
func SetSnapshotRebuild ¶
func SetSnapshotRebuild(rebuild bool)
func UpdateCommitGapHeight ¶
func UpdateCommitGapHeight(gap int64)
Types ¶
type AsyncKeyValueStore ¶
type AsyncKeyValueStore struct { ethdb.KeyValueStore // contains filtered or unexported fields }
func NewAsyncKeyValueStore ¶
func NewAsyncKeyValueStore(db ethdb.KeyValueStore) *AsyncKeyValueStore
func NewAsyncKeyValueStoreWithOptions ¶
func NewAsyncKeyValueStoreWithOptions(db ethdb.KeyValueStore, options AsyncKeyValueStoreOptions) *AsyncKeyValueStore
func (*AsyncKeyValueStore) ActionAfterWriteDone ¶
func (store *AsyncKeyValueStore) ActionAfterWriteDone(act func(), once bool)
func (*AsyncKeyValueStore) Close ¶
func (store *AsyncKeyValueStore) Close() error
func (*AsyncKeyValueStore) Compact ¶
func (store *AsyncKeyValueStore) Compact(start []byte, limit []byte) error
func (*AsyncKeyValueStore) Delete ¶
func (store *AsyncKeyValueStore) Delete(key []byte) error
func (*AsyncKeyValueStore) LogInfoAfterWriteDone ¶
func (store *AsyncKeyValueStore) LogInfoAfterWriteDone(msg string, args ...interface{})
func (*AsyncKeyValueStore) LogStats ¶
func (store *AsyncKeyValueStore) LogStats()
func (*AsyncKeyValueStore) NewBatch ¶
func (store *AsyncKeyValueStore) NewBatch() ethdb.Batch
func (*AsyncKeyValueStore) NewIterator ¶
func (store *AsyncKeyValueStore) NewIterator(prefix []byte, start []byte) ethdb.Iterator
func (*AsyncKeyValueStore) Prune ¶
func (store *AsyncKeyValueStore) Prune()
func (*AsyncKeyValueStore) Put ¶
func (store *AsyncKeyValueStore) Put(key []byte, value []byte) error
func (*AsyncKeyValueStore) SetLogger ¶
func (store *AsyncKeyValueStore) SetLogger(logger log.Logger)
func (*AsyncKeyValueStore) Stat ¶
func (store *AsyncKeyValueStore) Stat(property string) (string, error)
func (*AsyncKeyValueStore) WaitCurrentWriteDone ¶ added in v0.1.1
func (store *AsyncKeyValueStore) WaitCurrentWriteDone()
type EmptyStateRootRetriever ¶
type EmptyStateRootRetriever struct{}
func (EmptyStateRootRetriever) GetAccStateRoot ¶
func (e EmptyStateRootRetriever) GetAccStateRoot(rootBytes []byte) ethcmn.Hash
func (EmptyStateRootRetriever) GetStateRootAndCodeHash ¶ added in v0.1.2
func (e EmptyStateRootRetriever) GetStateRootAndCodeHash(rootBytes []byte) (ethcmn.Hash, []byte)
func (EmptyStateRootRetriever) ModifyAccStateRoot ¶
func (e EmptyStateRootRetriever) ModifyAccStateRoot(before []byte, rootHash ethcmn.Hash) []byte
func (EmptyStateRootRetriever) RetrieveStateRoot ¶
func (e EmptyStateRootRetriever) RetrieveStateRoot([]byte) ethcmn.Hash
type ImmutableMptStore ¶
type ImmutableMptStore struct {
// contains filtered or unexported fields
}
func NewImmutableMptStore ¶
func NewImmutableMptStoreFromTrie ¶
func NewImmutableMptStoreFromTrie(db ethstate.Database, trie ethstate.Trie) *ImmutableMptStore
func (*ImmutableMptStore) CacheWrap ¶
func (ms *ImmutableMptStore) CacheWrap() types.CacheWrap
func (*ImmutableMptStore) CacheWrapWithTrace ¶
func (ms *ImmutableMptStore) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.CacheWrap
func (*ImmutableMptStore) Delete ¶
func (ms *ImmutableMptStore) Delete(key []byte)
func (*ImmutableMptStore) Get ¶
func (ms *ImmutableMptStore) Get(key []byte) []byte
func (*ImmutableMptStore) GetStoreType ¶
func (ms *ImmutableMptStore) GetStoreType() types.StoreType
func (*ImmutableMptStore) Has ¶
func (ms *ImmutableMptStore) Has(key []byte) bool
func (*ImmutableMptStore) Iterator ¶
func (ms *ImmutableMptStore) Iterator(start, end []byte) types.Iterator
func (*ImmutableMptStore) ReverseIterator ¶
func (ms *ImmutableMptStore) ReverseIterator(start, end []byte) types.Iterator
func (*ImmutableMptStore) Set ¶
func (ms *ImmutableMptStore) Set(key []byte, value []byte)
type MptStore ¶
type MptStore struct {
// contains filtered or unexported fields
}
MptStore Implements types.KVStore and CommitKVStore. Its main purpose is to own the same interface as iavl store in libs/cosmos-sdk/store/iavl/iavl_store.go
func (*MptStore) CacheWrapWithTrace ¶
func (*MptStore) CommitterCommit ¶
func (*MptStore) CommitterCommitMap ¶
func (ms *MptStore) CommitterCommitMap(deltaMap iavl.TreeDeltaMap) (_ types.CommitID, _ iavl.TreeDeltaMap)
func (*MptStore) CurrentVersion ¶
func (*MptStore) GetCacheReadCount ¶
func (*MptStore) GetDBReadCount ¶
func (*MptStore) GetDBReadTime ¶
func (*MptStore) GetDBWriteCount ¶
func (*MptStore) GetFlatKVReadCount ¶
func (*MptStore) GetFlatKVReadTime ¶
func (*MptStore) GetFlatKVWriteCount ¶
func (*MptStore) GetFlatKVWriteTime ¶
func (*MptStore) GetImmutable ¶
func (ms *MptStore) GetImmutable(height int64) (*ImmutableMptStore, error)
func (*MptStore) GetLatestStoredBlockHeight ¶
GetLatestStoredBlockHeight get latest mpt storage height
func (*MptStore) GetMptRootHash ¶
GetMptRootHash gets root mpt hash from block height
func (*MptStore) GetNodeReadCount ¶
func (*MptStore) GetStoreType ¶
* implement KVStore
func (*MptStore) HasVersion ¶
func (*MptStore) LastCommitID ¶
func (*MptStore) LastCommitVersion ¶
func (*MptStore) PushData2Database ¶
PushData2Database writes all associated state in cache to the database
func (*MptStore) Query ¶
func (ms *MptStore) Query(req abci.RequestQuery) (res abci.ResponseQuery)
* implement Queryable
func (*MptStore) ResetCount ¶
func (ms *MptStore) ResetCount()
func (*MptStore) ReverseIterator ¶
func (*MptStore) SetLatestStoredBlockHeight ¶
SetLatestStoredBlockHeight sets the latest stored storage height
func (*MptStore) SetMptRootHash ¶
SetMptRootHash sets the mapping from block height to root mpt hash
func (*MptStore) SetPruning ¶
func (ms *MptStore) SetPruning(options types.PruningOptions)
func (*MptStore) SetUpgradeVersion ¶
func (*MptStore) SnapshotAccountIterator ¶
func (ms *MptStore) SnapshotAccountIterator(root, seek ethcmn.Hash) (SnapshotAccountIterator, error)
func (*MptStore) SnapshotStorageIterator ¶
func (ms *MptStore) SnapshotStorageIterator(root, account, seek ethcmn.Hash) (SnapshotStorageIterator, error)
func (*MptStore) StartPrefetcher ¶
func (*MptStore) StartTiming ¶ added in v0.1.1
func (ms *MptStore) StartTiming()
func (*MptStore) StopPrefetcher ¶
func (ms *MptStore) StopPrefetcher()
StopPrefetcher terminates a running prefetcher and reports any leftover stats from the gathered metrics.
func (*MptStore) StopWithVersion ¶
Stop stops the blockchain service. If any imports are currently in progress it will abort them using the procInterrupt.
type RuntimeState ¶
type RuntimeState struct {
// contains filtered or unexported fields
}
func NewRuntimeState ¶
func NewRuntimeState() *RuntimeState
type SnapshotAccountIterator ¶
type SnapshotAccountIterator interface { snapshot.AccountIterator }
type SnapshotStorageIterator ¶
type SnapshotStorageIterator interface { snapshot.StorageIterator }
type StatKeyValueStore ¶
type StatKeyValueStore struct { ethdb.KeyValueStore // contains filtered or unexported fields }
func (*StatKeyValueStore) Delete ¶
func (s *StatKeyValueStore) Delete(key []byte) error
func (*StatKeyValueStore) NewBatch ¶
func (s *StatKeyValueStore) NewBatch() ethdb.Batch
type StateRootRetriever ¶
type StateRootRetriever interface { RetrieveStateRoot([]byte) ethcmn.Hash ModifyAccStateRoot(before []byte, rootHash ethcmn.Hash) []byte GetAccStateRoot(rootBytes []byte) ethcmn.Hash GetStateRootAndCodeHash([]byte) (ethcmn.Hash, []byte) }
var (
AccountStateRootRetriever StateRootRetriever = EmptyStateRootRetriever{}
)
type TriePrefetcher ¶
type TriePrefetcher struct {
// contains filtered or unexported fields
}
TriePrefetcher is an active prefetcher, which receives accounts or storage items and does trie-loading of them. The goal is to get as much useful content into the caches as possible.
Note, the prefetcher's API is not thread safe.
func NewTriePrefetcher ¶
NewTriePrefetcher
func (*TriePrefetcher) Close ¶
func (p *TriePrefetcher) Close()
Close iterates over all the subfetchers, aborts any that were left spinning and reports the stats to the metrics subsystem.
func (*TriePrefetcher) Copy ¶
func (p *TriePrefetcher) Copy() *TriePrefetcher
copy creates a deep-but-inactive copy of the trie prefetcher. Any trie data already loaded will be copied over, but no goroutines will be started. This is mostly used in the miner which creates a copy of it's actively mutated state to be sealed while it may further mutate the state.
func (*TriePrefetcher) Prefetch ¶
func (p *TriePrefetcher) Prefetch(root common.Hash, keys [][]byte)
prefetch schedules a batch of trie items to prefetch.