types

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2024 License: Apache-2.0, Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

// Code generated by protoc-gen-gogo. DO NOT EDIT. // source: cosmos/base/store/v1beta1/commit_info.proto

Index

Constants

View Source
const (
	GasIterNextCostFlatDesc = "IterNextFlat"
	GasValuePerByteDesc     = "ValuePerByte"
	GasWritePerByteDesc     = "WritePerByte"
	GasReadPerByteDesc      = "ReadPerByte"
	GasWriteCostFlatDesc    = "WriteFlat"
	GasReadCostFlatDesc     = "ReadFlat"
	GasHasDesc              = "Has"
	GasDeleteDesc           = "Delete"
)

Gas consumption descriptors.

View Source
const (
	PruningOptionDefault    = "default"
	PruningOptionEverything = "everything"
	PruningOptionNothing    = "nothing"
	PruningOptionCustom     = "custom"
)

Pruning option string constants

View Source
const (
	ProofOpIAVLCommitment         = "ics23:iavl"
	ProofOpSimpleMerkleCommitment = "ics23:simple"
)
View Source
const (
	FlagLoadVersionAsync = "enable-store-load-async"
)
View Source
const StoreCodespace = "store"

Variables

View Source
var (
	ErrInvalidLengthCommitInfo        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCommitInfo          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCommitInfo = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthListening        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowListening          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupListening = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// PruneDefault defines a pruning strategy where the last 100 heights are kept
	// in addition to every 10000th and where to-be pruned heights are pruned at
	// every 10th height.
	PruneDefault = NewPruningOptions(100, 10000, 10, 200)

	// 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(5, 0, 10, 5)

	// PruneNothing defines a pruning strategy where all heights are kept on disk.
	PruneNothing = NewPruningOptions(0, 1, 0, 1<<64-1)
)
View Source
var (
	ErrInvalidLengthProof        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowProof          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupProof = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidProof = sdkerrors.Register(StoreCodespace, 2, "invalid proof")
)

Functions

func AsDefaultGasConfig added in v1.7.6

func AsDefaultGasConfig(gc *GasConfig)

func AssertValidKey

func AssertValidKey(key []byte)

Check if the key is valid(key is not nil)

func AssertValidValue

func AssertValidValue(value []byte)

Check if the value is valid(value is not nil)

func ClearMsRWSet added in v1.6.7

func ClearMsRWSet(m MsRWSet)

func CommitmentOpDecoder added in v1.3.0

func CommitmentOpDecoder(pop merkle.ProofOp) (merkle.ProofOperator, error)

CommitmentOpDecoder takes a merkle.ProofOp and attempts to decode it into a CommitmentOp ProofOperator The proofOp.Data is just a marshalled CommitmentProof. The Key of the CommitmentOp is extracted from the unmarshalled proof.

func Cp

func Cp(bz []byte) (ret []byte)

----------------------------------------

func DiffKVStores

func DiffKVStores(a KVStore, b KVStore, prefixesToSkip [][]byte) (kvAs, kvBs []tmkv.Pair)

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

func InclusiveEndBytes(inclusiveBytes []byte) []byte

InclusiveEndBytes returns the []byte that would end a range query such that the input would be included

func PrefixEndBytes

func PrefixEndBytes(prefix []byte) []byte

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 RevertSnapshotWSet added in v1.7.4

func RevertSnapshotWSet(store KVStore, set SnapshotWSet)

func UpdateGlobalGasConfig added in v1.7.6

func UpdateGlobalGasConfig(gc *GasConfig)

Types

type Analyser

type Analyser interface {
	GetDBReadTime() int
	GetDBWriteCount() int
	GetDBReadCount() int
	GetNodeReadCount() int
	GetFlatKVReadTime() int
	GetFlatKVWriteTime() int
	GetFlatKVReadCount() int
	GetFlatKVWriteCount() int
	ResetCount()
}

type CacheKVRWSet added in v1.6.7

type CacheKVRWSet struct {
	Read  map[string][]byte
	Write map[string]DirtyValue
}

func NewCacheKvRWSet added in v1.6.7

func NewCacheKvRWSet() CacheKVRWSet

