Documentation ¶
Index ¶
- Constants
- Variables
- func CloseLogError(iter sdk.Iterator, logger log.Logger)
- func ExtractReqSender(w http.ResponseWriter, req rest.BaseReq) (sdk.AccAddress, bool)
- func Hash(data codec.ProtoMarshaler) []byte
- func IndexOf(strs []string, str string) int
- func NewNOPLogger() log.Logger
- func NormalizeString(str string) string
- func RegisterQueryHandlerFn(r *mux.Router, moduleRoute string) func(http.HandlerFunc, string, ...string)
- func RegisterTxHandlerFn(r *mux.Router, moduleRoute string) func(http.HandlerFunc, string, ...string)
- func RunCached[T any](c sdk.Context, l Logger, f func(sdk.Context) (T, error)) T
- func ValidateString(str string, forbidden ...string) error
- func ValidateStringAllowEmpty(str string, forbidden string) error
- type BackOff
- type Bitmap
- func (m *Bitmap) Add(bit bool) *Bitmap
- func (m Bitmap) CountFalse(bitCount int) uint64
- func (m Bitmap) CountTrue(bitCount int) uint64
- func (*Bitmap) Descriptor() ([]byte, []int)
- func (m *Bitmap) Marshal() (dAtA []byte, err error)
- func (m *Bitmap) MarshalTo(dAtA []byte) (int, error)
- func (m *Bitmap) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Bitmap) ProtoMessage()
- func (m *Bitmap) Reset()
- func (m *Bitmap) Size() (n int)
- func (m *Bitmap) String() string
- func (m *Bitmap) Unmarshal(dAtA []byte) error
- func (m *Bitmap) XXX_DiscardUnknown()
- func (m *Bitmap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Bitmap) XXX_Merge(src proto.Message)
- func (m *Bitmap) XXX_Size() int
- func (m *Bitmap) XXX_Unmarshal(b []byte) error
- type BlockHeightKVQueue
- type CircularBuffer
- func (m *CircularBuffer) Add(value uint32)
- func (m CircularBuffer) Count(windowRange int) uint64
- func (*CircularBuffer) Descriptor() ([]byte, []int)
- func (m *CircularBuffer) Marshal() (dAtA []byte, err error)
- func (m *CircularBuffer) MarshalTo(dAtA []byte) (int, error)
- func (m *CircularBuffer) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*CircularBuffer) ProtoMessage()
- func (m *CircularBuffer) Reset()
- func (m *CircularBuffer) SetMaxSize(size int)
- func (m *CircularBuffer) Size() (n int)
- func (m *CircularBuffer) String() string
- func (m *CircularBuffer) Unmarshal(dAtA []byte) error
- func (m *CircularBuffer) XXX_DiscardUnknown()
- func (m *CircularBuffer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CircularBuffer) XXX_Merge(src proto.Message)
- func (m *CircularBuffer) XXX_Size() int
- func (m *CircularBuffer) XXX_Unmarshal(b []byte) error
- type Counter
- type GeneralKVQueue
- func (q GeneralKVQueue) Dequeue(value codec.ProtoMarshaler) bool
- func (q GeneralKVQueue) DequeueIf(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool
- func (q GeneralKVQueue) DequeueUntil(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool
- func (q GeneralKVQueue) Enqueue(key Key, value codec.ProtoMarshaler)
- func (q GeneralKVQueue) ExportState() (state QueueState)
- func (q GeneralKVQueue) ImportState(state QueueState)
- func (q GeneralKVQueue) IsEmpty() bool
- func (q GeneralKVQueue) Keys() []Key
- type Iterator
- type KVQueue
- type KVStore
- func (store KVStore) Delete(key Key)
- func (store KVStore) DeleteNew(k key.Key)
- func (store KVStore) DeleteRaw(key []byte)
- func (store KVStore) Get(key Key, value codec.ProtoMarshaler) bool
- func (store KVStore) GetNew(key key.Key, value codec.ProtoMarshaler) bool
- func (store KVStore) GetRaw(key Key) []byte
- func (store KVStore) GetRawNew(key key.Key) []byte
- func (store KVStore) Has(key Key) bool
- func (store KVStore) HasNew(k key.Key) bool
- func (store KVStore) Iterator(prefix Key) Iterator
- func (store KVStore) IteratorNew(prefix key.Key) Iterator
- func (store KVStore) ReverseIterator(prefix Key) Iterator
- func (store KVStore) Set(key Key, value codec.ProtoMarshaler)
- func (store KVStore) SetNewValidated(k key.Key, value ValidatedProtoMarshaler) error
- func (store KVStore) SetRaw(key Key, value []byte)
- func (store KVStore) SetRawNew(k key.Key, value []byte)
- type Key
- type Logger
- type NOPLogger
- type Nonce
- type QueueState
- func (*QueueState) Descriptor() ([]byte, []int)
- func (m *QueueState) Marshal() (dAtA []byte, err error)
- func (m *QueueState) MarshalTo(dAtA []byte) (int, error)
- func (m *QueueState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueueState) ProtoMessage()
- func (m *QueueState) Reset()
- func (m *QueueState) Size() (n int)
- func (m *QueueState) String() string
- func (m *QueueState) Unmarshal(dAtA []byte) error
- func (m QueueState) ValidateBasic(queueName ...string) error
- func (m *QueueState) XXX_DiscardUnknown()
- func (m *QueueState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueueState) XXX_Merge(src proto.Message)
- func (m *QueueState) XXX_Size() int
- func (m *QueueState) XXX_Unmarshal(b []byte) error
- type QueueState_Item
- func (*QueueState_Item) Descriptor() ([]byte, []int)
- func (m *QueueState_Item) Marshal() (dAtA []byte, err error)
- func (m *QueueState_Item) MarshalTo(dAtA []byte) (int, error)
- func (m *QueueState_Item) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueueState_Item) ProtoMessage()
- func (m *QueueState_Item) Reset()
- func (m *QueueState_Item) Size() (n int)
- func (m *QueueState_Item) String() string
- func (m *QueueState_Item) Unmarshal(dAtA []byte) error
- func (m *QueueState_Item) XXX_DiscardUnknown()
- func (m *QueueState_Item) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueueState_Item) XXX_Merge(src proto.Message)
- func (m *QueueState_Item) XXX_Size() int
- func (m *QueueState_Item) XXX_Unmarshal(b []byte) error
- type SequenceKVQueue
- type StringKey
- type Threshold
- func (*Threshold) Descriptor() ([]byte, []int)
- func (m Threshold) GT(t Threshold) bool
- func (m Threshold) GTE(t Threshold) bool
- func (m Threshold) IsMet(share sdk.Int, total sdk.Int) bool
- func (m Threshold) LT(t Threshold) bool
- func (m Threshold) LTE(t Threshold) bool
- func (m *Threshold) Marshal() (dAtA []byte, err error)
- func (m *Threshold) MarshalTo(dAtA []byte) (int, error)
- func (m *Threshold) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Threshold) ProtoMessage()
- func (m *Threshold) Reset()
- func (m *Threshold) Size() (n int)
- func (m Threshold) String() string
- func (m *Threshold) Unmarshal(dAtA []byte) error
- func (m Threshold) Validate() error
- func (m *Threshold) XXX_DiscardUnknown()
- func (m *Threshold) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Threshold) XXX_Merge(src proto.Message)
- func (m *Threshold) XXX_Size() int
- func (m *Threshold) XXX_Unmarshal(b []byte) error
- type ValidatedProtoMarshaler
Constants ¶
const ( PathVarChain = "Chain" PathVarRecipientChain = "RecipientChain" PathVarContract = "Contract" PathVarCosmosAddress = "CosmosAddress" PathVarCounter = "Counter" PathVarAmount = "Amount" PathVarLinkedAddress = "LinkedAddress" PathVarEthereumAddress = "EthereumAddress" PathVarTxID = "TxID" PathVarCommandID = "CommandID" PathVarBatchedCommandsID = "BatchedCommandsID" PathVarKeyRole = "KeyRole" PathVarTxType = "txType" PathVarKeyID = "KeyID" PathVarSigID = "SigID" PathVarOutpoint = "Outpoint" PathvarSymbol = "Symbol" PathVarAsset = "Asset" )
routes
const DefaultDelimiter = "_"
DefaultDelimiter represents the default delimiter used for the KV store keys
Variables ¶
var ( ErrInvalidLengthBitmap = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowBitmap = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupBitmap = fmt.Errorf("proto: unexpected end of group") )
var ( // MaxInt specifies the max sdk.Int value MaxInt = sdk.NewIntFromBigInt(math.MaxBig256) // MaxUint specifies the max sdk.Uint value MaxUint = sdk.NewUintFromBigInt(math.MaxBig256) )
Functions ¶
func CloseLogError ¶
CloseLogError closes the given iterator and logs if an error is returned
func ExtractReqSender ¶
func ExtractReqSender(w http.ResponseWriter, req rest.BaseReq) (sdk.AccAddress, bool)
ExtractReqSender extracts the sender address from an SDK base request
func Hash ¶ added in v0.26.3
func Hash(data codec.ProtoMarshaler) []byte
Hash returns the sha256 hash of the given protobuf data
func NewNOPLogger ¶
NewNOPLogger returns a logger that doesn't do anything.
func NormalizeString ¶ added in v0.12.0
NormalizeString normalizes a string as NFKC
func RegisterQueryHandlerFn ¶
func RegisterQueryHandlerFn(r *mux.Router, moduleRoute string) func(http.HandlerFunc, string, ...string)
RegisterQueryHandlerFn returns a function to register query routes with the given router
func RegisterTxHandlerFn ¶
func RegisterTxHandlerFn(r *mux.Router, moduleRoute string) func(http.HandlerFunc, string, ...string)
RegisterTxHandlerFn returns a function to register rest routes with the given router
func RunCached ¶ added in v0.21.0
RunCached wraps the given function, handles error/panic and rolls back the state if necessary
func ValidateString ¶ added in v0.12.0
ValidateString checks if the given string is:
1. non-empty 2. entirely composed of utf8 runes 3. normalized as NFKC 4. does not contain any forbidden Unicode code points
func ValidateStringAllowEmpty ¶ added in v0.12.0
ValidateStringAllowEmpty checks if the given string is:
1. entirely composed of utf8 runes 2. normalized as NFKC 3. does not contain any forbidden Unicode code points
Types ¶
type BackOff ¶
BackOff computes the next back-off duration
func ExponentialBackOff ¶
ExponentialBackOff computes an exponential back-off
func LinearBackOff ¶
LinearBackOff computes a linear back-off
type Bitmap ¶ added in v0.18.0
type Bitmap struct {
TrueCountCache *CircularBuffer `protobuf:"bytes,2,opt,name=true_count_cache,json=trueCountCache,proto3" json:"true_count_cache,omitempty"`
}
func (Bitmap) CountFalse ¶ added in v0.18.0
CountFalse returns the number of 0's in the given range
func (*Bitmap) Descriptor ¶ added in v0.18.0
func (*Bitmap) MarshalToSizedBuffer ¶ added in v0.18.0
func (*Bitmap) ProtoMessage ¶ added in v0.18.0
func (*Bitmap) ProtoMessage()
func (*Bitmap) XXX_DiscardUnknown ¶ added in v0.18.0
func (m *Bitmap) XXX_DiscardUnknown()
func (*Bitmap) XXX_Marshal ¶ added in v0.18.0
func (*Bitmap) XXX_Unmarshal ¶ added in v0.18.0
type BlockHeightKVQueue ¶
type BlockHeightKVQueue struct {
GeneralKVQueue
}
BlockHeightKVQueue is a queue that orders items with the block height at which the items are enqueued; the order of items that are enqueued at the same block height is deterministically based on their actual key in the KVStore
func NewBlockHeightKVQueue ¶
func NewBlockHeightKVQueue(name string, store KVStore, blockHeight int64, logger log.Logger) BlockHeightKVQueue
NewBlockHeightKVQueue is the constructor of BlockHeightKVQueue
type CircularBuffer ¶ added in v0.18.0
type CircularBuffer struct { CumulativeValue []uint64 `protobuf:"varint,1,rep,packed,name=cumulative_value,json=cumulativeValue,proto3" json:"cumulative_value,omitempty"` Index int32 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` MaxSize int32 `protobuf:"varint,3,opt,name=max_size,json=maxSize,proto3" json:"max_size,omitempty"` }
func NewCircularBuffer ¶ added in v0.18.0
func NewCircularBuffer(maxSize int) *CircularBuffer
NewCircularBuffer is the constructor of CircularBuffer
func (*CircularBuffer) Add ¶ added in v0.18.0
func (m *CircularBuffer) Add(value uint32)
Add appends a new value into the CircularBuffer
func (CircularBuffer) Count ¶ added in v0.18.0
func (m CircularBuffer) Count(windowRange int) uint64
Count returns the cumulative value for the most recent given window
func (*CircularBuffer) Descriptor ¶ added in v0.18.0
func (*CircularBuffer) Descriptor() ([]byte, []int)
func (*CircularBuffer) Marshal ¶ added in v0.18.0
func (m *CircularBuffer) Marshal() (dAtA []byte, err error)
func (*CircularBuffer) MarshalTo ¶ added in v0.18.0
func (m *CircularBuffer) MarshalTo(dAtA []byte) (int, error)
func (*CircularBuffer) MarshalToSizedBuffer ¶ added in v0.18.0
func (m *CircularBuffer) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*CircularBuffer) ProtoMessage ¶ added in v0.18.0
func (*CircularBuffer) ProtoMessage()
func (*CircularBuffer) Reset ¶ added in v0.18.0
func (m *CircularBuffer) Reset()
func (*CircularBuffer) SetMaxSize ¶ added in v0.18.0
func (m *CircularBuffer) SetMaxSize(size int)
SetMaxSize sets the max size of the buffer to the given value. The buffer size gets updated accordingly the next time a value is added.
func (*CircularBuffer) Size ¶ added in v0.18.0
func (m *CircularBuffer) Size() (n int)
func (*CircularBuffer) String ¶ added in v0.18.0
func (m *CircularBuffer) String() string
func (*CircularBuffer) Unmarshal ¶ added in v0.18.0
func (m *CircularBuffer) Unmarshal(dAtA []byte) error
func (*CircularBuffer) XXX_DiscardUnknown ¶ added in v0.18.0
func (m *CircularBuffer) XXX_DiscardUnknown()
func (*CircularBuffer) XXX_Marshal ¶ added in v0.18.0
func (m *CircularBuffer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CircularBuffer) XXX_Merge ¶ added in v0.18.0
func (m *CircularBuffer) XXX_Merge(src proto.Message)
func (*CircularBuffer) XXX_Size ¶ added in v0.18.0
func (m *CircularBuffer) XXX_Size() int
func (*CircularBuffer) XXX_Unmarshal ¶ added in v0.18.0
func (m *CircularBuffer) XXX_Unmarshal(b []byte) error
type Counter ¶ added in v0.27.0
type Counter[T constraints.Unsigned] struct { // contains filtered or unexported fields }
Counter is a stateful counter that works with the kv store and starts from zero
func NewCounter ¶ added in v0.27.0
NewCounter is the constructor for counter
type GeneralKVQueue ¶ added in v0.14.0
type GeneralKVQueue struct {
// contains filtered or unexported fields
}
GeneralKVQueue is a queue that orders items based on the given prioritizer function
func NewGeneralKVQueue ¶ added in v0.14.0
func NewGeneralKVQueue(name string, store KVStore, logger log.Logger, prioritizer func(value codec.ProtoMarshaler) Key) GeneralKVQueue
NewGeneralKVQueue is the contructor for GeneralKVQueue
func (GeneralKVQueue) Dequeue ¶ added in v0.14.0
func (q GeneralKVQueue) Dequeue(value codec.ProtoMarshaler) bool
Dequeue pops the first item in queue and stores it in the given value
func (GeneralKVQueue) DequeueIf ¶ added in v0.21.0
func (q GeneralKVQueue) DequeueIf(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool
DequeueIf pops the first item in queue iff it matches the given filter and stores it in the given value
func (GeneralKVQueue) DequeueUntil ¶ added in v0.21.0
func (q GeneralKVQueue) DequeueUntil(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool
DequeueUntil pops the first item in queue that matches the given filter and stores it in the given value
func (GeneralKVQueue) Enqueue ¶ added in v0.14.0
func (q GeneralKVQueue) Enqueue(key Key, value codec.ProtoMarshaler)
Enqueue pushes the given value onto the top of the queue and stores the value at given key
func (GeneralKVQueue) ExportState ¶ added in v0.17.0
func (q GeneralKVQueue) ExportState() (state QueueState)
ExportState exports the given queue's state from the kv store
func (GeneralKVQueue) ImportState ¶ added in v0.14.0
func (q GeneralKVQueue) ImportState(state QueueState)
ImportState imports the given queue state into the kv store
func (GeneralKVQueue) IsEmpty ¶ added in v0.14.0
func (q GeneralKVQueue) IsEmpty() bool
IsEmpty returns true if the queue is empty; otherwise, false
func (GeneralKVQueue) Keys ¶ added in v0.14.0
func (q GeneralKVQueue) Keys() []Key
Keys returns a list with the keys for the values still enqueued
type Iterator ¶
type Iterator interface { sdk.Iterator UnmarshalValue(marshaler codec.ProtoMarshaler) GetKey() Key }
Iterator is an easier and safer to use sdk.Iterator extension
type KVQueue ¶
type KVQueue interface { // Enqueue pushes the given value into the queue with the given key Enqueue(key Key, value codec.ProtoMarshaler) // Dequeue pops the first item in queue and stores it in the given value Dequeue(value codec.ProtoMarshaler) bool // DequeueIf pops the first item in queue iff it matches the given filter and stores it in the given value DequeueIf(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool // DequeueUntil pops the first item in queue that matches the given filter and stores it in the given value DequeueUntil(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool // IsEmpty returns true if the queue is empty; false otherwise IsEmpty() bool //TODO: convert to iterator Keys() []Key }
KVQueue represents a queue built with the KVStore
type KVStore ¶
KVStore is a wrapper around the cosmos-sdk KVStore to provide more safety regarding key management and better ease-of-use
func NewNormalizedStore ¶
func NewNormalizedStore(store sdk.KVStore, cdc codec.BinaryCodec) KVStore
NewNormalizedStore returns a new KVStore
func (KVStore) Delete ¶
Delete deletes the value stored under the given key, if it exists Deprecated: use DeleteNew instead
func (KVStore) DeleteNew ¶ added in v0.25.0
DeleteNew deletes the value stored under the given key, if it exists
func (KVStore) DeleteRaw ¶ added in v0.21.0
DeleteRaw deletes the value stored under the given raw key, if it exists
func (KVStore) Get ¶
func (store KVStore) Get(key Key, value codec.ProtoMarshaler) bool
Get unmarshals the raw bytes stored under the given key into the value object. Returns true if the key exists. Deprecated: use GetNew instead
func (KVStore) GetNew ¶ added in v0.21.0
GetNew unmarshals the raw bytes stored under the given key into the value object. Returns true if the key exists.
func (KVStore) GetRaw ¶
GetRaw returns the raw bytes stored under the given key. Returns nil with key does not exist. Deprecated: use GetRawNew instead
func (KVStore) GetRawNew ¶ added in v0.27.0
GetRawNew returns the raw bytes stored under the given key. Returns nil with key does not exist.
func (KVStore) HasNew ¶ added in v0.25.0
HasNew deletes the value stored under the given key, if it exists
func (KVStore) IteratorNew ¶ added in v0.21.0
IteratorNew returns an Iterator that can handle a structured Key
func (KVStore) ReverseIterator ¶ added in v0.21.0
ReverseIterator returns an Iterator that can handle a structured Key and interate reversely
func (KVStore) Set ¶
func (store KVStore) Set(key Key, value codec.ProtoMarshaler)
Set marshals the value and stores it under the given key Deprecated: use SetNewValidated instead
func (KVStore) SetNewValidated ¶ added in v0.27.0
func (store KVStore) SetNewValidated(k key.Key, value ValidatedProtoMarshaler) error
SetNewValidated marshals the value and stores it under the given key if it is valid
type Key ¶
type Key interface { // AsKey returns the byte representation of the key. If given, uses a delimiter string to separate prefixes AsKey(delimiter ...string) []byte Prepend(prefix Key) Key Append(key Key) Key }
Key represents a store key to interact with the KVStore Deprecated: use key.Key instead
type Nonce ¶ added in v0.9.0
Nonce defines a 32 byte array representing a deterministically-generated nonce
type QueueState ¶ added in v0.17.0
type QueueState struct {
Items map[string]QueueState_Item `` /* 141-byte string literal not displayed */
}
func (*QueueState) Descriptor ¶ added in v0.17.0
func (*QueueState) Descriptor() ([]byte, []int)
func (*QueueState) Marshal ¶ added in v0.17.0
func (m *QueueState) Marshal() (dAtA []byte, err error)
func (*QueueState) MarshalTo ¶ added in v0.17.0
func (m *QueueState) MarshalTo(dAtA []byte) (int, error)
func (*QueueState) MarshalToSizedBuffer ¶ added in v0.17.0
func (m *QueueState) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueueState) ProtoMessage ¶ added in v0.17.0
func (*QueueState) ProtoMessage()
func (*QueueState) Reset ¶ added in v0.17.0
func (m *QueueState) Reset()
func (*QueueState) Size ¶ added in v0.17.0
func (m *QueueState) Size() (n int)
func (*QueueState) String ¶ added in v0.17.0
func (m *QueueState) String() string
func (*QueueState) Unmarshal ¶ added in v0.17.0
func (m *QueueState) Unmarshal(dAtA []byte) error
func (QueueState) ValidateBasic ¶ added in v0.17.0
func (m QueueState) ValidateBasic(queueName ...string) error
ValidateBasic returns an error if the given queue state is invalid
func (*QueueState) XXX_DiscardUnknown ¶ added in v0.17.0
func (m *QueueState) XXX_DiscardUnknown()
func (*QueueState) XXX_Marshal ¶ added in v0.17.0
func (m *QueueState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueueState) XXX_Merge ¶ added in v0.17.0
func (m *QueueState) XXX_Merge(src proto.Message)
func (*QueueState) XXX_Size ¶ added in v0.17.0
func (m *QueueState) XXX_Size() int
func (*QueueState) XXX_Unmarshal ¶ added in v0.17.0
func (m *QueueState) XXX_Unmarshal(b []byte) error
type QueueState_Item ¶ added in v0.17.0
type QueueState_Item 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"` }
func (*QueueState_Item) Descriptor ¶ added in v0.17.0
func (*QueueState_Item) Descriptor() ([]byte, []int)
func (*QueueState_Item) Marshal ¶ added in v0.17.0
func (m *QueueState_Item) Marshal() (dAtA []byte, err error)
func (*QueueState_Item) MarshalTo ¶ added in v0.17.0
func (m *QueueState_Item) MarshalTo(dAtA []byte) (int, error)
func (*QueueState_Item) MarshalToSizedBuffer ¶ added in v0.17.0
func (m *QueueState_Item) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueueState_Item) ProtoMessage ¶ added in v0.17.0
func (*QueueState_Item) ProtoMessage()
func (*QueueState_Item) Reset ¶ added in v0.17.0
func (m *QueueState_Item) Reset()
func (*QueueState_Item) Size ¶ added in v0.17.0
func (m *QueueState_Item) Size() (n int)
func (*QueueState_Item) String ¶ added in v0.17.0
func (m *QueueState_Item) String() string
func (*QueueState_Item) Unmarshal ¶ added in v0.17.0
func (m *QueueState_Item) Unmarshal(dAtA []byte) error
func (*QueueState_Item) XXX_DiscardUnknown ¶ added in v0.17.0
func (m *QueueState_Item) XXX_DiscardUnknown()
func (*QueueState_Item) XXX_Marshal ¶ added in v0.17.0
func (m *QueueState_Item) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueueState_Item) XXX_Merge ¶ added in v0.17.0
func (m *QueueState_Item) XXX_Merge(src proto.Message)
func (*QueueState_Item) XXX_Size ¶ added in v0.17.0
func (m *QueueState_Item) XXX_Size() int
func (*QueueState_Item) XXX_Unmarshal ¶ added in v0.17.0
func (m *QueueState_Item) XXX_Unmarshal(b []byte) error
type SequenceKVQueue ¶
type SequenceKVQueue struct {
// contains filtered or unexported fields
}
SequenceKVQueue is a queue that orders items with the sequence number at which the items are enqueued;
func NewSequenceKVQueue ¶
func NewSequenceKVQueue(prefixStore KVStore, maxSize uint64, logger log.Logger) SequenceKVQueue
NewSequenceKVQueue is the constructor of SequenceKVQueue. The prefixStore should isolate the namespace of the queue
func (*SequenceKVQueue) Dequeue ¶
func (q *SequenceKVQueue) Dequeue(n uint64, value codec.ProtoMarshaler) bool
Dequeue pops the nth value off and unmarshals it into the given object, returns false if n is out of range n is 0-based
func (*SequenceKVQueue) Enqueue ¶
func (q *SequenceKVQueue) Enqueue(value codec.ProtoMarshaler) error
Enqueue pushes the given value onto the top of the queue and stores the value at given key. Returns queue position and status
func (SequenceKVQueue) Peek ¶
func (q SequenceKVQueue) Peek(n uint64, value codec.ProtoMarshaler) bool
Peek unmarshals the value into the given object at the given index and returns its sequence number, returns false if n is out of range n is 0-based
func (SequenceKVQueue) Size ¶
func (q SequenceKVQueue) Size() uint64
Size returns the given current size of the queue
type StringKey ¶
type StringKey interface { Key AppendStr(key string, stringTransformations ...func(string) string) StringKey PrependStr(key string, stringTransformations ...func(string) string) StringKey }
StringKey extends the Key interface for simplified appending and prepending Deprecated: use key.Key instead
func KeyFromInt ¶ added in v0.21.0
func KeyFromInt[T constraints.Integer](k T) StringKey
KeyFromInt returns a structured key
func KeyFromStr ¶
KeyFromStr applies the optional string transformations to the given key in sequence and returns a structured key
func LowerCaseKey ¶
LowerCaseKey returns a key with the input converted to lower case
type Threshold ¶
type Threshold struct { // split threshold into Numerator and denominator to avoid floating point // errors down the line Numerator int64 `protobuf:"varint,1,opt,name=numerator,proto3" json:"numerator,omitempty"` Denominator int64 `protobuf:"varint,2,opt,name=denominator,proto3" json:"denominator,omitempty"` }
var OneThreshold Threshold = NewThreshold(1, 1)
OneThreshold is a threshold that equals to 1
var ZeroThreshold Threshold = NewThreshold(0, 1)
ZeroThreshold is a threshold that equals to 0
func NewThreshold ¶
NewThreshold is the constructor for Threshold
func (*Threshold) Descriptor ¶
func (Threshold) GTE ¶
GTE returns true if and only if threshold is greater than or equal to the given one
func (Threshold) LTE ¶
LTE returns true if and only if threshold is less than or equal to the given one
func (*Threshold) MarshalToSizedBuffer ¶
func (*Threshold) ProtoMessage ¶
func (*Threshold) ProtoMessage()
func (*Threshold) XXX_DiscardUnknown ¶
func (m *Threshold) XXX_DiscardUnknown()
func (*Threshold) XXX_Marshal ¶
func (*Threshold) XXX_Unmarshal ¶
type ValidatedProtoMarshaler ¶ added in v0.27.0
type ValidatedProtoMarshaler interface { codec.ProtoMarshaler ValidateBasic() error }
ValidatedProtoMarshaler is a ProtoMarshaler that can also be validated
func NoValidation ¶ added in v0.27.0
func NoValidation(value codec.ProtoMarshaler) ValidatedProtoMarshaler
NoValidation wraps a ProtoMarshaler so it can be used by the store without actually adding any validation
func WithValidation ¶ added in v0.27.0
func WithValidation(value codec.ProtoMarshaler, validate func() error) ValidatedProtoMarshaler
WithValidation adds a ValidateBasic function to an existing ProtoMarshaler