common

package
v0.20.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FixationVersion added in v0.13.0

func FixationVersion() uint64

func TimerVersion added in v0.10.0

func TimerVersion() uint64

TimerVersion returns the timer library version

Types

type FixationStore

type FixationStore struct {
	// contains filtered or unexported fields
}

func NewFixationStore

func NewFixationStore(storeKey storetypes.StoreKey, cdc codec.BinaryCodec, prefix string) *FixationStore

NewFixationStore returns a new FixationStore object

func (*FixationStore) AdvanceBlock added in v0.10.0

func (fs *FixationStore) AdvanceBlock(ctx sdk.Context)

func (FixationStore) AllEntryIndicesFilter added in v0.13.0

func (fs FixationStore) AllEntryIndicesFilter(ctx sdk.Context, prefix string, filter func(k, v []byte) bool) []string

AllEntryIndicesFilter returns all Entry indices with a given prefix and filtered by the given filter function.

func (*FixationStore) AppendEntry

func (fs *FixationStore) AppendEntry(
	ctx sdk.Context,
	index string,
	block uint64,
	entryData codec.ProtoMarshaler,
) error

AppendEntry adds a new entry to the store

func (*FixationStore) DelEntry added in v0.13.0

func (fs *FixationStore) DelEntry(ctx sdk.Context, index string, block uint64) error

DelEntry marks the entry for deletion so that future GetEntry will not find it anymore. (Cleanup of the EntryIndex is done when the last reference is removed).

func (*FixationStore) Export added in v0.14.1

func (fs *FixationStore) Export(ctx sdk.Context) []types.RawMessage

func (*FixationStore) FindEntry

func (fs *FixationStore) FindEntry(ctx sdk.Context, index string, block uint64, entryData codec.ProtoMarshaler) bool

FindEntry returns the entry by index and block without changing the refcount

func (*FixationStore) FindEntry2 added in v0.20.0

func (fs *FixationStore) FindEntry2(ctx sdk.Context, index string, block uint64, entryData codec.ProtoMarshaler) (uint64, bool)

FindEntry2 returns the entry by index and block without changing the refcount

func (FixationStore) GetAllEntryIndices

func (fs FixationStore) GetAllEntryIndices(ctx sdk.Context) []string

GetAllEntryIndices returns all Entry indices

func (FixationStore) GetAllEntryIndicesWithPrefix added in v0.10.0

func (fs FixationStore) GetAllEntryIndicesWithPrefix(ctx sdk.Context, prefix string) []string

GetAllEntryIndicesWithPrefix returns all Entry indices with a given prefix

func (*FixationStore) GetAllEntryVersions added in v0.10.0

func (fs *FixationStore) GetAllEntryVersions(ctx sdk.Context, index string) (blocks []uint64)

GetAllEntryVersions returns a list of all versions (blocks) of an entry, for use in testing and migrations (includes stale and deleted entry versions).

func (*FixationStore) GetEntry

func (fs *FixationStore) GetEntry(ctx sdk.Context, index string, entryData codec.ProtoMarshaler) bool

GetEntry returns the latest entry by index and increments the refcount (while ignoring entries in stale-period)

func (*FixationStore) GetEntryVersionsRange added in v0.12.0

func (fs *FixationStore) GetEntryVersionsRange(ctx sdk.Context, index string, block, delta uint64) (blocks []uint64)

GetEntryVersionsRange returns a list of versions from nearest-no-later block and onward, and not more than delta blocks further (skip stale entries).

func (*FixationStore) HasEntry added in v0.20.0

func (fs *FixationStore) HasEntry(ctx sdk.Context, index string, block uint64) bool

HasEntry returns true if an entry version exists for the given index, block tuple (any kind of entry, even deleted or stale).

func (*FixationStore) Init added in v0.14.1

func (fs *FixationStore) Init(ctx sdk.Context, data []types.RawMessage)

func (*FixationStore) IsEntryStale added in v0.20.0

func (fs *FixationStore) IsEntryStale(ctx sdk.Context, index string, block uint64) bool

IsEntryStale returns true if an entry version exists and is stale.

func (*FixationStore) MigrateVersion added in v0.10.0

func (fs *FixationStore) MigrateVersion(ctx sdk.Context) (err error)

MigrateVerrsion performs pending internal version migration(s), if any.

func (*FixationStore) MigrateVersionAndPrefix added in v0.12.0

func (fs *FixationStore) MigrateVersionAndPrefix(ctx sdk.Context, oldPrefix string) (err error)

MigrateVersionAndPrefix performs pending internal version migration(s), if any, and then replaces the old prefix with a new (current) one. (For the version migration(s) it uses the old prefix).