type CacheKVStore

type CacheKVStore interface {
	KVStore
	CacheManager
	// Writes operations to underlying KVStore
	Write()
	WriteWithSnapshotWSet() SnapshotWSet
	RevertDBWithSnapshotRWSet(set SnapshotWSet)
}

CacheKVStore cache-wraps a KVStore. After calling .Write() on the CacheKVStore, all previously created CacheKVStores on the object expire.

type CacheManager

type CacheManager interface {
	IteratorCache(isdirty bool, cb func(key string, value []byte, isDirty bool, isDelete bool, storeKey StoreKey) bool, sKey StoreKey) bool
	// Clear the cache without writing
	Clear()
	DisableCacheReadList()
	GetRWSet(set MsRWSet)
}

type CacheMultiStore

type CacheMultiStore interface {
	MultiStore
	CacheManager
	Write() // Writes operations to underlying KVStore
	WriteGetMultiSnapshotWSet() MultiSnapshotWSet
	RevertDBWithMultiSnapshotRWSet(set MultiSnapshotWSet)
}

From MultiStore.CacheMultiStore()....

type CacheMultiStoreResetter added in v1.5.4

type CacheMultiStoreResetter interface {
	CacheMultiStore
	Reset(MultiStore) bool
}

type CacheWrap

type CacheWrap interface {
	CacheManager
	// Write syncs with the underlying store.
	Write()
	WriteWithSnapshotWSet() SnapshotWSet
	RevertDBWithSnapshotRWSet(set SnapshotWSet)

	// 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 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 added in v1.3.0

func (*CommitID) Descriptor() ([]byte, []int)

func (*CommitID) GetHash added in v1.3.0

func (m *CommitID) GetHash() []byte

func (*CommitID) GetVersion added in v1.3.0

func (m *CommitID) GetVersion() int64

func (CommitID) IsZero

func (cid CommitID) IsZero() bool

CommitID contains the tree version number and its merkle root.

func (*CommitID) Marshal added in v1.3.0

func (m *CommitID) Marshal() (dAtA []byte, err error)

func (*CommitID) MarshalTo added in v1.3.0

func (m *CommitID) MarshalTo(dAtA []byte) (int, error)

func (*CommitID) MarshalToSizedBuffer added in v1.3.0

func (m *CommitID) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CommitID) ProtoMessage added in v1.3.0

func (*CommitID) ProtoMessage()

func (*CommitID) Reset added in v1.3.0

func (m *CommitID) Reset()

func (*CommitID) Size added in v1.3.0

func (m *CommitID) Size() (n int)

func (CommitID) String

func (cid CommitID) String() string

func (*CommitID) Unmarshal added in v1.3.0

func (m *CommitID) Unmarshal(dAtA []byte) error

func (*CommitID) XXX_DiscardUnknown added in v1.3.0

func (m *CommitID) XXX_DiscardUnknown()

func (*CommitID) XXX_Marshal added in v1.3.0

func (m *CommitID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CommitID) XXX_Merge added in v1.3.0

func (m *CommitID) XXX_Merge(src proto.Message)

func (*CommitID) XXX_Size added in v1.3.0

func (m *CommitID) XXX_Size() int

func (*CommitID) XXX_Unmarshal added in v1.3.0

func (m *CommitID) XXX_Unmarshal(b []byte) error

type CommitInfo added in v1.3.0

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) CommitID added in v1.3.0

func (ci CommitInfo) CommitID() CommitID

func (*CommitInfo) Descriptor added in v1.3.0

func (*CommitInfo) Descriptor() ([]byte, []int)

func (*CommitInfo) GetStoreInfos added in v1.3.0

func (m *CommitInfo) GetStoreInfos() []StoreInfo

func (*CommitInfo) GetVersion added in v1.3.0

func (m *CommitInfo) GetVersion() int64

func (CommitInfo) Hash added in v1.3.0

func (ci CommitInfo) Hash() []byte

Hash returns the simple merkle root hash of the stores sorted by name.

func (*CommitInfo) Marshal added in v1.3.0

func (m *CommitInfo) Marshal() (dAtA []byte, err error)

