Documentation
¶
Index ¶
- Constants
- Variables
- func AssertValidKey(key []byte)
- func AssertValidValue(value []byte)
- func DiffKVStores(a KVStore, b KVStore, prefixesToSkip [][]byte) (kvAs, kvBs []kv.Pair)
- func InclusiveEndBytes(inclusiveBytes []byte) []byte
- func PrefixEndBytes(prefix []byte) []byte
- type CacheKVStore
- type CacheMultiStore
- type CacheWrap
- type CacheWrapper
- type CapabilityKey
- type CommitID
- func (*CommitID) Descriptor() ([]byte, []int)
- func (m *CommitID) GetHash() []byte
- func (m *CommitID) GetVersion() int64
- func (cid CommitID) IsZero() bool
- func (m *CommitID) Marshal() (dAtA []byte, err error)
- func (m *CommitID) MarshalTo(dAtA []byte) (int, error)
- func (m *CommitID) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*CommitID) ProtoMessage()
- func (m *CommitID) Reset()
- func (m *CommitID) Size() (n int)
- func (cid CommitID) String() string
- func (m *CommitID) Unmarshal(dAtA []byte) error
- func (m *CommitID) XXX_DiscardUnknown()
- func (m *CommitID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CommitID) XXX_Merge(src proto.Message)
- func (m *CommitID) XXX_Size() int
- func (m *CommitID) XXX_Unmarshal(b []byte) error
- type CommitInfo
- func (*CommitInfo) Descriptor() ([]byte, []int)
- func (m *CommitInfo) GetStoreInfos() []StoreInfo
- func (m *CommitInfo) GetVersion() int64
- func (m *CommitInfo) Marshal() (dAtA []byte, err error)
- func (m *CommitInfo) MarshalTo(dAtA []byte) (int, error)
- func (m *CommitInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*CommitInfo) ProtoMessage()
- func (m *CommitInfo) Reset()
- func (m *CommitInfo) Size() (n int)
- func (m *CommitInfo) String() string
- func (m *CommitInfo) Unmarshal(dAtA []byte) error
- func (m *CommitInfo) XXX_DiscardUnknown()
- func (m *CommitInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CommitInfo) XXX_Merge(src proto.Message)
- func (m *CommitInfo) XXX_Size() int
- func (m *CommitInfo) XXX_Unmarshal(b []byte) error
- type CommitKVStore
- type CommitMultiStore
- type CommitStore
- type Committer
- type ErrorGasOverflow
- type ErrorNegativeGasConsumed
- type ErrorOutOfGas
- type Gas
- type GasConfig
- type GasMeter
- type Iterator
- func KVStorePrefixIterator(kvs KVStore, prefix []byte) Iterator
- func KVStorePrefixIteratorPaginated(kvs KVStore, prefix []byte, page, limit uint) Iterator
- func KVStoreReversePrefixIterator(kvs KVStore, prefix []byte) Iterator
- func KVStoreReversePrefixIteratorPaginated(kvs KVStore, prefix []byte, page, limit uint) Iterator
- type KVPair
- type KVStore
- type KVStoreKey
- type MemoryStoreKey
- type MultiStore
- type MultiStorePersistentCache
- type PaginatedIterator
- type PruningOptions
- type Queryable
- type SnapshotIAVLItem
- func (*SnapshotIAVLItem) Descriptor() ([]byte, []int)
- func (m *SnapshotIAVLItem) GetHeight() int32
- func (m *SnapshotIAVLItem) GetKey() []byte
- func (m *SnapshotIAVLItem) GetValue() []byte
- func (m *SnapshotIAVLItem) GetVersion() int64
- func (m *SnapshotIAVLItem) Marshal() (dAtA []byte, err error)
- func (m *SnapshotIAVLItem) MarshalTo(dAtA []byte) (int, error)
- func (m *SnapshotIAVLItem) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*SnapshotIAVLItem) ProtoMessage()
- func (m *SnapshotIAVLItem) Reset()
- func (m *SnapshotIAVLItem) Size() (n int)
- func (m *SnapshotIAVLItem) String() string
- func (m *SnapshotIAVLItem) Unmarshal(dAtA []byte) error
- func (m *SnapshotIAVLItem) XXX_DiscardUnknown()
- func (m *SnapshotIAVLItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SnapshotIAVLItem) XXX_Merge(src proto.Message)
- func (m *SnapshotIAVLItem) XXX_Size() int
- func (m *SnapshotIAVLItem) XXX_Unmarshal(b []byte) error
- type SnapshotItem
- func (*SnapshotItem) Descriptor() ([]byte, []int)
- func (m *SnapshotItem) GetIAVL() *SnapshotIAVLItem
- func (m *SnapshotItem) GetItem() isSnapshotItem_Item
- func (m *SnapshotItem) GetStore() *SnapshotStoreItem
- func (m *SnapshotItem) Marshal() (dAtA []byte, err error)
- func (m *SnapshotItem) MarshalTo(dAtA []byte) (int, error)
- func (m *SnapshotItem) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*SnapshotItem) ProtoMessage()
- func (m *SnapshotItem) Reset()
- func (m *SnapshotItem) Size() (n int)
- func (m *SnapshotItem) String() string
- func (m *SnapshotItem) Unmarshal(dAtA []byte) error
- func (m *SnapshotItem) XXX_DiscardUnknown()
- func (m *SnapshotItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SnapshotItem) XXX_Merge(src proto.Message)
- func (*SnapshotItem) XXX_OneofWrappers() []interface{}
- func (m *SnapshotItem) XXX_Size() int
- func (m *SnapshotItem) XXX_Unmarshal(b []byte) error
- type SnapshotItem_IAVL
- type SnapshotItem_Store
- type SnapshotStoreItem
- func (*SnapshotStoreItem) Descriptor() ([]byte, []int)
- func (m *SnapshotStoreItem) GetName() string
- func (m *SnapshotStoreItem) Marshal() (dAtA []byte, err error)
- func (m *SnapshotStoreItem) MarshalTo(dAtA []byte) (int, error)
- func (m *SnapshotStoreItem) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*SnapshotStoreItem) ProtoMessage()
- func (m *SnapshotStoreItem) Reset()
- func (m *SnapshotStoreItem) Size() (n int)
- func (m *SnapshotStoreItem) String() string
- func (m *SnapshotStoreItem) Unmarshal(dAtA []byte) error
- func (m *SnapshotStoreItem) XXX_DiscardUnknown()
- func (m *SnapshotStoreItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SnapshotStoreItem) XXX_Merge(src proto.Message)
- func (m *SnapshotStoreItem) XXX_Size() int
- func (m *SnapshotStoreItem) XXX_Unmarshal(b []byte) error
- type Store
- type StoreInfo
- func (*StoreInfo) Descriptor() ([]byte, []int)
- func (m *StoreInfo) GetCommitId() CommitID
- func (m *StoreInfo) GetName() string
- func (m *StoreInfo) Marshal() (dAtA []byte, err error)
- func (m *StoreInfo) MarshalTo(dAtA []byte) (int, error)
- func (m *StoreInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*StoreInfo) ProtoMessage()
- func (m *StoreInfo) Reset()
- func (m *StoreInfo) Size() (n int)
- func (m *StoreInfo) String() string
- func (m *StoreInfo) Unmarshal(dAtA []byte) error
- func (m *StoreInfo) XXX_DiscardUnknown()
- func (m *StoreInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *StoreInfo) XXX_Merge(src proto.Message)
- func (m *StoreInfo) XXX_Size() int
- func (m *StoreInfo) XXX_Unmarshal(b []byte) error
- type StoreKVPair
- func (*StoreKVPair) Descriptor() ([]byte, []int)
- func (m *StoreKVPair) GetDelete() bool
- func (m *StoreKVPair) GetKey() []byte
- func (m *StoreKVPair) GetStoreKey() string
- func (m *StoreKVPair) GetValue() []byte
- func (m *StoreKVPair) Marshal() (dAtA []byte, err error)
- func (m *StoreKVPair) MarshalTo(dAtA []byte) (int, error)
- func (m *StoreKVPair) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*StoreKVPair) ProtoMessage()
- func (m *StoreKVPair) Reset()
- func (m *StoreKVPair) Size() (n int)
- func (m *StoreKVPair) String() string
- func (m *StoreKVPair) Unmarshal(dAtA []byte) error
- func (m *StoreKVPair) XXX_DiscardUnknown()
- func (m *StoreKVPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *StoreKVPair) XXX_Merge(src proto.Message)
- func (m *StoreKVPair) XXX_Size() int
- func (m *StoreKVPair) XXX_Unmarshal(b []byte) error
- type StoreKVPairWriteListener
- type StoreKey
- type StoreRename
- type StoreType
- type StoreUpgrades
- type StoreWithInitialVersion
- type TraceContext
- type TransientStoreKey
- type UpgradeInfo
- type WriteListener
Constants ¶
const ( GasIterNextCostFlatDesc = "IterNextFlat" GasValuePerByteDesc = "ValuePerByte" GasWritePerByteDesc = "WritePerByte" GasReadPerByteDesc = "ReadPerByte" GasWriteCostFlatDesc = "WriteFlat" GasReadCostFlatDesc = "ReadFlat" GasHasDesc = "Has" GasDeleteDesc = "Delete" )
Gas consumption descriptors.
const ( PruningOptionDefault = "default" PruningOptionEverything = "everything" PruningOptionNothing = "nothing" PruningOptionCustom = "custom" )
Pruning option string constants
Variables ¶
var ( ErrInvalidLengthCommitInfo = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowCommitInfo = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupCommitInfo = fmt.Errorf("proto: unexpected end of group") )
var ( ErrInvalidLengthListening = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowListening = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupListening = fmt.Errorf("proto: unexpected end of group") )
var ( // PruneDefault defines a pruning strategy where the last 362880 heights are // kept in addition to every 100th and where to-be pruned heights are pruned // at every 10th height. The last 362880 heights are kept assuming the typical // block time is 5s and typical unbonding period is 21 days. If these values // do not match the applications' requirements, use the "custom" option. PruneDefault = NewPruningOptions(362880, 100, 10) // PruneEverything defines a pruning strategy where all committed heights are // deleted, storing only the current height and where to-be pruned heights are // pruned at every 10th height. PruneEverything = NewPruningOptions(0, 0, 10) // PruneNothing defines a pruning strategy where all heights are kept on disk. PruneNothing = NewPruningOptions(0, 1, 0) )
Functions ¶
func AssertValidValue ¶
func AssertValidValue(value []byte)
Check if the value is valid(value is not nil)
func DiffKVStores ¶
DiffKVStores compares two KVstores and returns all the key/value pairs that differ from one another. It also skips value comparison for a set of provided prefixes.
func InclusiveEndBytes ¶
InclusiveEndBytes returns the []byte that would end a range query such that the input would be included
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
Types ¶
type CacheKVStore ¶
type CacheKVStore interface { KVStore // Writes operations to underlying KVStore Write() }
CacheKVStore branches a KVStore and provides read cache functionality. 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 // CacheWrapWithListeners recursively wraps again with listening enabled CacheWrapWithListeners(storeKey StoreKey, listeners []WriteListener) CacheWrap }
CacheWrap is the most appropriate interface for store ephemeral branching and cache. For example, IAVLStore.CacheWrap() returns a CacheKVStore. CacheWrap should not return a Committer, since Commit ephemeral store make no sense. It can return KVStore, HeapStore, SpaceStore, etc.
type CacheWrapper ¶
type CacheWrapper interface { // CacheWrap branches a store. CacheWrap() CacheWrap // CacheWrapWithTrace branches a store with tracing enabled. CacheWrapWithTrace(w io.Writer, tc TraceContext) CacheWrap // CacheWrapWithListeners recursively wraps again with listening enabled CacheWrapWithListeners(storeKey StoreKey, listeners []WriteListener) CacheWrap }
type CapabilityKey ¶
type CapabilityKey StoreKey
CapabilityKey represent the Cosmos SDK keys for object-capability generation in the IBC protocol as defined in https://github.com/cosmos/ics/tree/master/spec/ics-005-port-allocation#data-structures
type CommitID ¶
type CommitID struct { Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` }
CommitID defines the committment information when a specific store is committed.
func (*CommitID) Descriptor ¶
func (*CommitID) GetVersion ¶
func (*CommitID) MarshalToSizedBuffer ¶
func (*CommitID) ProtoMessage ¶
func (*CommitID) ProtoMessage()
func (*CommitID) XXX_DiscardUnknown ¶
func (m *CommitID) XXX_DiscardUnknown()
func (*CommitID) XXX_Marshal ¶
func (*CommitID) XXX_Unmarshal ¶
type CommitInfo ¶
type CommitInfo struct { Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` StoreInfos []StoreInfo `protobuf:"bytes,2,rep,name=store_infos,json=storeInfos,proto3" json:"store_infos"` }
CommitInfo defines commit information used by the multi-store when committing a version/height.
func (*CommitInfo) Descriptor ¶
func (*CommitInfo) Descriptor() ([]byte, []int)
func (*CommitInfo) GetStoreInfos ¶
func (m *CommitInfo) GetStoreInfos() []StoreInfo
func (*CommitInfo) GetVersion ¶
func (m *CommitInfo) GetVersion() int64
func (*CommitInfo) Marshal ¶
func (m *CommitInfo) Marshal() (dAtA []byte, err error)
func (*CommitInfo) MarshalToSizedBuffer ¶
func (m *CommitInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*CommitInfo) ProtoMessage ¶
func (*CommitInfo) ProtoMessage()
func (*CommitInfo) Reset ¶
func (m *CommitInfo) Reset()
func (*CommitInfo) Size ¶
func (m *CommitInfo) Size() (n int)
func (*CommitInfo) String ¶
func (m *CommitInfo) String() string
func (*CommitInfo) Unmarshal ¶
func (m *CommitInfo) Unmarshal(dAtA []byte) error
func (*CommitInfo) XXX_DiscardUnknown ¶
func (m *CommitInfo) XXX_DiscardUnknown()
func (*CommitInfo) XXX_Marshal ¶
func (m *CommitInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CommitInfo) XXX_Merge ¶
func (m *CommitInfo) XXX_Merge(src proto.Message)
func (*CommitInfo) XXX_Size ¶
func (m *CommitInfo) XXX_Size() int
func (*CommitInfo) XXX_Unmarshal ¶
func (m *CommitInfo) XXX_Unmarshal(b []byte) error
type CommitKVStore ¶
CommitKVStore is an interface for MultiStore.
type CommitMultiStore ¶
type CommitMultiStore interface { Committer MultiStore snapshottypes.Snapshotter // 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 // LoadLatestVersionAndUpgrade will load the latest version, but also // rename/delete/create sub-store keys, before registering all the keys // in order to handle breaking formats in migrations LoadLatestVersionAndUpgrade(upgrades *StoreUpgrades) error // LoadVersionAndUpgrade will load the named version, but also // rename/delete/create sub-store keys, before registering all the keys // in order to handle breaking formats in migrations LoadVersionAndUpgrade(ver int64, upgrades *StoreUpgrades) 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 // Set an inter-block (persistent) cache that maintains a mapping from // StoreKeys to CommitKVStores. SetInterBlockCache(MultiStorePersistentCache) // SetInitialVersion sets the initial version of the IAVL tree. It is used when // starting a new chain at an arbitrary height. SetInitialVersion(version int64) error }
CommitMultiStore is an interface for a MultiStore without cache capabilities.
type CommitStore ¶
Stores of MultiStore must implement CommitStore.
type Committer ¶
type Committer interface { Commit() CommitID LastCommitID() CommitID SetPruning(PruningOptions) GetPruning() PruningOptions }
something that can persist to disk
type ErrorGasOverflow ¶
type ErrorGasOverflow struct {
Descriptor string
}
ErrorGasOverflow defines an error thrown when an action results gas consumption unsigned integer overflow.
type ErrorNegativeGasConsumed ¶
type ErrorNegativeGasConsumed struct {
Descriptor string
}
ErrorNegativeGasConsumed defines an error thrown when the amount of gas refunded results in a negative gas consumed amount.
type ErrorOutOfGas ¶
type ErrorOutOfGas struct {
Descriptor string
}
ErrorOutOfGas defines an error thrown when an action results in out of gas.
type GasConfig ¶
type GasConfig struct { HasCost Gas DeleteCost Gas ReadCostFlat Gas ReadCostPerByte Gas WriteCostFlat Gas WriteCostPerByte Gas IterNextCostFlat Gas }
GasConfig defines gas cost for each operation on KVStores
func KVGasConfig ¶
func KVGasConfig() GasConfig
KVGasConfig returns a default gas config for KVStores.
func TransientGasConfig ¶
func TransientGasConfig() GasConfig
TransientGasConfig returns a default gas config for TransientStores.
type GasMeter ¶
type GasMeter interface { GasConsumed() Gas GasConsumedToLimit() Gas Limit() Gas ConsumeGas(amount Gas, descriptor string) RefundGas(amount Gas, descriptor string) IsPastLimit() bool IsOutOfGas() bool String() string }
GasMeter interface to track gas consumption
func NewGasMeter ¶
NewGasMeter returns a reference to a new basicGasMeter.
func NewInfiniteGasMeter ¶
func NewInfiniteGasMeter() GasMeter
NewInfiniteGasMeter returns a reference to a new infiniteGasMeter.
type Iterator ¶
Iterator is an alias db's Iterator for convenience.
func KVStorePrefixIterator ¶
Iterator over all the keys with a certain prefix in ascending order
func KVStorePrefixIteratorPaginated ¶
KVStorePrefixIteratorPaginated returns iterator over items in the selected page. Items iterated and skipped 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 or value. 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. // Exceptionally allowed for cachekv.Store, safe to write in the modules. Iterator(start, end []byte) Iterator // Iterator over a domain of keys in descending order. End is exclusive. // Start must be less 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. // Exceptionally allowed for cachekv.Store, safe to write in the modules. ReverseIterator(start, end []byte) Iterator }
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 MemoryStoreKey ¶
type MemoryStoreKey struct {
// contains filtered or unexported fields
}
MemoryStoreKey defines a typed key to be used with an in-memory KVStore.
func NewMemoryStoreKey ¶
func NewMemoryStoreKey(name string) *MemoryStoreKey
func (*MemoryStoreKey) Name ¶
func (key *MemoryStoreKey) Name() string
Name returns the name of the MemoryStoreKey.
func (*MemoryStoreKey) String ¶
func (key *MemoryStoreKey) String() string
String returns a stringified representation of the MemoryStoreKey.
type MultiStore ¶
type MultiStore interface { Store // Branches MultiStore into a cached storage object. // NOTE: Caller should probably not call .Write() on each, but // call CacheMultiStore.Write(). CacheMultiStore() CacheMultiStore // CacheMultiStoreWithVersion branches the underlying MultiStore where // each stored is loaded at a specific version (height). CacheMultiStoreWithVersion(version int64) (CacheMultiStore, error) // Convenience for fetching substores. // If the store does not exist, panics. GetStore(StoreKey) Store GetKVStore(StoreKey) KVStore // TracingEnabled returns if tracing is enabled for the MultiStore. TracingEnabled() bool // SetTracer sets the tracer for the MultiStore that the underlying // stores will utilize to trace operations. The modified MultiStore is // returned. SetTracer(w io.Writer) MultiStore // SetTracingContext sets the tracing context for a MultiStore. It is // implied that the caller should update the context when necessary between // tracing operations. The modified MultiStore is returned. SetTracingContext(TraceContext) MultiStore // ListeningEnabled returns if listening is enabled for the KVStore belonging the provided StoreKey ListeningEnabled(key StoreKey) bool // AddListeners adds WriteListeners for the KVStore belonging to the provided StoreKey // It appends the listeners to a current set, if one already exists AddListeners(key StoreKey, listeners []WriteListener) }
type MultiStorePersistentCache ¶
type MultiStorePersistentCache interface { // Wrap and return the provided CommitKVStore with an inter-block (persistent) // cache. GetStoreCache(key StoreKey, store CommitKVStore) CommitKVStore // Return the underlying CommitKVStore for a StoreKey. Unwrap(key StoreKey) CommitKVStore // Reset the entire set of internal caches. Reset() }
MultiStorePersistentCache defines an interface which provides inter-block (persistent) caching capabilities for multiple CommitKVStores based on StoreKeys.
type PaginatedIterator ¶
type PaginatedIterator struct { Iterator // contains filtered or unexported fields }
PaginatedIterator is a wrapper around Iterator that iterates over values starting for given page and limit.
func (*PaginatedIterator) Next ¶
func (pi *PaginatedIterator) Next()
Next will panic after limit is reached.
func (*PaginatedIterator) Valid ¶
func (pi *PaginatedIterator) Valid() bool
Valid if below limit and underlying iterator is valid.
type PruningOptions ¶
type PruningOptions struct { // KeepRecent defines how many recent heights to keep on disk. KeepRecent uint64 // KeepEvery defines how many offset heights are kept on disk past KeepRecent. KeepEvery uint64 // Interval defines when the pruned heights are removed from disk. Interval uint64 }
PruningOptions defines the pruning strategy used when determining which heights are removed from disk when committing state.
func NewPruningOptions ¶
func NewPruningOptions(keepRecent, keepEvery, interval uint64) PruningOptions
func NewPruningOptionsFromString ¶
func NewPruningOptionsFromString(strategy string) PruningOptions
func (PruningOptions) Validate ¶
func (po PruningOptions) Validate() error
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 SnapshotIAVLItem ¶
type SnapshotIAVLItem struct { Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` Version int64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` Height int32 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"` }
SnapshotIAVLItem is an exported IAVL node.
func (*SnapshotIAVLItem) Descriptor ¶
func (*SnapshotIAVLItem) Descriptor() ([]byte, []int)
func (*SnapshotIAVLItem) GetHeight ¶
func (m *SnapshotIAVLItem) GetHeight() int32
func (*SnapshotIAVLItem) GetKey ¶
func (m *SnapshotIAVLItem) GetKey() []byte
func (*SnapshotIAVLItem) GetValue ¶
func (m *SnapshotIAVLItem) GetValue() []byte
func (*SnapshotIAVLItem) GetVersion ¶
func (m *SnapshotIAVLItem) GetVersion() int64
func (*SnapshotIAVLItem) Marshal ¶
func (m *SnapshotIAVLItem) Marshal() (dAtA []byte, err error)
func (*SnapshotIAVLItem) MarshalToSizedBuffer ¶
func (m *SnapshotIAVLItem) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*SnapshotIAVLItem) ProtoMessage ¶
func (*SnapshotIAVLItem) ProtoMessage()
func (*SnapshotIAVLItem) Reset ¶
func (m *SnapshotIAVLItem) Reset()
func (*SnapshotIAVLItem) Size ¶
func (m *SnapshotIAVLItem) Size() (n int)
func (*SnapshotIAVLItem) String ¶
func (m *SnapshotIAVLItem) String() string
func (*SnapshotIAVLItem) Unmarshal ¶
func (m *SnapshotIAVLItem) Unmarshal(dAtA []byte) error
func (*SnapshotIAVLItem) XXX_DiscardUnknown ¶
func (m *SnapshotIAVLItem) XXX_DiscardUnknown()
func (*SnapshotIAVLItem) XXX_Marshal ¶
func (m *SnapshotIAVLItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SnapshotIAVLItem) XXX_Merge ¶
func (m *SnapshotIAVLItem) XXX_Merge(src proto.Message)
func (*SnapshotIAVLItem) XXX_Size ¶
func (m *SnapshotIAVLItem) XXX_Size() int
func (*SnapshotIAVLItem) XXX_Unmarshal ¶
func (m *SnapshotIAVLItem) XXX_Unmarshal(b []byte) error
type SnapshotItem ¶
type SnapshotItem struct { // item is the specific type of snapshot item. // // Types that are valid to be assigned to Item: // *SnapshotItem_Store // *SnapshotItem_IAVL Item isSnapshotItem_Item `protobuf_oneof:"item"` }
SnapshotItem is an item contained in a rootmulti.Store snapshot.
func (*SnapshotItem) Descriptor ¶
func (*SnapshotItem) Descriptor() ([]byte, []int)
func (*SnapshotItem) GetIAVL ¶
func (m *SnapshotItem) GetIAVL() *SnapshotIAVLItem
func (*SnapshotItem) GetItem ¶
func (m *SnapshotItem) GetItem() isSnapshotItem_Item
func (*SnapshotItem) GetStore ¶
func (m *SnapshotItem) GetStore() *SnapshotStoreItem
func (*SnapshotItem) Marshal ¶
func (m *SnapshotItem) Marshal() (dAtA []byte, err error)
func (*SnapshotItem) MarshalToSizedBuffer ¶
func (m *SnapshotItem) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*SnapshotItem) ProtoMessage ¶
func (*SnapshotItem) ProtoMessage()
func (*SnapshotItem) Reset ¶
func (m *SnapshotItem) Reset()
func (*SnapshotItem) Size ¶
func (m *SnapshotItem) Size() (n int)
func (*SnapshotItem) String ¶
func (m *SnapshotItem) String() string
func (*SnapshotItem) Unmarshal ¶
func (m *SnapshotItem) Unmarshal(dAtA []byte) error
func (*SnapshotItem) XXX_DiscardUnknown ¶
func (m *SnapshotItem) XXX_DiscardUnknown()
func (*SnapshotItem) XXX_Marshal ¶
func (m *SnapshotItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SnapshotItem) XXX_Merge ¶
func (m *SnapshotItem) XXX_Merge(src proto.Message)
func (*SnapshotItem) XXX_OneofWrappers ¶
func (*SnapshotItem) XXX_OneofWrappers() []interface{}
XXX_OneofWrappers is for the internal use of the proto package.
func (*SnapshotItem) XXX_Size ¶
func (m *SnapshotItem) XXX_Size() int
func (*SnapshotItem) XXX_Unmarshal ¶
func (m *SnapshotItem) XXX_Unmarshal(b []byte) error
type SnapshotItem_IAVL ¶
type SnapshotItem_IAVL struct {
IAVL *SnapshotIAVLItem `protobuf:"bytes,2,opt,name=iavl,proto3,oneof" json:"iavl,omitempty"`
}
func (*SnapshotItem_IAVL) MarshalTo ¶
func (m *SnapshotItem_IAVL) MarshalTo(dAtA []byte) (int, error)
func (*SnapshotItem_IAVL) MarshalToSizedBuffer ¶
func (m *SnapshotItem_IAVL) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*SnapshotItem_IAVL) Size ¶
func (m *SnapshotItem_IAVL) Size() (n int)
type SnapshotItem_Store ¶
type SnapshotItem_Store struct {
Store *SnapshotStoreItem `protobuf:"bytes,1,opt,name=store,proto3,oneof" json:"store,omitempty"`
}
func (*SnapshotItem_Store) MarshalTo ¶
func (m *SnapshotItem_Store) MarshalTo(dAtA []byte) (int, error)
func (*SnapshotItem_Store) MarshalToSizedBuffer ¶
func (m *SnapshotItem_Store) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*SnapshotItem_Store) Size ¶
func (m *SnapshotItem_Store) Size() (n int)
type SnapshotStoreItem ¶
type SnapshotStoreItem struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
}
SnapshotStoreItem contains metadata about a snapshotted store.
func (*SnapshotStoreItem) Descriptor ¶
func (*SnapshotStoreItem) Descriptor() ([]byte, []int)
func (*SnapshotStoreItem) GetName ¶
func (m *SnapshotStoreItem) GetName() string
func (*SnapshotStoreItem) Marshal ¶
func (m *SnapshotStoreItem) Marshal() (dAtA []byte, err error)
func (*SnapshotStoreItem) MarshalTo ¶
func (m *SnapshotStoreItem) MarshalTo(dAtA []byte) (int, error)
func (*SnapshotStoreItem) MarshalToSizedBuffer ¶
func (m *SnapshotStoreItem) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*SnapshotStoreItem) ProtoMessage ¶
func (*SnapshotStoreItem) ProtoMessage()
func (*SnapshotStoreItem) Reset ¶
func (m *SnapshotStoreItem) Reset()
func (*SnapshotStoreItem) Size ¶
func (m *SnapshotStoreItem) Size() (n int)
func (*SnapshotStoreItem) String ¶
func (m *SnapshotStoreItem) String() string
func (*SnapshotStoreItem) Unmarshal ¶
func (m *SnapshotStoreItem) Unmarshal(dAtA []byte) error
func (*SnapshotStoreItem) XXX_DiscardUnknown ¶
func (m *SnapshotStoreItem) XXX_DiscardUnknown()
func (*SnapshotStoreItem) XXX_Marshal ¶
func (m *SnapshotStoreItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SnapshotStoreItem) XXX_Merge ¶
func (m *SnapshotStoreItem) XXX_Merge(src proto.Message)
func (*SnapshotStoreItem) XXX_Size ¶
func (m *SnapshotStoreItem) XXX_Size() int
func (*SnapshotStoreItem) XXX_Unmarshal ¶
func (m *SnapshotStoreItem) XXX_Unmarshal(b []byte) error
type Store ¶
type Store interface { GetStoreType() StoreType CacheWrapper }
type StoreInfo ¶
type StoreInfo struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` CommitId CommitID `protobuf:"bytes,2,opt,name=commit_id,json=commitId,proto3" json:"commit_id"` }
StoreInfo defines store-specific commit information. It contains a reference between a store name and the commit ID.
func (*StoreInfo) Descriptor ¶
func (*StoreInfo) GetCommitId ¶
func (*StoreInfo) MarshalToSizedBuffer ¶
func (*StoreInfo) ProtoMessage ¶
func (*StoreInfo) ProtoMessage()
func (*StoreInfo) XXX_DiscardUnknown ¶
func (m *StoreInfo) XXX_DiscardUnknown()
func (*StoreInfo) XXX_Marshal ¶
func (*StoreInfo) XXX_Unmarshal ¶
type StoreKVPair ¶
type StoreKVPair struct { StoreKey string `protobuf:"bytes,1,opt,name=store_key,json=storeKey,proto3" json:"store_key,omitempty"` Delete bool `protobuf:"varint,2,opt,name=delete,proto3" json:"delete,omitempty"` Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` }
StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and Deletes
func (*StoreKVPair) Descriptor ¶
func (*StoreKVPair) Descriptor() ([]byte, []int)
func (*StoreKVPair) GetDelete ¶
func (m *StoreKVPair) GetDelete() bool
func (*StoreKVPair) GetKey ¶
func (m *StoreKVPair) GetKey() []byte
func (*StoreKVPair) GetStoreKey ¶
func (m *StoreKVPair) GetStoreKey() string
func (*StoreKVPair) GetValue ¶
func (m *StoreKVPair) GetValue() []byte
func (*StoreKVPair) Marshal ¶
func (m *StoreKVPair) Marshal() (dAtA []byte, err error)
func (*StoreKVPair) MarshalToSizedBuffer ¶
func (m *StoreKVPair) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*StoreKVPair) ProtoMessage ¶
func (*StoreKVPair) ProtoMessage()
func (*StoreKVPair) Reset ¶
func (m *StoreKVPair) Reset()
func (*StoreKVPair) Size ¶
func (m *StoreKVPair) Size() (n int)
func (*StoreKVPair) String ¶
func (m *StoreKVPair) String() string
func (*StoreKVPair) Unmarshal ¶
func (m *StoreKVPair) Unmarshal(dAtA []byte) error
func (*StoreKVPair) XXX_DiscardUnknown ¶
func (m *StoreKVPair) XXX_DiscardUnknown()
func (*StoreKVPair) XXX_Marshal ¶
func (m *StoreKVPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*StoreKVPair) XXX_Merge ¶
func (m *StoreKVPair) XXX_Merge(src proto.Message)
func (*StoreKVPair) XXX_Size ¶
func (m *StoreKVPair) XXX_Size() int
func (*StoreKVPair) XXX_Unmarshal ¶
func (m *StoreKVPair) XXX_Unmarshal(b []byte) error
type StoreKVPairWriteListener ¶
type StoreKVPairWriteListener struct {
// contains filtered or unexported fields
}
StoreKVPairWriteListener is used to configure listening to a KVStore by writing out length-prefixed protobuf encoded StoreKVPairs to an underlying io.Writer
func NewStoreKVPairWriteListener ¶
func NewStoreKVPairWriteListener(w io.Writer, m codec.BinaryCodec) *StoreKVPairWriteListener
NewStoreKVPairWriteListener wraps creates a StoreKVPairWriteListener with a provdied io.Writer and codec.BinaryCodec
type StoreRename ¶
StoreRename defines a name change of a sub-store. All data previously under a PrefixStore with OldKey will be copied to a PrefixStore with NewKey, then deleted from OldKey store.
type StoreUpgrades ¶
type StoreUpgrades struct { Added []string `json:"added"` Renamed []StoreRename `json:"renamed"` Deleted []string `json:"deleted"` }
StoreUpgrades defines a series of transformations to apply the multistore db upon load
func (*StoreUpgrades) IsAdded ¶
func (s *StoreUpgrades) IsAdded(key string) bool
IsDeleted returns true if the given key should be added
func (*StoreUpgrades) IsDeleted ¶
func (s *StoreUpgrades) IsDeleted(key string) bool
IsDeleted returns true if the given key should be deleted
func (*StoreUpgrades) RenamedFrom ¶
func (s *StoreUpgrades) RenamedFrom(key string) string
RenamedFrom returns the oldKey if it was renamed Returns "" if it was not renamed
type StoreWithInitialVersion ¶
type StoreWithInitialVersion interface { // SetInitialVersion sets the initial version of the IAVL tree. It is used when // starting a new chain at an arbitrary height. SetInitialVersion(version int64) }
StoreWithInitialVersion is a store that can have an arbitrary initial version.
type TraceContext ¶
type TraceContext map[string]interface{}
TraceContext contains TraceKVStore context data. It will be written with every trace operation.
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
type UpgradeInfo ¶
UpgradeInfo defines height and name of the upgrade to ensure multistore upgrades happen only at matching height.
type WriteListener ¶
type WriteListener interface { // if value is nil then it was deleted // storeKey indicates the source KVStore, to facilitate using the the same WriteListener across separate KVStores // delete bool indicates if it was a delete; true: delete, false: set OnWrite(storeKey StoreKey, key []byte, value []byte, delete bool) error }
WriteListener interface for streaming data out from a listenkv.Store