Documentation ¶
Index ¶
- Constants
- Variables
- func AssertSanitizedIndex(safeIndex SafeIndex, prefix string)
- func DecodeBlockAndKey(encodedKey []byte) (uint64, []byte)
- func DecodeKey(encodedKey []byte) uint64
- func DesanitizeIndex(safeIndex SafeIndex) string
- func EncodeBlockAndKey(block uint64, key []byte) []byte
- func EncodeKey(key uint64) []byte
- func IsEntryIndexLive(value []byte) bool
- func KeyPrefix(p string) []byte
- func ValidateString(s string, restrictType charRestrictionEnum, disallowedChars []rune) bool
- type Entry
- func (*Entry) Descriptor() ([]byte, []int)
- func (m *Entry) GetBlock() uint64
- func (m *Entry) GetData() []byte
- func (m *Entry) GetDeleteAt() uint64
- func (m *Entry) GetIndex() string
- func (m *Entry) GetIsLatest() bool
- func (m *Entry) GetRefcount() uint64
- func (m *Entry) GetStaleAt() uint64
- func (entry Entry) HasDeleteAt() bool
- func (entry Entry) IsDeleted(ctx sdk.Context) bool
- func (entry Entry) IsDeletedBy(block uint64) bool
- func (entry Entry) IsStale(ctx sdk.Context) bool
- func (entry Entry) IsStaleBy(block uint64) bool
- func (m *Entry) Marshal() (dAtA []byte, err error)
- func (m *Entry) MarshalTo(dAtA []byte) (int, error)
- func (m *Entry) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Entry) ProtoMessage()
- func (m *Entry) Reset()
- func (entry Entry) SafeIndex() SafeIndex
- func (m *Entry) Size() (n int)
- func (m *Entry) String() string
- func (m *Entry) Unmarshal(dAtA []byte) error
- func (m *Entry) XXX_DiscardUnknown()
- func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Entry) XXX_Merge(src proto.Message)
- func (m *Entry) XXX_Size() int
- func (m *Entry) XXX_Unmarshal(b []byte) error
- type GenesisEntries
- func (*GenesisEntries) Descriptor() ([]byte, []int)
- func (m *GenesisEntries) GetEntries() []Entry
- func (m *GenesisEntries) GetIndex() string
- func (m *GenesisEntries) GetIsLive() bool
- func (m *GenesisEntries) Marshal() (dAtA []byte, err error)
- func (m *GenesisEntries) MarshalTo(dAtA []byte) (int, error)
- func (m *GenesisEntries) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*GenesisEntries) ProtoMessage()
- func (m *GenesisEntries) Reset()
- func (m *GenesisEntries) Size() (n int)
- func (m *GenesisEntries) String() string
- func (m *GenesisEntries) Unmarshal(dAtA []byte) error
- func (m *GenesisEntries) XXX_DiscardUnknown()
- func (m *GenesisEntries) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GenesisEntries) XXX_Merge(src proto.Message)
- func (m *GenesisEntries) XXX_Size() int
- func (m *GenesisEntries) XXX_Unmarshal(b []byte) error
- type GenesisState
- func (*GenesisState) Descriptor() ([]byte, []int)
- func (m *GenesisState) GetEntries() []GenesisEntries
- func (m *GenesisState) GetTimerstore() []RawMessage
- func (m *GenesisState) GetVersion() uint64
- func (m *GenesisState) Marshal() (dAtA []byte, err error)
- func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)
- func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*GenesisState) ProtoMessage()
- func (m *GenesisState) Reset()
- func (m *GenesisState) Size() (n int)
- func (m *GenesisState) String() string
- func (m *GenesisState) Unmarshal(dAtA []byte) error
- func (m *GenesisState) XXX_DiscardUnknown()
- func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GenesisState) XXX_Merge(src proto.Message)
- func (m *GenesisState) XXX_Size() int
- func (m *GenesisState) XXX_Unmarshal(b []byte) error
- type RawMessage
- func (*RawMessage) Descriptor() ([]byte, []int)
- func (m *RawMessage) GetKey() []byte
- func (m *RawMessage) GetValue() []byte
- func (m *RawMessage) Marshal() (dAtA []byte, err error)
- func (m *RawMessage) MarshalTo(dAtA []byte) (int, error)
- func (m *RawMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*RawMessage) ProtoMessage()
- func (m *RawMessage) Reset()
- func (m *RawMessage) Size() (n int)
- func (m *RawMessage) String() string
- func (m *RawMessage) Unmarshal(dAtA []byte) error
- func (m *RawMessage) XXX_DiscardUnknown()
- func (m *RawMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *RawMessage) XXX_Merge(src proto.Message)
- func (m *RawMessage) XXX_Size() int
- func (m *RawMessage) XXX_Unmarshal(b []byte) error
- type SafeIndex
- type TimerType
Constants ¶
const ( ASCII_MIN = 32 // min visible ascii ASCII_MAX = 126 // max visible ascii ASCII_DEL = 127 // ascii for DEL )
const ( STALE_ENTRY_TIME = 1440 // 1440 blocks (equivalent to 24 hours when block_time = 1min) MODULE_NAME string = "common" )
const ( FixationVersionKey = "Entry_Version" EntryIndexPrefix = "Entry_Index_" EntryPrefix = "Entry_Value_" )
const ( TimerVersionKey = "Timer_Version" NextTimerPrefix = "Timer_Next_" TimerPrefix = "Timer_Value_" )
const (
NAME_RESTRICTIONS charRestrictionEnum = "name"
)
Variables ¶
var ( ErrInvalidLengthFixationEntry = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowFixationEntry = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupFixationEntry = fmt.Errorf("proto: unexpected end of group") )
var ( // use single byte to save storage. // (value cannot be part of a valid index) EntryIndexLive = []byte{1} EntryIndexDead = []byte{2} )
var (
ErrInvalidIndex = sdkerrors.Register(MODULE_NAME, 1, "entry index is invalid")
)
x/pairing module sentinel errors
var NextTimerKey = []string{
"NextBlock",
"NextDate",
}
var TimerTypePrefix = []string{
"Block_",
"Time_",
}
Functions ¶
func AssertSanitizedIndex ¶ added in v0.10.0
func DecodeBlockAndKey ¶ added in v0.12.0
func DesanitizeIndex ¶ added in v0.10.0
desantizeIndex reverts the effect of SanitizeIndex - removes the trailing (ascii) DEL terminator.
func EncodeBlockAndKey ¶ added in v0.12.0
func IsEntryIndexLive ¶ added in v0.13.0
IsEntryIndexLive tests whether an entry-index is live
func ValidateString ¶
Validates name strings. Current policy:
name: lowercase ascii letters and digits only and the characters {' ', '_'}. can't be empty.
Types ¶
type Entry ¶ added in v0.7.0
type Entry struct { Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` Block uint64 `protobuf:"varint,2,opt,name=block,proto3" json:"block,omitempty"` StaleAt uint64 `protobuf:"varint,3,opt,name=stale_at,json=staleAt,proto3" json:"stale_at,omitempty"` Refcount uint64 `protobuf:"varint,4,opt,name=refcount,proto3" json:"refcount,omitempty"` Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` DeleteAt uint64 `protobuf:"varint,6,opt,name=delete_at,json=deleteAt,proto3" json:"delete_at,omitempty"` IsLatest bool `protobuf:"varint,7,opt,name=is_latest,json=isLatest,proto3" json:"is_latest,omitempty"` }
func (*Entry) Descriptor ¶ added in v0.7.0
func (*Entry) GetDeleteAt ¶ added in v0.13.0
func (*Entry) GetIsLatest ¶ added in v0.20.4
func (*Entry) GetRefcount ¶ added in v0.7.0
func (*Entry) GetStaleAt ¶ added in v0.8.1
func (Entry) HasDeleteAt ¶ added in v0.13.0
HasDeleteAt tests whether an entry is marked for deletion, i.e. has entry.Deleted != math.MaxUint64.
func (Entry) IsDeleted ¶ added in v0.13.0
IsDeleted tests whether an entry is currently deleted, i.e. has its entry.DeleteAt below the current ctx block height.
func (Entry) IsDeletedBy ¶ added in v0.13.0
IsDeletedBy tests whether an entry is deleted, with respect to a given block, i.e. has entry.DeletAt smaller or equal to that that block.
func (Entry) IsStale ¶ added in v0.8.1
IsStale tests whether an entry is currently stale, i.e. has refcount zero _and_ has passed its stale_at time (more than STALE_ENTRY_TIME since deletion).
func (Entry) IsStaleBy ¶ added in v0.13.0
IsStaleBy tests whether an entry is stale, i.e. has refcount zero _and_ has passed its stale_at time (more than STALE_ENTRY_TIME since deletion).
func (*Entry) MarshalToSizedBuffer ¶ added in v0.7.0
func (*Entry) ProtoMessage ¶ added in v0.7.0
func (*Entry) ProtoMessage()
func (*Entry) XXX_DiscardUnknown ¶ added in v0.7.0
func (m *Entry) XXX_DiscardUnknown()
func (*Entry) XXX_Marshal ¶ added in v0.7.0
func (*Entry) XXX_Unmarshal ¶ added in v0.7.0
type GenesisEntries ¶ added in v0.22.0
type GenesisEntries struct { Index string `protobuf:"bytes,2,opt,name=index,proto3" json:"index,omitempty"` IsLive bool `protobuf:"varint,3,opt,name=is_live,json=isLive,proto3" json:"is_live,omitempty"` Entries []Entry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries"` }
func (*GenesisEntries) Descriptor ¶ added in v0.22.0
func (*GenesisEntries) Descriptor() ([]byte, []int)
func (*GenesisEntries) GetEntries ¶ added in v0.22.0
func (m *GenesisEntries) GetEntries() []Entry
func (*GenesisEntries) GetIndex ¶ added in v0.22.0
func (m *GenesisEntries) GetIndex() string
func (*GenesisEntries) GetIsLive ¶ added in v0.22.0
func (m *GenesisEntries) GetIsLive() bool
func (*GenesisEntries) Marshal ¶ added in v0.22.0
func (m *GenesisEntries) Marshal() (dAtA []byte, err error)
func (*GenesisEntries) MarshalTo ¶ added in v0.22.0
func (m *GenesisEntries) MarshalTo(dAtA []byte) (int, error)
func (*GenesisEntries) MarshalToSizedBuffer ¶ added in v0.22.0
func (m *GenesisEntries) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*GenesisEntries) ProtoMessage ¶ added in v0.22.0
func (*GenesisEntries) ProtoMessage()
func (*GenesisEntries) Reset ¶ added in v0.22.0
func (m *GenesisEntries) Reset()
func (*GenesisEntries) Size ¶ added in v0.22.0
func (m *GenesisEntries) Size() (n int)
func (*GenesisEntries) String ¶ added in v0.22.0
func (m *GenesisEntries) String() string
func (*GenesisEntries) Unmarshal ¶ added in v0.22.0
func (m *GenesisEntries) Unmarshal(dAtA []byte) error
func (*GenesisEntries) XXX_DiscardUnknown ¶ added in v0.22.0
func (m *GenesisEntries) XXX_DiscardUnknown()
func (*GenesisEntries) XXX_Marshal ¶ added in v0.22.0
func (m *GenesisEntries) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GenesisEntries) XXX_Merge ¶ added in v0.22.0
func (m *GenesisEntries) XXX_Merge(src proto.Message)
func (*GenesisEntries) XXX_Size ¶ added in v0.22.0
func (m *GenesisEntries) XXX_Size() int
func (*GenesisEntries) XXX_Unmarshal ¶ added in v0.22.0
func (m *GenesisEntries) XXX_Unmarshal(b []byte) error
type GenesisState ¶ added in v0.22.0
type GenesisState struct { Version uint64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` Entries []GenesisEntries `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries"` Timerstore []RawMessage `protobuf:"bytes,3,rep,name=timerstore,proto3" json:"timerstore"` }
func (*GenesisState) Descriptor ¶ added in v0.22.0
func (*GenesisState) Descriptor() ([]byte, []int)
func (*GenesisState) GetEntries ¶ added in v0.22.0
func (m *GenesisState) GetEntries() []GenesisEntries
func (*GenesisState) GetTimerstore ¶ added in v0.22.0
func (m *GenesisState) GetTimerstore() []RawMessage
func (*GenesisState) GetVersion ¶ added in v0.22.0
func (m *GenesisState) GetVersion() uint64
func (*GenesisState) Marshal ¶ added in v0.22.0
func (m *GenesisState) Marshal() (dAtA []byte, err error)
func (*GenesisState) MarshalTo ¶ added in v0.22.0
func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)
func (*GenesisState) MarshalToSizedBuffer ¶ added in v0.22.0
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*GenesisState) ProtoMessage ¶ added in v0.22.0
func (*GenesisState) ProtoMessage()
func (*GenesisState) Reset ¶ added in v0.22.0
func (m *GenesisState) Reset()
func (*GenesisState) Size ¶ added in v0.22.0
func (m *GenesisState) Size() (n int)
func (*GenesisState) String ¶ added in v0.22.0
func (m *GenesisState) String() string
func (*GenesisState) Unmarshal ¶ added in v0.22.0
func (m *GenesisState) Unmarshal(dAtA []byte) error
func (*GenesisState) XXX_DiscardUnknown ¶ added in v0.22.0
func (m *GenesisState) XXX_DiscardUnknown()
func (*GenesisState) XXX_Marshal ¶ added in v0.22.0
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GenesisState) XXX_Merge ¶ added in v0.22.0
func (m *GenesisState) XXX_Merge(src proto.Message)
func (*GenesisState) XXX_Size ¶ added in v0.22.0
func (m *GenesisState) XXX_Size() int
func (*GenesisState) XXX_Unmarshal ¶ added in v0.22.0
func (m *GenesisState) XXX_Unmarshal(b []byte) error
type RawMessage ¶ added in v0.14.1
type RawMessage 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 (*RawMessage) Descriptor ¶ added in v0.14.1
func (*RawMessage) Descriptor() ([]byte, []int)
func (*RawMessage) GetKey ¶ added in v0.14.1
func (m *RawMessage) GetKey() []byte
func (*RawMessage) GetValue ¶ added in v0.14.1
func (m *RawMessage) GetValue() []byte
func (*RawMessage) Marshal ¶ added in v0.14.1
func (m *RawMessage) Marshal() (dAtA []byte, err error)
func (*RawMessage) MarshalTo ¶ added in v0.14.1
func (m *RawMessage) MarshalTo(dAtA []byte) (int, error)
func (*RawMessage) MarshalToSizedBuffer ¶ added in v0.14.1
func (m *RawMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*RawMessage) ProtoMessage ¶ added in v0.14.1
func (*RawMessage) ProtoMessage()
func (*RawMessage) Reset ¶ added in v0.14.1
func (m *RawMessage) Reset()
func (*RawMessage) Size ¶ added in v0.14.1
func (m *RawMessage) Size() (n int)
func (*RawMessage) String ¶ added in v0.14.1
func (m *RawMessage) String() string
func (*RawMessage) Unmarshal ¶ added in v0.14.1
func (m *RawMessage) Unmarshal(dAtA []byte) error
func (*RawMessage) XXX_DiscardUnknown ¶ added in v0.14.1
func (m *RawMessage) XXX_DiscardUnknown()
func (*RawMessage) XXX_Marshal ¶ added in v0.14.1
func (m *RawMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*RawMessage) XXX_Merge ¶ added in v0.14.1
func (m *RawMessage) XXX_Merge(src proto.Message)
func (*RawMessage) XXX_Size ¶ added in v0.14.1
func (m *RawMessage) XXX_Size() int
func (*RawMessage) XXX_Unmarshal ¶ added in v0.14.1
func (m *RawMessage) XXX_Unmarshal(b []byte) error
type SafeIndex ¶ added in v0.20.0
type SafeIndex string
SafeIndex is a sanitized string, i.e. contains only visible ascii characters (i.e. Ascii 32-126), and terminates with (ascii) DEL; this ensures that an index can never be a prefix of another index.
func SanitizeIndex ¶ added in v0.10.0
sanitizeIndex checks that a string contains only visible ascii characters (i.e. Ascii 32-126), and appends a (ascii) DEL to the index; this ensures that an index can never be a prefix of another index.