func (*CommitInfo) MarshalTo added in v1.3.0

func (m *CommitInfo) MarshalTo(dAtA []byte) (int, error)

func (*CommitInfo) MarshalToSizedBuffer added in v1.3.0

func (m *CommitInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (CommitInfo) ProofOp added in v1.3.0

func (ci CommitInfo) ProofOp(storeName string) merkle.ProofOp

func (*CommitInfo) ProtoMessage added in v1.3.0

func (*CommitInfo) ProtoMessage()

func (*CommitInfo) Reset added in v1.3.0

func (m *CommitInfo) Reset()

func (*CommitInfo) Size added in v1.3.0

func (m *CommitInfo) Size() (n int)

func (*CommitInfo) String added in v1.3.0

func (m *CommitInfo) String() string

func (*CommitInfo) Unmarshal added in v1.3.0

func (m *CommitInfo) Unmarshal(dAtA []byte) error

func (*CommitInfo) XXX_DiscardUnknown added in v1.3.0

func (m *CommitInfo) XXX_DiscardUnknown()

func (*CommitInfo) XXX_Marshal added in v1.3.0

func (m *CommitInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CommitInfo) XXX_Merge added in v1.3.0

func (m *CommitInfo) XXX_Merge(src proto.Message)

func (*CommitInfo) XXX_Size added in v1.3.0

func (m *CommitInfo) XXX_Size() int

func (*CommitInfo) XXX_Unmarshal added in v1.3.0

func (m *CommitInfo) XXX_Unmarshal(b []byte) error

type CommitKVStore

type CommitKVStore interface {
	Committer
	KVStore
}

Stores of MultiStore must implement CommitStore.

type CommitMultiStore

type CommitMultiStore interface {
	Committer
	MultiStore
	CommitMultiStorePipeline
	CommitterCommitMap(iavl.TreeDeltaMap) (CommitID, iavl.TreeDeltaMap) // CommitterCommit

	// 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
	GetCommitVersion() (int64, error)

	// Set an inter-block (persistent) cache that maintains a mapping from
	// StoreKeys to CommitKVStores.
	SetInterBlockCache(MultiStorePersistentCache)

	StopStore()

	SetLogger(log log.Logger)
}

A non-cache MultiStore.

type CommitMultiStorePipeline added in v1.3.0

type CommitMultiStorePipeline interface {
	AppendVersionFilters(filters []VersionFilter)
	AppendCommitFilters(filters []StoreFilter)
	AppendPruneFilters(filters []StoreFilter)
}

type CommitStore

type CommitStore interface {
	Committer
	Store
}

Stores of MultiStore must implement CommitStore.

type CommitmentOp added in v1.3.0

type CommitmentOp struct {
	Type  string
	Spec  *ics23.ProofSpec
	Key   []byte
	Proof *ics23.CommitmentProof
}

CommitmentOp implements merkle.ProofOperator by wrapping an ics23 CommitmentProof It also contains a Key field to determine which key the proof is proving. NOTE: CommitmentProof currently can either be ExistenceProof or NonexistenceProof

Type and Spec are classified by the kind of merkle proof it represents allowing the code to be reused by more types. Spec is never on the wire, but mapped from type in the code.

func NewIavlCommitmentOp added in v1.3.0

func NewIavlCommitmentOp(key []byte, proof *ics23.CommitmentProof) CommitmentOp

func NewSimpleMerkleCommitmentOp added in v1.3.0

func NewSimpleMerkleCommitmentOp(key []byte, proof *ics23.CommitmentProof) CommitmentOp

func (CommitmentOp) GetKey added in v1.3.0

func (op CommitmentOp) GetKey() []byte

func (CommitmentOp) ProofOp added in v1.3.0

func (op CommitmentOp) ProofOp() merkle.ProofOp

ProofOp implements ProofOperator interface and converts a CommitmentOp into a merkle.ProofOp format that can later be decoded by CommitmentOpDecoder back into a CommitmentOp for proof verification

func (CommitmentOp) Run added in v1.3.0

func (op CommitmentOp) Run(args [][]byte) ([][]byte, error)

Run takes in a list of arguments and attempts to run the proof op against these arguments Returns the root wrapped in [][]byte if the proof op succeeds with given args. If not, it will return an error.

CommitmentOp will accept args of length 1 or length 0 If length 1 args is passed in, then CommitmentOp will attempt to prove the existence of the key with the value provided by args[0] using the embedded CommitmentProof and return the CommitmentRoot of the proof If length 0 args is passed in, then CommitmentOp will attempt to prove the absence of the key in the CommitmentOp and return the CommitmentRoot of the proof

type Committer

type Committer interface {
	CommitterCommit(*iavl.TreeDelta) (CommitID, *iavl.TreeDelta) // CommitterCommit
	//for add module to init store version eg:ibc/erc20/capabilty module
	SetUpgradeVersion(int64)

	LastCommitID() CommitID
	LastCommitVersion() int64

	// TODO: Deprecate after 0.38.5
	SetPruning(PruningOptions)
	Analyser
}

something that can persist to disk

type DirtyValue added in v1.6.7

type DirtyValue struct {
	Deleted bool
	Value   []byte
}

type ErrorGasOverflow

type ErrorGasOverflow struct {
	Descriptor string
}

ErrorGasOverflow defines an error thrown when an action results gas consumption unsigned integer overflow.

type ErrorOutOfGas

type ErrorOutOfGas struct {
	Descriptor string
}

ErrorOutOfGas defines an error thrown when an action results in out of gas.

type Gas

type Gas = uint64

Gas measured by the SDK

type GasConfig

type GasConfig struct {
	HasCost          Gas `json:"hasCost"`
	DeleteCost       Gas `json:"deleteCost"`
	ReadCostFlat     Gas `json:"readCostFlat"`
	ReadCostPerByte  Gas `json:"readCostPerByte"`
	WriteCostFlat    Gas `json:"writeCostFlat"`
	WriteCostPerByte Gas `json:"writeCostPerByte"`
	IterNextCostFlat Gas `json:"iterNextCostFlat"`
}

GasConfig defines gas cost for each operation on KVStores

func GetDefaultGasConfig added in v1.7.6

func GetDefaultGasConfig() *GasConfig

func GetGlobalGasConfig added in v1.7.6

func GetGlobalGasConfig() GasConfig

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)
	SetGas(val Gas)
	IsPastLimit() bool
	IsOutOfGas() bool
}

