Documentation ¶
Index ¶
- func NewCacheKVStore(parent KVStore) *cacheKVStore
- func NewCommitMultiStore(db dbm.DB) *baseMultiStore
- func PrefixEndBytes(prefix []byte) []byte
- func RequireProof(subpath string) bool
- func VerifyMultiStoreCommitInfo(storeName string, storeInfos []storeInfo, appHash []byte) ([]byte, error)
- func VerifyRangeProof(key, value []byte, substoreCommitHash []byte, rangeProof *iavl.RangeProof) error
- type CacheKVStore
- type CacheMultiStore
- type CacheWrap
- type CacheWrapper
- type CommitID
- type CommitKVStore
- type CommitMultiStore
- type CommitStore
- type Committer
- type Iterator
- type KVPair
- type KVStore
- type KVStoreKey
- type MultiStore
- type MultiStoreProof
- type PruningStrategy
- type Queryable
- type Store
- type StoreKey
- type StoreType
- type TraceContext
- type TraceKVStore
- func (tkv *TraceKVStore) CacheWrap() CacheWrap
- func (tkv *TraceKVStore) CacheWrapWithTrace(_ io.Writer, _ TraceContext) CacheWrap
- func (tkv *TraceKVStore) Delete(key []byte)
- func (tkv *TraceKVStore) Get(key []byte) []byte
- func (tkv *TraceKVStore) GetStoreType() StoreType
- func (tkv *TraceKVStore) Has(key []byte) bool
- func (tkv *TraceKVStore) Iterator(start, end []byte) dbm.Iterator
- func (tkv *TraceKVStore) Prefix(prefix []byte) KVStore
- func (tkv *TraceKVStore) ReverseIterator(start, end []byte) dbm.Iterator
- func (tkv *TraceKVStore) Set(key []byte, value []byte)
- type TransientStoreKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrefixEndBytes ¶
PrefixEndBytes returns the []byte that would end a range query for all []byte with a certain prefix Deals with last byte of prefix being FF without overflowing
func RequireProof ¶
RequireProof return whether proof is require for the subpath
func VerifyMultiStoreCommitInfo ¶
func VerifyMultiStoreCommitInfo(storeName string, storeInfos []storeInfo, appHash []byte) ([]byte, error)
VerifyMultiStoreCommitInfo verify multiStoreCommitInfo against appHash
func VerifyRangeProof ¶
func VerifyRangeProof(key, value []byte, substoreCommitHash []byte, rangeProof *iavl.RangeProof) error
VerifyRangeProof verify iavl RangeProof
Types ¶
type CacheKVStore ¶
type CacheKVStore interface { KVStore // Writes operations to underlying KVStore Write() }
CacheKVStore cache-wraps a KVStore. After calling .Write() on the CacheKVStore, all previously created CacheKVStores on the object expire.
type CacheMultiStore ¶
type CacheMultiStore interface { MultiStore Write() // Writes operations to underlying KVStore }
From MultiStore.CacheMultiStore()....
type CacheWrap ¶
type CacheWrap interface { // Write syncs with the underlying store. Write() // CacheWrap recursively wraps again. CacheWrap() CacheWrap // CacheWrapWithTrace recursively wraps again with tracing enabled. CacheWrapWithTrace(w io.Writer, tc TraceContext) CacheWrap }
CacheWrap makes the most appropriate cache-wrap. For example, IAVLStore.CacheWrap() returns a CacheKVStore. CacheWrap should not return a Committer, since Commit cache-wraps make no sense. It can return KVStore, HeapStore, SpaceStore, etc.
type CacheWrapper ¶
type CacheWrapper interface { // CacheWrap cache wraps. CacheWrap() CacheWrap // CacheWrapWithTrace cache wraps with tracing enabled. CacheWrapWithTrace(w io.Writer, tc TraceContext) CacheWrap }
type CommitKVStore ¶
Stores of MultiStore must implement CommitStore.
type CommitMultiStore ¶
type CommitMultiStore interface { Committer MultiStore // Mount a store of type using the given db. // If db == nil, the new store will use the CommitMultiStore db. MountStoreWithDB(key StoreKey, typ StoreType, db dbm.DB) // Panics on a nil key. GetCommitStore(key StoreKey) CommitStore // Panics on a nil key. GetCommitKVStore(key StoreKey) CommitKVStore // Load the latest persisted version. Called once after all // calls to Mount*Store() are complete. LoadLatestVersion() error // Load a specific persisted version. When you load an old // version, or when the last commit attempt didn't complete, // the next commit after loading must be idempotent (return the // same commit id). Otherwise the behavior is undefined. LoadVersion(ver int64) error }
A non-cache MultiStore.
type CommitStore ¶
Stores of MultiStore must implement CommitStore.
func LoadIAVLStore ¶
func LoadIAVLStore(db dbm.DB, id CommitID, pruning PruningStrategy) (CommitStore, error)
load the iavl store
type Committer ¶
type Committer interface { Commit() CommitID LastCommitID() CommitID SetPruning(PruningStrategy) }
something that can persist to disk
type Iterator ¶
Alias iterator to db's Iterator for convenience.
func KVStorePrefixIterator ¶
Iterator over all the keys with a certain prefix in ascending order
func KVStoreReversePrefixIterator ¶
Iterator over all the keys with a certain prefix in descending order.
type KVStore ¶
type KVStore interface { Store // Get returns nil iff key doesn't exist. Panics on nil key. Get(key []byte) []byte // Has checks if a key exists. Panics on nil key. Has(key []byte) bool // Set sets the key. Panics on nil key. Set(key, value []byte) // Delete deletes the key. Panics on nil key. Delete(key []byte) // Iterator over a domain of keys in ascending order. End is exclusive. // Start must be less than end, or the Iterator is invalid. // Iterator must be closed by caller. // To iterate over entire domain, use store.Iterator(nil, nil) // CONTRACT: No writes may happen within a domain while an iterator exists over it. Iterator(start, end []byte) Iterator // Iterator over a domain of keys in descending order. End is exclusive. // Start must be greater than end, or the Iterator is invalid. // Iterator must be closed by caller. // CONTRACT: No writes may happen within a domain while an iterator exists over it. ReverseIterator(start, end []byte) Iterator // Prefix applied keys with the argument // CONTRACT: when Prefix is called on a KVStore more than once, // the concatanation of the prefixes is applied Prefix(prefix []byte) KVStore }
KVStore is a simple interface to get/set data
type KVStoreKey ¶
type KVStoreKey struct {
// contains filtered or unexported fields
}
KVStoreKey is used for accessing substores. Only the pointer value should ever be used - it functions as a capabilities key.
func NewKVStoreKey ¶
func NewKVStoreKey(name string) *KVStoreKey
NewKVStoreKey returns a new pointer to a KVStoreKey. Use a pointer so keys don't collide.
func (*KVStoreKey) Name ¶
func (key *KVStoreKey) Name() string
func (*KVStoreKey) String ¶
func (key *KVStoreKey) String() string
type MultiStore ¶
type MultiStore interface { Store // Cache wrap MultiStore. // NOTE: Caller should probably not call .Write() on each, but // call CacheMultiStore.Write(). CacheMultiStore() CacheMultiStore // Convenience for fetching substores. GetStore(StoreKey) Store GetKVStore(StoreKey) KVStore // TracingEnabled returns if tracing is enabled for the MultiStore. TracingEnabled() bool // WithTracer sets the tracer for the MultiStore that the underlying // stores will utilize to trace operations. A MultiStore is returned. WithTracer(w io.Writer) MultiStore // WithTracingContext sets the tracing context for a MultiStore. It is // implied that the caller should update the context when necessary between // tracing operations. A MultiStore is returned. WithTracingContext(TraceContext) MultiStore // ResetTraceContext resets the current tracing context. ResetTraceContext() MultiStore }
type MultiStoreProof ¶
type MultiStoreProof struct { StoreInfos []storeInfo StoreName string RangeProof iavl.RangeProof }
MultiStoreProof defines a collection of store proofs in a multi-store
type PruningStrategy ¶
type PruningStrategy uint8
PruningStrategy specfies how old states will be deleted over time
const ( // PruneSyncable means only those states not needed for state syncing will be deleted (keeps last 100 + every 10000th) PruneSyncable PruningStrategy = iota // PruneEverything means all saved states will be deleted, storing only the current state PruneEverything PruningStrategy = iota // PruneNothing means all historic states will be saved, nothing will be deleted PruneNothing PruningStrategy = iota )
type Queryable ¶
type Queryable interface {
Query(abci.RequestQuery) abci.ResponseQuery
}
Queryable allows a Store to expose internal state to the abci.Query interface. Multistore can route requests to the proper Store.
This is an optional, but useful extension to any CommitStore
type Store ¶
type Store interface { GetStoreType() StoreType CacheWrapper }
type TraceContext ¶
type TraceContext map[string]interface{}
TraceContext contains TraceKVStore context data. It will be written with every trace operation.
type TraceKVStore ¶
type TraceKVStore struct {
// contains filtered or unexported fields
}
TraceKVStore implements the KVStore interface with tracing enabled. Operations are traced on each core KVStore call and written to the underlying io.writer.
TODO: Should we use a buffered writer and implement Commit on TraceKVStore?
func NewTraceKVStore ¶
func NewTraceKVStore(parent KVStore, writer io.Writer, tc TraceContext) *TraceKVStore
NewTraceKVStore returns a reference to a new traceKVStore given a parent KVStore implementation and a buffered writer.
func (*TraceKVStore) CacheWrap ¶
func (tkv *TraceKVStore) CacheWrap() CacheWrap
CacheWrap implements the KVStore interface. It panics as a TraceKVStore cannot be cache wrapped.
func (*TraceKVStore) CacheWrapWithTrace ¶
func (tkv *TraceKVStore) CacheWrapWithTrace(_ io.Writer, _ TraceContext) CacheWrap
CacheWrapWithTrace implements the KVStore interface. It panics as a TraceKVStore cannot be cache wrapped.
func (*TraceKVStore) Delete ¶
func (tkv *TraceKVStore) Delete(key []byte)
Delete implements the KVStore interface. It traces a write operation and delegates the Delete call to the parent KVStore.
func (*TraceKVStore) Get ¶
func (tkv *TraceKVStore) Get(key []byte) []byte
Get implements the KVStore interface. It traces a read operation and delegates a Get call to the parent KVStore.
func (*TraceKVStore) GetStoreType ¶
func (tkv *TraceKVStore) GetStoreType() StoreType
GetStoreType implements the KVStore interface. It returns the underlying KVStore type.
func (*TraceKVStore) Has ¶
func (tkv *TraceKVStore) Has(key []byte) bool
Has implements the KVStore interface. It delegates the Has call to the parent KVStore.
func (*TraceKVStore) Iterator ¶
func (tkv *TraceKVStore) Iterator(start, end []byte) dbm.Iterator
Iterator implements the KVStore interface. It delegates the Iterator call the to the parent KVStore.
func (*TraceKVStore) Prefix ¶
func (tkv *TraceKVStore) Prefix(prefix []byte) KVStore
Prefix implements the KVStore interface.
func (*TraceKVStore) ReverseIterator ¶
func (tkv *TraceKVStore) ReverseIterator(start, end []byte) dbm.Iterator
ReverseIterator implements the KVStore interface. It delegates the ReverseIterator call the to the parent KVStore.
func (*TraceKVStore) Set ¶
func (tkv *TraceKVStore) Set(key []byte, value []byte)
Set implements the KVStore interface. It traces a write operation and delegates the Set call to the parent KVStore.
type TransientStoreKey ¶
type TransientStoreKey struct {
// contains filtered or unexported fields
}
TransientStoreKey is used for indexing transient stores in a MultiStore
func NewTransientStoreKey ¶
func NewTransientStoreKey(name string) *TransientStoreKey
Constructs new TransientStoreKey Must return a pointer according to the ocap principle
func (*TransientStoreKey) String ¶
func (key *TransientStoreKey) String() string
Implements StoreKey