Documentation ¶
Index ¶
- Constants
- Variables
- func AssertValidKey(key []byte)
- func AssertValidValue(value []byte)
- func BigEndianToUint64(bz []byte) uint64
- func CommitmentOpDecoder(pop tmmerkle.ProofOp) (merkle.ProofOperator, error)
- func InclusiveEndBytes(inclusiveBytes []byte) []byte
- func NewKVStoreKeys(names ...string) map[string]*KVStoreKey
- func NewMemoryStoreKeys(names ...string) map[string]*MemoryStoreKey
- func NewTransientStoreKeys(names ...string) map[string]*TransientStoreKey
- func PrefixEndBytes(prefix []byte) []byte
- func ProofOpFromMap(cmap map[string][]byte, storeName string) (ret tmmerkle.ProofOp, err error)
- func QueryResult(err error, debug bool) abci.ResponseQuery
- func SliceContains[T comparable](elements []T, v T) bool
- func Uint64ToBigEndian(i uint64) []byte
- type ABCIListener
- type BasicKVStore
- type BlockMetadata
- func (*BlockMetadata) Descriptor() ([]byte, []int)
- func (m *BlockMetadata) GetDeliverTxs() []*BlockMetadata_DeliverTx
- func (m *BlockMetadata) GetRequestBeginBlock() *types.RequestBeginBlock
- func (m *BlockMetadata) GetRequestEndBlock() *types.RequestEndBlock
- func (m *BlockMetadata) GetResponseBeginBlock() *types.ResponseBeginBlock
- func (m *BlockMetadata) GetResponseCommit() *types.ResponseCommit
- func (m *BlockMetadata) GetResponseEndBlock() *types.ResponseEndBlock
- func (m *BlockMetadata) Marshal() (dAtA []byte, err error)
- func (m *BlockMetadata) MarshalTo(dAtA []byte) (int, error)
- func (m *BlockMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*BlockMetadata) ProtoMessage()
- func (m *BlockMetadata) Reset()
- func (m *BlockMetadata) Size() (n int)
- func (m *BlockMetadata) String() string
- func (m *BlockMetadata) Unmarshal(dAtA []byte) error
- func (m *BlockMetadata) XXX_DiscardUnknown()
- func (m *BlockMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *BlockMetadata) XXX_Merge(src proto.Message)
- func (m *BlockMetadata) XXX_Size() int
- func (m *BlockMetadata) XXX_Unmarshal(b []byte) error
- type BlockMetadata_DeliverTx
- func (*BlockMetadata_DeliverTx) Descriptor() ([]byte, []int)
- func (m *BlockMetadata_DeliverTx) GetRequest() *types.RequestDeliverTx
- func (m *BlockMetadata_DeliverTx) GetResponse() *types.ResponseDeliverTx
- func (m *BlockMetadata_DeliverTx) Marshal() (dAtA []byte, err error)
- func (m *BlockMetadata_DeliverTx) MarshalTo(dAtA []byte) (int, error)
- func (m *BlockMetadata_DeliverTx) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*BlockMetadata_DeliverTx) ProtoMessage()
- func (m *BlockMetadata_DeliverTx) Reset()
- func (m *BlockMetadata_DeliverTx) Size() (n int)
- func (m *BlockMetadata_DeliverTx) String() string
- func (m *BlockMetadata_DeliverTx) Unmarshal(dAtA []byte) error
- func (m *BlockMetadata_DeliverTx) XXX_DiscardUnknown()
- func (m *BlockMetadata_DeliverTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *BlockMetadata_DeliverTx) XXX_Merge(src proto.Message)
- func (m *BlockMetadata_DeliverTx) XXX_Size() int
- func (m *BlockMetadata_DeliverTx) XXX_Unmarshal(b []byte) error
- type CacheKVStore
- type CacheMultiStore
- type CacheWrap
- type CacheWrapper
- type CapabilityKey
- type Codec
- 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 (ci CommitInfo) CommitID() CommitID
- func (*CommitInfo) Descriptor() ([]byte, []int)
- func (m *CommitInfo) GetStoreInfos() []StoreInfo
- func (m *CommitInfo) GetVersion() int64
- func (ci CommitInfo) Hash() []byte
- 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 (ci CommitInfo) ProofOp(storeName string) tmcrypto.ProofOp
- 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 CommitmentOp
- 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 KVStore
- type KVStoreKey
- type MemoryListener
- type MemoryStoreKey
- type MultiStore
- type MultiStorePersistentCache
- type PaginatedIterator
- type Queryable
- type Store
- type StoreInfo
- func (*StoreInfo) Descriptor() ([]byte, []int)
- func (m *StoreInfo) GetCommitId() CommitID
- func (si StoreInfo) GetHash() []byte
- 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 StreamingService
- type TestCodec
- type TraceContext
- type TransientStoreKey
- type WriteListener
Constants ¶
const ( GasIterNextCostFlatDesc = "IterNextFlat" GasValuePerByteDesc = "ValuePerByte" GasWritePerByteDesc = "WritePerByte" GasReadPerByteDesc = "ReadPerByte" GasWriteCostFlatDesc = "WriteFlat" GasReadCostFlatDesc = "ReadFlat" GasHasDesc = "Has" GasDeleteDesc = "Delete" )
Gas consumption descriptors.
const ( ProofOpIAVLCommitment = "ics23:iavl" ProofOpSimpleMerkleCommitment = "ics23:simple" ProofOpSMTCommitment = "ics23:smt" )
const StoreCodespace = "store"
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 ( // ErrInvalidProof is returned when a proof is invalid ErrInvalidProof = errors.Register(StoreCodespace, 2, "invalid proof") // ErrTxDecode is returned if we cannot parse a transaction ErrTxDecode = errors.Register(StoreCodespace, 3, "tx parse error") // ErrUnknownRequest to doc ErrUnknownRequest = errors.Register(StoreCodespace, 4, "unknown request") // ErrLogic defines an internal logic error, e.g. an invariant or assertion // that is violated. It is a programmer error, not a user-facing error. ErrLogic = errors.Register(StoreCodespace, 5, "internal logic error") // ErrConflict defines a conflict error, e.g. when two goroutines try to access // the same resource and one of them fails. ErrConflict = errors.Register(StoreCodespace, 6, "conflict") // ErrInvalidRequest defines an ABCI typed error where the request contains // invalid data. ErrInvalidRequest = errors.Register(StoreCodespace, 7, "invalid request") )
Functions ¶
func AssertValidKey ¶
func AssertValidKey(key []byte)
AssertValidKey checks if the key is valid(key is not nil)
func AssertValidValue ¶
func AssertValidValue(value []byte)
AssertValidValue checks if the value is valid(value is not nil)
func BigEndianToUint64 ¶
BigEndianToUint64 returns an uint64 from big endian encoded bytes. If encoding is empty, zero is returned.
func CommitmentOpDecoder ¶
func CommitmentOpDecoder(pop tmmerkle.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 InclusiveEndBytes ¶
InclusiveEndBytes returns the []byte that would end a range query such that the input would be included
func NewKVStoreKeys ¶
func NewKVStoreKeys(names ...string) map[string]*KVStoreKey
NewKVStoreKeys returns a map of new pointers to KVStoreKey's. The function will panic if there is a potential conflict in names (see `assertNoPrefix` function for more details).
func NewMemoryStoreKeys ¶
func NewMemoryStoreKeys(names ...string) map[string]*MemoryStoreKey
NewMemoryStoreKeys constructs a new map matching store key names to their respective MemoryStoreKey references. The function will panic if there is a potential conflict in names (see `assertNoPrefix` function for more details).
func NewTransientStoreKeys ¶
func NewTransientStoreKeys(names ...string) map[string]*TransientStoreKey
NewTransientStoreKeys constructs a new map of TransientStoreKey's Must return pointers according to the ocap principle The function will panic if there is a potential conflict in names see `assertNoCommonPrefix` function for more details.
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 ProofOpFromMap ¶
ProofOpFromMap generates a single proof from a map and converts it to a ProofOp.
func QueryResult ¶
func QueryResult(err error, debug bool) abci.ResponseQuery
QueryResult returns a ResponseQuery from an error. It will try to parse ABCI info from the error.
func SliceContains ¶
func SliceContains[T comparable](elements []T, v T) bool
SliceContains implements a generic function for checking if a slice contains a certain value.
func Uint64ToBigEndian ¶
Uint64ToBigEndian - marshals uint64 to a bigendian byte slice so it can be sorted
Types ¶
type ABCIListener ¶
type ABCIListener interface { // ListenBeginBlock updates the streaming service with the latest BeginBlock messages ListenBeginBlock(ctx context.Context, req abci.RequestBeginBlock, res abci.ResponseBeginBlock) error // ListenEndBlock updates the steaming service with the latest EndBlock messages ListenEndBlock(ctx context.Context, req abci.RequestEndBlock, res abci.ResponseEndBlock) error // ListenDeliverTx updates the steaming service with the latest DeliverTx messages ListenDeliverTx(ctx context.Context, req abci.RequestDeliverTx, res abci.ResponseDeliverTx) error // ListenCommit updates the steaming service with the latest Commit event ListenCommit(ctx context.Context, res abci.ResponseCommit) error }
ABCIListener interface used to hook into the ABCI message processing of the BaseApp. the error results are propagated to consensus state machine, if you don't want to affect consensus, handle the errors internally and always return `nil` in these APIs.
type BasicKVStore ¶
type BasicKVStore interface { // Get returns nil if 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) }
BasicKVStore is a simple interface to get/set data
type BlockMetadata ¶
type BlockMetadata struct { RequestBeginBlock *types.RequestBeginBlock `protobuf:"bytes,1,opt,name=request_begin_block,json=requestBeginBlock,proto3" json:"request_begin_block,omitempty"` ResponseBeginBlock *types.ResponseBeginBlock `protobuf:"bytes,2,opt,name=response_begin_block,json=responseBeginBlock,proto3" json:"response_begin_block,omitempty"` DeliverTxs []*BlockMetadata_DeliverTx `protobuf:"bytes,3,rep,name=deliver_txs,json=deliverTxs,proto3" json:"deliver_txs,omitempty"` RequestEndBlock *types.RequestEndBlock `protobuf:"bytes,4,opt,name=request_end_block,json=requestEndBlock,proto3" json:"request_end_block,omitempty"` ResponseEndBlock *types.ResponseEndBlock `protobuf:"bytes,5,opt,name=response_end_block,json=responseEndBlock,proto3" json:"response_end_block,omitempty"` ResponseCommit *types.ResponseCommit `protobuf:"bytes,6,opt,name=response_commit,json=responseCommit,proto3" json:"response_commit,omitempty"` }
BlockMetadata contains all the abci event data of a block the file streamer dump them into files together with the state changes.
func (*BlockMetadata) Descriptor ¶
func (*BlockMetadata) Descriptor() ([]byte, []int)
func (*BlockMetadata) GetDeliverTxs ¶
func (m *BlockMetadata) GetDeliverTxs() []*BlockMetadata_DeliverTx
func (*BlockMetadata) GetRequestBeginBlock ¶
func (m *BlockMetadata) GetRequestBeginBlock() *types.RequestBeginBlock
func (*BlockMetadata) GetRequestEndBlock ¶
func (m *BlockMetadata) GetRequestEndBlock() *types.RequestEndBlock
func (*BlockMetadata) GetResponseBeginBlock ¶
func (m *BlockMetadata) GetResponseBeginBlock() *types.ResponseBeginBlock
func (*BlockMetadata) GetResponseCommit ¶
func (m *BlockMetadata) GetResponseCommit() *types.ResponseCommit
func (*BlockMetadata) GetResponseEndBlock ¶
func (m *BlockMetadata) GetResponseEndBlock() *types.ResponseEndBlock
func (*BlockMetadata) Marshal ¶
func (m *BlockMetadata) Marshal() (dAtA []byte, err error)
func (*BlockMetadata) MarshalToSizedBuffer ¶
func (m *BlockMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*BlockMetadata) ProtoMessage ¶
func (*BlockMetadata) ProtoMessage()
func (*BlockMetadata) Reset ¶
func (m *BlockMetadata) Reset()
func (*BlockMetadata) Size ¶
func (m *BlockMetadata) Size() (n int)
func (*BlockMetadata) String ¶
func (m *BlockMetadata) String() string
func (*BlockMetadata) Unmarshal ¶
func (m *BlockMetadata) Unmarshal(dAtA []byte) error
func (*BlockMetadata) XXX_DiscardUnknown ¶
func (m *BlockMetadata) XXX_DiscardUnknown()
func (*BlockMetadata) XXX_Marshal ¶
func (m *BlockMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*BlockMetadata) XXX_Merge ¶
func (m *BlockMetadata) XXX_Merge(src proto.Message)
func (*BlockMetadata) XXX_Size ¶
func (m *BlockMetadata) XXX_Size() int
func (*BlockMetadata) XXX_Unmarshal ¶
func (m *BlockMetadata) XXX_Unmarshal(b []byte) error
type BlockMetadata_DeliverTx ¶
type BlockMetadata_DeliverTx struct { Request *types.RequestDeliverTx `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"` Response *types.ResponseDeliverTx `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"` }
DeliverTx encapulate deliver tx request and response.
func (*BlockMetadata_DeliverTx) Descriptor ¶
func (*BlockMetadata_DeliverTx) Descriptor() ([]byte, []int)
func (*BlockMetadata_DeliverTx) GetRequest ¶
func (m *BlockMetadata_DeliverTx) GetRequest() *types.RequestDeliverTx
func (*BlockMetadata_DeliverTx) GetResponse ¶
func (m *BlockMetadata_DeliverTx) GetResponse() *types.ResponseDeliverTx
func (*BlockMetadata_DeliverTx) Marshal ¶
func (m *BlockMetadata_DeliverTx) Marshal() (dAtA []byte, err error)
func (*BlockMetadata_DeliverTx) MarshalTo ¶
func (m *BlockMetadata_DeliverTx) MarshalTo(dAtA []byte) (int, error)
func (*BlockMetadata_DeliverTx) MarshalToSizedBuffer ¶
func (m *BlockMetadata_DeliverTx) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*BlockMetadata_DeliverTx) ProtoMessage ¶
func (*BlockMetadata_DeliverTx) ProtoMessage()
func (*BlockMetadata_DeliverTx) Reset ¶
func (m *BlockMetadata_DeliverTx) Reset()
func (*BlockMetadata_DeliverTx) Size ¶
func (m *BlockMetadata_DeliverTx) Size() (n int)
func (*BlockMetadata_DeliverTx) String ¶
func (m *BlockMetadata_DeliverTx) String() string
func (*BlockMetadata_DeliverTx) Unmarshal ¶
func (m *BlockMetadata_DeliverTx) Unmarshal(dAtA []byte) error
func (*BlockMetadata_DeliverTx) XXX_DiscardUnknown ¶
func (m *BlockMetadata_DeliverTx) XXX_DiscardUnknown()
func (*BlockMetadata_DeliverTx) XXX_Marshal ¶
func (m *BlockMetadata_DeliverTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*BlockMetadata_DeliverTx) XXX_Merge ¶
func (m *BlockMetadata_DeliverTx) XXX_Merge(src proto.Message)
func (*BlockMetadata_DeliverTx) XXX_Size ¶
func (m *BlockMetadata_DeliverTx) XXX_Size() int
func (*BlockMetadata_DeliverTx) XXX_Unmarshal ¶
func (m *BlockMetadata_DeliverTx) XXX_Unmarshal(b []byte) error
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 }
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 }
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/ibc/tree/master/spec/core/ics-005-port-allocation#data-structures
type Codec ¶
type Codec interface { // Marshal returns binary encoding of v. Marshal(proto.Message) ([]byte, error) // MarshalLengthPrefixed returns binary encoding of v with bytes length prefix. MarshalLengthPrefixed(proto.Message) ([]byte, error) // Unmarshal parses the data encoded with Marshal method and stores the result // in the value pointed to by v. Unmarshal(bz []byte, ptr proto.Message) error // Unmarshal parses the data encoded with UnmarshalLengthPrefixed method and stores // the result in the value pointed to by v. UnmarshalLengthPrefixed(bz []byte, ptr proto.Message) error }
Codec defines a interface needed for the store package to marshal data
func NewTestCodec ¶
func NewTestCodec() Codec
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 commitment 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) CommitID ¶
func (ci CommitInfo) CommitID() CommitID
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) Hash ¶
func (ci CommitInfo) Hash() []byte
Hash returns the simple merkle root hash of the stores sorted by name.
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 // SetIAVLCacheSize sets the cache size of the IAVL tree. SetIAVLCacheSize(size int) // SetIAVLDisableFastNode enables/disables fastnode feature on iavl. SetIAVLDisableFastNode(disable bool) // RollbackToVersion rollback the db to specific version(height). RollbackToVersion(version int64) error // 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) // SetMetrics sets the metrics for the KVStore SetMetrics(metrics metrics.StoreMetrics) }
CommitMultiStore is an interface for a MultiStore without cache capabilities.
type CommitStore ¶
Stores of MultiStore must implement CommitStore.
type CommitmentOp ¶
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 ¶
func NewIavlCommitmentOp(key []byte, proof *ics23.CommitmentProof) CommitmentOp
func NewSimpleMerkleCommitmentOp ¶
func NewSimpleMerkleCommitmentOp(key []byte, proof *ics23.CommitmentProof) CommitmentOp
func NewSmtCommitmentOp ¶
func NewSmtCommitmentOp(key []byte, proof *ics23.CommitmentProof) CommitmentOp
func (CommitmentOp) GetKey ¶
func (op CommitmentOp) GetKey() []byte
func (CommitmentOp) ProofOp ¶
func (op CommitmentOp) ProofOp() tmmerkle.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 ¶
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 { Commit() CommitID LastCommitID() CommitID SetPruning(pruningtypes.PruningOptions) GetPruning() pruningtypes.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 GasRemaining() 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 new gas meter without a limit.
type Iterator ¶
Iterator is an alias db's Iterator for convenience.
func KVStorePrefixIterator ¶
KVStorePrefixIterator iterates 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 ¶
KVStoreReversePrefixIterator iterates over all the keys with a certain prefix in descending order.
type KVStore ¶
type KVStore interface { Store BasicKVStore // 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 additionally provides iteration and deletion
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 MemoryListener ¶
type MemoryListener struct {
// contains filtered or unexported fields
}
MemoryListener listens to the state writes and accumulate the records in memory.
func NewMemoryListener ¶
func NewMemoryListener(key StoreKey) *MemoryListener
NewMemoryListener creates a listener that accumulate the state writes in memory.
func (*MemoryListener) PopStateCache ¶
func (fl *MemoryListener) PopStateCache() []StoreKVPair
PopStateCache returns the current state caches and set to nil.
func (*MemoryListener) StoreKey ¶
func (fl *MemoryListener) StoreKey() StoreKey
StoreKey returns the storeKey it listens to.
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 // LatestVersion returns the latest version in the store LatestVersion() int64 }
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 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 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) GetHash ¶
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) 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
Since: cosmos-sdk 0.43
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 object.
func NewStoreKVPairWriteListener ¶
func NewStoreKVPairWriteListener(w io.Writer, m Codec) *StoreKVPairWriteListener
NewStoreKVPairWriteListener wraps creates a StoreKVPairWriteListener with a provided 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
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 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 StreamingService ¶
type StreamingService interface { // Stream is the streaming service loop, awaits kv pairs and writes them to some destination stream or file Stream(wg *sync.WaitGroup) error // Listeners returns the streaming service's listeners for the BaseApp to register Listeners() map[StoreKey][]WriteListener // ABCIListener interface for hooking into the ABCI messages from inside the BaseApp ABCIListener // Closer interface io.Closer }
StreamingService interface for registering WriteListeners with the BaseApp and updating the service with the ABCI messages using the hooks
type TestCodec ¶
type TestCodec struct{}
============= TestCodec ============= TestCodec defines a codec that utilizes Protobuf for both binary and JSON encoding.
func (*TestCodec) Marshal ¶
Marshal implements BinaryMarshaler.Marshal method. NOTE: this function must be used with a concrete type which implements proto.Message. For interface please use the codec.MarshalInterface
func (*TestCodec) MarshalLengthPrefixed ¶
MarshalLengthPrefixed implements BinaryMarshaler.MarshalLengthPrefixed method.
type TraceContext ¶
type TraceContext map[string]interface{}
TraceContext contains TraceKVStore context data. It will be written with every trace operation.
func (TraceContext) Clone ¶
func (tc TraceContext) Clone() TraceContext
Clone clones tc into another instance of TraceContext.
func (TraceContext) Merge ¶
func (tc TraceContext) Merge(newTc TraceContext) TraceContext
Merge merges value of newTc into tc.
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 WriteListener ¶
type WriteListener interface { // if value is nil then it was deleted // storeKey indicates the source KVStore, to facilitate using 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 KVStore