func (*FixationStore) ModifyEntry

func (fs *FixationStore) ModifyEntry(ctx sdk.Context, index string, block uint64, entryData codec.ProtoMarshaler)

ModifyEntry modifies an existing entry in the store (should be called only for existing entries; will panic otherwise)

func (*FixationStore) PutEntry

func (fs *FixationStore) PutEntry(ctx sdk.Context, index string, block uint64)

PutEntry finds the entry by index and block and decrements the refcount (should be called only for existing entries; will panic otherwise)

func (*FixationStore) ReadEntry added in v0.12.0

func (fs *FixationStore) ReadEntry(ctx sdk.Context, index string, block uint64, entryData codec.ProtoMarshaler)

ReadEntry returns and existing entry with index and specific block (should be called only for existing entries; will panic otherwise)

type TimerCallback added in v0.10.0

type TimerCallback func(ctx sdk.Context, key []byte, data []byte)

TimerCallback defined the callback handler function

type TimerStore added in v0.10.0

type TimerStore struct {
	// contains filtered or unexported fields
}

TimerStore represents a timer store to manager timers and timeouts

func NewTimerStore added in v0.10.0

func NewTimerStore(storeKey storetypes.StoreKey, cdc codec.BinaryCodec, prefix string) *TimerStore

NewTimerStore returns a new TimerStore object

func (*TimerStore) AddTimerByBlockHeight added in v0.10.0

func (tstore *TimerStore) AddTimerByBlockHeight(ctx sdk.Context, block uint64, key []byte, data []byte)

AddTimerByBlockHeight adds a new timer to expire on a given block height. If a timer for that <block, key> tuple exists, it will be overridden.

func (*TimerStore) AddTimerByBlockTime added in v0.10.0

func (tstore *TimerStore) AddTimerByBlockTime(ctx sdk.Context, timestamp uint64, key []byte, data []byte)

AddTimerByBlockTime adds a new timer to expire on a future block with the given timestamp. If a timer for that <timestamp, key> tuple exists, it will be overridden.

func (*TimerStore) DelTimerByBlockHeight added in v0.12.0

func (tstore *TimerStore) DelTimerByBlockHeight(ctx sdk.Context, block uint64, key []byte)

DelTimerByBlockHeight removes an existing timer for the <block, key> tuple.

func (*TimerStore) DelTimerByBlockTime added in v0.12.0

func (tstore *TimerStore) DelTimerByBlockTime(ctx sdk.Context, timestamp uint64, key []byte)

DelTimerByBlockTime removes an existing timer for the <timestamp, key> tuple.

func (*TimerStore) DumpAllTimers added in v0.12.0

func (tstore *TimerStore) DumpAllTimers(ctx sdk.Context, which types.TimerType) string

DumpAllTimers dumps the details of all existing timers (of a type) into a string (for test/debug).

func (*TimerStore) Export added in v0.20.1

func (tstore *TimerStore) Export(ctx sdk.Context) []types.RawMessage

func (*TimerStore) HasTimerByBlockHeight added in v0.20.0

func (tstore *TimerStore) HasTimerByBlockHeight(ctx sdk.Context, block uint64, key []byte) bool

HasTimerByBlockHeight checks whether a timer exists for the <block, key> tuple.

func (*TimerStore) HasTimerByBlockTime added in v0.20.0

func (tstore *TimerStore) HasTimerByBlockTime(ctx sdk.Context, timestamp uint64, key []byte) bool

HasTimerByBlockTime checks whether a timer exists for the <timestamp, key> tuple.

func (*TimerStore) Init added in v0.20.1

func (tstore *TimerStore) Init(ctx sdk.Context, data []types.RawMessage)

func (*TimerStore) MigrateVersion added in v0.10.0

func (tstore *TimerStore) MigrateVersion(ctx sdk.Context) (err error)

func (*TimerStore) Tick added in v0.10.0

func (tstore *TimerStore) Tick(ctx sdk.Context)

Tick advances the timer by a block. It should be called at the beginning of each block.

func (*TimerStore) WithCallbackByBlockHeight added in v0.10.0

func (tstore *TimerStore) WithCallbackByBlockHeight(callback TimerCallback) *TimerStore

WithCallbackByBlockHeight sets a callback handler for timeouts (by block height)

func (*TimerStore) WithCallbackByBlockTime added in v0.10.0

func (tstore *TimerStore) WithCallbackByBlockTime(callback TimerCallback) *TimerStore

WithCallbackByBlockHeight sets a callback handler for timeouts (by block timestamp)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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