Documentation ¶
Index ¶
- Constants
- Variables
- func AssertSanitizedIndex(safeIndex string, prefix string)
- func DecodeKey(encodedKey []byte) uint64
- func DesanitizeIndex(safeIndex string) string
- func EncodeKey(key uint64) []byte
- func FindMax[T constraints.Ordered](s []T) T
- func FindMin[T constraints.Ordered](s []T) T
- func FixationVersion() uint64
- func IsASCII(s string) bool
- func KeyPrefix(p string) []byte
- func ReadYaml(filePath string, primaryKey string, content interface{}) error
- func SanitizeIndex(index string) (string, error)
- type Entry
- func (*Entry) Descriptor() ([]byte, []int)
- func (m *Entry) GetBlock() uint64
- func (m *Entry) GetData() []byte
- func (m *Entry) GetIndex() string
- func (m *Entry) GetRefcount() uint64
- func (m *Entry) GetStaleAt() uint64
- func (entry Entry) IsStale(ctx sdk.Context) 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 (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 TimerType
Constants ¶
View Source
const ( ASCII_MIN = 32 // min visible ascii ASCII_MAX = 126 // max visible ascii ASCII_DEL = 127 // ascii for DEL )
View Source
const ( STALE_ENTRY_TIME int64 = 1440 // 1440 blocks (equivalent to 24 hours when block_time = 1min) MODULE_NAME string = "common" )
View Source
const ( FixationVersionKey = "Entry_Version" EntryIndexPrefix = "Entry_Index_" EntryPrefix = "Entry_Value_" )
View Source
const ( TimerVersionKey = "Entry_Version" NextTimerPrefix = "Timer_Next_" TimerPrefix = "Timer_Value_" )
Variables ¶
View Source
var ( ErrInvalidLengthFixationEntry = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowFixationEntry = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupFixationEntry = fmt.Errorf("proto: unexpected end of group") )
View Source
var (
ErrInvalidIndex = sdkerrors.Register(MODULE_NAME, 1, "entry index is invalid")
)
x/pairing module sentinel errors
View Source
var NextTimerKey = []string{
"NextBlock",
"NextDate",
}
View Source
var TimerTypePrefix = []string{
"Block_",
"Time_",
}
Functions ¶
func AssertSanitizedIndex ¶ added in v0.10.0
func DesanitizeIndex ¶ added in v0.10.0
desantizeIndex reverts the effect of sanitizeIndex - removes the trailing (ascii) DEL terminator.
func FindMax ¶ added in v0.10.0
func FindMax[T constraints.Ordered](s []T) T
func FindMin ¶ added in v0.10.0
func FindMin[T constraints.Ordered](s []T) T
func FixationVersion ¶ added in v0.10.0
func FixationVersion() uint64
func SanitizeIndex ¶ added in v0.10.0
sanitizeIdnex 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.
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"` }
func (*Entry) Descriptor ¶ added in v0.7.0
func (*Entry) GetRefcount ¶ added in v0.7.0
func (*Entry) GetStaleAt ¶ added in v0.8.1
func (Entry) IsStale ¶ added in v0.8.1
IsEntryStale 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
Click to show internal directories.
Click to hide internal directories.