Documentation ¶
Index ¶
- Constants
- Variables
- func InstanceOfMptStore() ethstate.Database
- type MptStore
- func (ms *MptStore) CacheWrap() types.CacheWrap
- func (ms *MptStore) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.CacheWrap
- func (ms *MptStore) CommitterCommit(delta *iavl.TreeDelta) (types.CommitID, *iavl.TreeDelta)
- 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) Get(key []byte) []byte
- 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) (*MptStore, 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) StartPrefetcher(namespace string)
- func (ms *MptStore) StopPrefetcher()
- func (ms *MptStore) StopWithVersion(targetVersion int64) error
- type ProofList
- type TriePrefetcher
Constants ¶
const ( StoreTypeMPT = types.StoreTypeMPT TriesInMemory = 100 // StoreKey is string representation of the store key for mpt StoreKey = "mpt" )
const ( FlagTrieWriteAhead = "trie.write-ahead" FlagTrieDirtyDisabled = "trie.dirty-disabled" FlagTrieCacheSize = "trie.cache-size" FlagTrieNodesLimit = "trie.nodes-limit" FlagTrieImgsLimit = "trie.imgs-limit" )
const (
FlagTrieAccStoreCache = "trie.account-store-cache"
)
const ProofOpMptAbsence = "mpt:a"
const ProofOpMptValue = "mpt:v"
Variables ¶
var ( TrieWriteAhead = false TrieDirtyDisabled = false TrieCacheSize uint = 2048 // MB TrieNodesLimit uint = 256 // MB TrieImgsLimit uint = 4 // MB TrieCommitGap int64 = 100 )
var ( KeyPrefixAccRootMptHash = []byte{0x11} KeyPrefixAccLatestStoredHeight = []byte{0x12} KeyPrefixEvmRootMptHash = []byte{0x13} KeyPrefixEvmLatestStoredHeight = []byte{0x14} 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) // EmptyRootHash is the known root hash of an empty trie. EmptyRootHash = ethtypes.EmptyRootHash EmptyRootHashBytes = EmptyRootHash.Bytes() )
var (
TrieAccStoreCache uint = 32 // MB
)
Functions ¶
func InstanceOfMptStore ¶
Types ¶
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 ¶
* implement CommitStore, CommitKVStore
func (*MptStore) CommitterCommitMap ¶
func (ms *MptStore) CommitterCommitMap(deltaMap iavl.TreeDeltaMap) (_ types.CommitID, _ iavl.TreeDeltaMap)
func (*MptStore) CurrentVersion ¶
func (*MptStore) GetDBReadCount ¶
func (*MptStore) GetDBReadTime ¶
func (*MptStore) GetDBWriteCount ¶
func (*MptStore) GetFlatKVReadCount ¶
func (*MptStore) GetFlatKVReadTime ¶
func (*MptStore) GetFlatKVWriteCount ¶
func (*MptStore) GetFlatKVWriteTime ¶
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) StartPrefetcher ¶
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 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.