GasMeter interface to track gas consumption

func NewGasMeter

func NewGasMeter(limit Gas) GasMeter

NewGasMeter returns a reference to a new basicGasMeter.

func NewInfiniteGasMeter

func NewInfiniteGasMeter() GasMeter

NewInfiniteGasMeter returns a reference to a new infiniteGasMeter.

type Iterator

type Iterator = dbm.Iterator

Alias iterator to db's Iterator for convenience.

func KVStorePrefixIterator

func KVStorePrefixIterator(kvs KVStore, prefix []byte) Iterator

Iterator over all the keys with a certain prefix in ascending order

func KVStorePrefixIteratorPaginated

func KVStorePrefixIteratorPaginated(kvs KVStore, prefix []byte, page, limit uint) Iterator

KVStorePrefixIteratorPaginated returns iterator over items in the selected page. Items iterated and skipped in ascending order.

func KVStoreReversePrefixIterator

func KVStoreReversePrefixIterator(kvs KVStore, prefix []byte) Iterator

Iterator over all the keys with a certain prefix in descending order.

func KVStoreReversePrefixIteratorPaginated

func KVStoreReversePrefixIteratorPaginated(kvs KVStore, prefix []byte, page, limit uint) Iterator

KVStoreReversePrefixIteratorPaginated returns iterator over items in the selected page. Items iterated and skipped in descending order.

type KVPair

type KVPair tmkv.Pair

key-value result for iterator queries

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 added in v1.3.0

type MemoryStoreKey struct {
	// contains filtered or unexported fields
}

MemoryStoreKey defines a typed key to be used with an in-memory KVStore.

func NewMemoryStoreKey added in v1.3.0

func NewMemoryStoreKey(name string) *MemoryStoreKey

