types

package
v0.27.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FixationVersionKey = "Entry_Version"
	EntryIndexPrefix   = "Entry_Index_"
	EntryPrefix        = "Entry_Value_"
)
View Source
const (
	TimerVersionKey = "Timer_Version"
	NextTimerPrefix = "Timer_Next_"
	TimerPrefix     = "Timer_Value_"
)
View Source
const (
	MODULE_NAME string = "fixationstore"
)

Variables

View Source
var (
	ErrInvalidLengthFixation        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowFixation          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupFixation = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// use single byte to save storage.
	// (value cannot be part of a valid index)
	EntryIndexLive = []byte{1}
	EntryIndexDead = []byte{2}
)
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

func AssertSanitizedIndex(safeIndex SafeIndex, prefix string)

func DecodeBlockAndKey

func DecodeBlockAndKey(encodedKey []byte) (uint64, []byte)

func DecodeKey

func DecodeKey(encodedKey []byte) uint64

func DesanitizeIndex

func DesanitizeIndex(safeIndex SafeIndex) string

desantizeIndex reverts the effect of SanitizeIndex - removes the trailing (ascii) DEL terminator.

func EncodeBlockAndKey

func EncodeBlockAndKey(block uint64, key []byte) []byte

func EncodeKey

func EncodeKey(key uint64) []byte

func IsEntryIndexLive

func IsEntryIndexLive(value []byte) bool

IsEntryIndexLive tests whether an entry-index is live

func KeyPrefix

func KeyPrefix(p string) []byte

Types

type Entry

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

func (*Entry) Descriptor() ([]byte, []int)

func (*Entry) GetBlock

func (m *Entry) GetBlock() uint64

func (*Entry) GetData

func (m *Entry) GetData() []byte

func (*Entry) GetDeleteAt

func (m *Entry) GetDeleteAt() uint64

func (*Entry) GetIndex

func (m *Entry) GetIndex() string

func (*Entry) GetIsLatest

func (m *Entry) GetIsLatest() bool

func (*Entry) GetRefcount

func (m *Entry) GetRefcount() uint64

func (*Entry) GetStaleAt

func (m *Entry) GetStaleAt() uint64

func (Entry) HasDeleteAt

func (entry Entry) HasDeleteAt() bool

HasDeleteAt tests whether an entry is marked for deletion, i.e. has entry.Deleted != math.MaxUint64.

func (Entry) IsDeleted

func (entry Entry) IsDeleted(ctx sdk.Context) bool

IsDeleted tests whether an entry is currently deleted, i.e. has its entry.DeleteAt below the current ctx block height.

func (Entry) IsDeletedBy

func (entry Entry) IsDeletedBy(block uint64) bool

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

func (entry Entry) IsStale(ctx sdk.Context) bool

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

func (entry Entry) IsStaleBy(block uint64) bool

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) Marshal

func (m *Entry) Marshal() (dAtA []byte, err error)

func (*Entry) MarshalTo

func (m *Entry) MarshalTo(dAtA []byte) (int, error)

func (*Entry) MarshalToSizedBuffer

func (m *Entry) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Entry) ProtoMessage

func (*Entry) ProtoMessage()

func (*Entry) Reset

func (m *Entry) Reset()

func (Entry) SafeIndex

func (entry Entry) SafeIndex() SafeIndex

SafeIndex returns the entry's index.

func (*Entry) Size

func (m *Entry) Size() (n int)

func (*Entry) String

func (m *Entry) String() string

func (*Entry) Unmarshal

func (m *Entry) Unmarshal(dAtA []byte) error

func (*Entry) XXX_DiscardUnknown

func (m *Entry) XXX_DiscardUnknown()

func (*Entry) XXX_Marshal

func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Entry) XXX_Merge

func (m *Entry) XXX_Merge(src proto.Message)

func (*Entry) XXX_Size

func (m *Entry) XXX_Size() int

func (*Entry) XXX_Unmarshal

func (m *Entry) XXX_Unmarshal(b []byte) error

type EpochstorageKeeper

type EpochstorageKeeper interface {
	BlocksToSaveRaw(ctx sdk.Context) (res uint64)
}

type GenesisEntries

type GenesisEntries struct {
	Index   string  `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
	IsLive  bool    `protobuf:"varint,2,opt,name=is_live,json=isLive,proto3" json:"is_live,omitempty"`
	Entries []Entry `protobuf:"bytes,3,rep,name=entries,proto3" json:"entries"`
}

func (*GenesisEntries) Descriptor

func (*GenesisEntries) Descriptor() ([]byte, []int)

func (*GenesisEntries) GetEntries

func (m *GenesisEntries) GetEntries() []Entry

func (*GenesisEntries) GetIndex

func (m *GenesisEntries) GetIndex() string

func (*GenesisEntries) GetIsLive

func (m *GenesisEntries) GetIsLive() bool

func (*GenesisEntries) Marshal

func (m *GenesisEntries) Marshal() (dAtA []byte, err error)

func (*GenesisEntries) MarshalTo

func (m *GenesisEntries) MarshalTo(dAtA []byte) (int, error)

func (*GenesisEntries) MarshalToSizedBuffer

func (m *GenesisEntries) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisEntries) ProtoMessage

func (*GenesisEntries) ProtoMessage()

func (*GenesisEntries) Reset

func (m *GenesisEntries) Reset()

func (*GenesisEntries) Size

func (m *GenesisEntries) Size() (n int)

func (*GenesisEntries) String

func (m *GenesisEntries) String() string

func (*GenesisEntries) Unmarshal

func (m *GenesisEntries) Unmarshal(dAtA []byte) error

func (*GenesisEntries) XXX_DiscardUnknown

func (m *GenesisEntries) XXX_DiscardUnknown()

func (*GenesisEntries) XXX_Marshal

func (m *GenesisEntries) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisEntries) XXX_Merge

func (m *GenesisEntries) XXX_Merge(src proto.Message)

func (*GenesisEntries) XXX_Size

func (m *GenesisEntries) XXX_Size() int

func (*GenesisEntries) XXX_Unmarshal

func (m *GenesisEntries) XXX_Unmarshal(b []byte) error

type GenesisState

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 types.GenesisState `protobuf:"bytes,3,opt,name=timerstore,proto3" json:"timerstore"`
}

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetEntries

func (m *GenesisState) GetEntries() []GenesisEntries

func (*GenesisState) GetTimerstore

func (m *GenesisState) GetTimerstore() types.GenesisState

func (*GenesisState) GetVersion

func (m *GenesisState) GetVersion() uint64

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type SafeIndex

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

func SanitizeIndex(index string) (SafeIndex, error)

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.

type TimerType added in v0.25.0

type TimerType int
const (
	BlockHeight TimerType = iota
	BlockTime
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL