Documentation ¶
Index ¶
- Constants
- Variables
- func CloseLogError(iter sdk.Iterator, logger log.Logger)
- func ExtractReqSender(w http.ResponseWriter, req rest.BaseReq) (sdk.AccAddress, bool)
- func IndexOf(strs []string, str string) int
- func NewNOPLogger() log.Logger
- 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 ValidateQueueState(state map[string]codec.ProtoMarshaler) error
- type BackOff
- type BlockHeightKVQueue
- func (q BlockHeightKVQueue) Dequeue(value codec.ProtoMarshaler, filter ...func(value codec.ProtoMarshaler) bool) bool
- func (q BlockHeightKVQueue) Enqueue(key Key, value codec.ProtoMarshaler)
- func (q BlockHeightKVQueue) ImportState(state map[string]codec.ProtoMarshaler)
- func (q BlockHeightKVQueue) IsEmpty() bool
- func (q BlockHeightKVQueue) WithBlockHeight(blockHeight int64) BlockHeightKVQueue
- type Iterator
- type KVQueue
- type KVStore
- func (store KVStore) Delete(key Key)
- func (store KVStore) Get(key Key, value codec.ProtoMarshaler) bool
- func (store KVStore) GetRaw(key Key) []byte
- func (store KVStore) Has(key Key) bool
- func (store KVStore) Iterator(prefix Key) Iterator
- func (store KVStore) Set(key Key, value codec.ProtoMarshaler)
- func (store KVStore) SetRaw(key Key, value []byte)
- type Key
- type NOPLogger
- type Nonce
- 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) SimpleString() string
- 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
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
Variables ¶
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 NewNOPLogger ¶
NewNOPLogger returns a logger that doesn't do anything.
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 ValidateQueueState ¶ added in v0.9.0
func ValidateQueueState(state map[string]codec.ProtoMarshaler) error
ValidateQueueState checks if the keys of the given map have the correct format to be imported as queue state. The expected format is {block height}_{[a-zA-Z0-9]+}
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 BlockHeightKVQueue ¶
type BlockHeightKVQueue struct {
// contains filtered or unexported fields
}
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
func (BlockHeightKVQueue) Dequeue ¶
func (q BlockHeightKVQueue) Dequeue(value codec.ProtoMarshaler, filter ...func(value codec.ProtoMarshaler) bool) bool
Dequeue pops the bottom of the queue and unmarshals it into the given object, and return true if anything in the queue is found and the value passes the optional filter function
func (BlockHeightKVQueue) Enqueue ¶
func (q BlockHeightKVQueue) 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 (BlockHeightKVQueue) ImportState ¶ added in v0.9.0
func (q BlockHeightKVQueue) ImportState(state map[string]codec.ProtoMarshaler)
ImportState should only be used to populate state at genesis. Panics if the given state is invalid
func (BlockHeightKVQueue) IsEmpty ¶
func (q BlockHeightKVQueue) IsEmpty() bool
IsEmpty returns true if the queue is empty; otherwise, false
func (BlockHeightKVQueue) WithBlockHeight ¶
func (q BlockHeightKVQueue) WithBlockHeight(blockHeight int64) BlockHeightKVQueue
WithBlockHeight returns a queue with the given block height
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(key Key, value codec.ProtoMarshaler) Dequeue(value codec.ProtoMarshaler, filter ...func(value codec.ProtoMarshaler) bool) bool IsEmpty() bool }
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) 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.
func (KVStore) GetRaw ¶
GetRaw returns the raw bytes stored under the given key. Returns nil with key does not exist.
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 Equals(key Key) bool }
Key represents a store key to interact with the KVStore
type Nonce ¶ added in v0.9.0
Nonce defines a 32 byte array representing a deterministically-generated nonce
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
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) SimpleString ¶
SimpleString returns a simple string representation of the threshold
func (*Threshold) XXX_DiscardUnknown ¶
func (m *Threshold) XXX_DiscardUnknown()