func (*MemoryStoreKey) Name added in v1.3.0

func (key *MemoryStoreKey) Name() string

Name returns the name of the MemoryStoreKey.

func (*MemoryStoreKey) String added in v1.3.0

func (key *MemoryStoreKey) String() string

String returns a stringified representation of the MemoryStoreKey.

type MsRWSet added in v1.6.7

type MsRWSet = map[StoreKey]CacheKVRWSet

type MultiSnapshotWSet added in v1.7.4

type MultiSnapshotWSet struct {
	Root   SnapshotWSet
	Stores map[StoreKey]SnapshotWSet
}

func NewMultiSnapshotWSet added in v1.7.4

func NewMultiSnapshotWSet() MultiSnapshotWSet

type MultiStore

type MultiStore interface {
	Store

	// Cache wrap MultiStore.
	// NOTE: Caller should probably not call .Write() on each, but
	// call CacheMultiStore.Write().
	CacheMultiStore() CacheMultiStore

	// CacheMultiStoreWithVersion cache-wraps 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
}

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

	// MaxRetainNum defines how many historic states to keep on disk.
	MaxRetainNum 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, maxRetainNum 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 ReusableGasMeter added in v1.6.2

type ReusableGasMeter interface {
	GasMeter
	Reset()
}

func NewReusableInfiniteGasMeter added in v1.6.2

func NewReusableInfiniteGasMeter() ReusableGasMeter

type RevertWriteChange added in v1.7.4

type RevertWriteChange struct {
	PrevValue []byte
}

value == nil, add new key value != nil, update or delete key

type SnapshotWSet added in v1.7.4

type SnapshotWSet struct {
	Write map[string]RevertWriteChange
}

func NewSnapShotWSet added in v1.7.4

func NewSnapShotWSet() SnapshotWSet

type Store

type Store interface {
	GetStoreType() StoreType
	CacheWrapper
}

type StoreFilter added in v1.3.0

type StoreFilter func(module string, h int64, store CommitKVStore) bool

type StoreInfo added in v1.3.0

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 added in v1.3.0

func (*StoreInfo) Descriptor() ([]byte, []int)

func (*StoreInfo) GetCommitId added in v1.3.0

func (m *StoreInfo) GetCommitId() CommitID

func (StoreInfo) GetHash added in v1.3.0

func (si StoreInfo) GetHash() []byte

GetHash returns the GetHash from the CommitID. This is used in CommitInfo.Hash()

When we commit to this in a merkle proof, we create a map of storeInfo.Name -> storeInfo.GetHash() and build a merkle proof from that. This is then chained with the substore proof, so we prove the root hash from the substore before this and need to pass that (unmodified) as the leaf value of the multistore proof.

func (*StoreInfo) GetName added in v1.3.0

func (m *StoreInfo) GetName() string

func (*StoreInfo) Marshal added in v1.3.0

func (m *StoreInfo) Marshal() (dAtA []byte, err error)

func (*StoreInfo) MarshalTo added in v1.3.0

func (m *StoreInfo) MarshalTo(dAtA []byte) (int, error)

func (*StoreInfo) MarshalToSizedBuffer added in v1.3.0

func (m *StoreInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*StoreInfo) ProtoMessage added in v1.3.0

func (*StoreInfo) ProtoMessage()

func (*StoreInfo) Reset added in v1.3.0

func (m *StoreInfo) Reset()

func (*StoreInfo) Size added in v1.3.0

func (m *StoreInfo) Size() (n int)

func (*StoreInfo) String added in v1.3.0

func (m *StoreInfo) String() string

func (*StoreInfo) Unmarshal added in v1.3.0

func (m *StoreInfo) Unmarshal(dAtA []byte) error

func (*StoreInfo) XXX_DiscardUnknown added in v1.3.0

func (m *StoreInfo) XXX_DiscardUnknown()

func (*StoreInfo) XXX_Marshal added in v1.3.0

func (m *StoreInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StoreInfo) XXX_Merge added in v1.3.0

func (m *StoreInfo) XXX_Merge(src proto.Message)

func (*StoreInfo) XXX_Size added in v1.3.0

func (m *StoreInfo) XXX_Size() int

func (*StoreInfo) XXX_Unmarshal added in v1.3.0

func (m *StoreInfo) XXX_Unmarshal(b []byte) error

type StoreKVPair added in v1.3.0

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

Since: cosmos-sdk 0.43

func (*StoreKVPair) Descriptor added in v1.3.0

func (*StoreKVPair) Descriptor() ([]byte, []int)

func (*StoreKVPair) GetDelete added in v1.3.0

func (m *StoreKVPair) GetDelete() bool

func (*StoreKVPair) GetKey added in v1.3.0

func (m *StoreKVPair) GetKey() []byte

func (*StoreKVPair) GetStoreKey added in v1.3.0

func (m *StoreKVPair) GetStoreKey() string

func (*StoreKVPair) GetValue added in v1.3.0

func (m *StoreKVPair) GetValue() []byte

func (*StoreKVPair) Marshal added in v1.3.0

func (m *StoreKVPair) Marshal() (dAtA []byte, err error)

func (*StoreKVPair) MarshalTo added in v1.3.0

func (m *StoreKVPair) MarshalTo(dAtA []byte) (int, error)

func (*StoreKVPair) MarshalToSizedBuffer added in v1.3.0

func (m *StoreKVPair) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*StoreKVPair) ProtoMessage added in v1.3.0

func (*StoreKVPair) ProtoMessage()

func (*StoreKVPair) Reset added in v1.3.0

func (m *StoreKVPair) Reset()

func (*StoreKVPair) Size added in v1.3.0

func (m *StoreKVPair) Size() (n int)

func (*StoreKVPair) String added in v1.3.0

func (m *StoreKVPair) String() string

func (*StoreKVPair) Unmarshal added in v1.3.0

func (m *StoreKVPair) Unmarshal(dAtA []byte) error

func (*StoreKVPair) XXX_DiscardUnknown added in v1.3.0

func (m *StoreKVPair) XXX_DiscardUnknown()

func (*StoreKVPair) XXX_Marshal added in v1.3.0

func (m *StoreKVPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StoreKVPair) XXX_Merge added in v1.3.0

func (m *StoreKVPair) XXX_Merge(src proto.Message)

func (*StoreKVPair) XXX_Size added in v1.3.0

func (m *StoreKVPair) XXX_Size() int

func (*StoreKVPair) XXX_Unmarshal added in v1.3.0

func (m *StoreKVPair) XXX_Unmarshal(b []byte) error

type StoreKVPairWriteListener added in v1.3.0

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 added in v1.3.0

func NewStoreKVPairWriteListener(w io.Writer, m *codec.CodecProxy) *StoreKVPairWriteListener

NewStoreKVPairWriteListener wraps creates a StoreKVPairWriteListener with a provdied io.Writer and codec.BinaryCodec

func (*StoreKVPairWriteListener) OnWrite added in v1.3.0

func (wl *StoreKVPairWriteListener) OnWrite(storeKey StoreKey, key []byte, value []byte, delete bool) error

OnWrite satisfies the WriteListener interface by writing length-prefixed protobuf encoded StoreKVPairs

type StoreKey

type StoreKey interface {
	Name() string
	String() string
}

StoreKey is a key used to index stores in a MultiStore.

type StoreRename

type StoreRename struct {
	OldKey string `json:"old_key"`
	NewKey string `json:"new_key"`
}

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 StoreType

type StoreType int

kind of store

const (
	//nolint
	StoreTypeMulti StoreType = iota
	StoreTypeDB
	StoreTypeIAVL
	StoreTypeTransient
	StoreTypeMPT
	StoreTypeMemory
)

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

IsAdded 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 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) Name

func (key *TransientStoreKey) Name() string

Implements StoreKey

func (*TransientStoreKey) String

func (key *TransientStoreKey) String() string

Implements StoreKey

type VersionCallback added in v1.5.0

type VersionCallback = func(name string, version int64)

type VersionFilter added in v1.3.0

type VersionFilter func(h int64) func(callback VersionCallback)

type WriteListener added in v1.3.0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL