queue

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PayoutTimeoutQueue

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

func NewPayoutTimeoutQueue

func NewPayoutTimeoutQueue(builder *collections.SchemaBuilder) *PayoutTimeoutQueue

func (*PayoutTimeoutQueue) Dequeue

func (p *PayoutTimeoutQueue) Dequeue(ctx sdk.Context, periodTimeout int64, vaultAddr sdk.AccAddress) error

Dequeue removes a specific timeout entry (periodTimeout, vault) from the PayoutTimeoutQueue.

func (*PayoutTimeoutQueue) Enqueue

func (p *PayoutTimeoutQueue) Enqueue(ctx sdk.Context, periodTimeout int64, vaultAddr sdk.AccAddress) error

Enqueue schedules a vault for timeout processing by inserting an entry into the PayoutTimeoutQueue keyed by (periodTimeout, vault address).

func (*PayoutTimeoutQueue) RemoveAllForVault

func (p *PayoutTimeoutQueue) RemoveAllForVault(ctx sdk.Context, vaultAddr sdk.AccAddress) error

RemoveAllForVault deletes all timeout entries in the PayoutTimeoutQueue for the given vault address.

func (*PayoutTimeoutQueue) Walk

func (p *PayoutTimeoutQueue) Walk(ctx sdk.Context, fn func(periodTimeout uint64, vaultAddr sdk.AccAddress) (stop bool, err error)) error

Walk iterates over all entries in the PayoutTimeoutQueue. Iteration stops when the callback returns stop=true or an error.

func (*PayoutTimeoutQueue) WalkDue

func (p *PayoutTimeoutQueue) WalkDue(ctx sdk.Context, nowSec int64, fn func(periodTimeout uint64, vaultAddr sdk.AccAddress) (stop bool, err error)) error

WalkDue iterates over all entries in the PayoutTimeoutQueue with a timeout timestamp <= nowSec. For each due entry, the callback is invoked. Iteration stops when a key with time > nowSec is encountered (since keys are ordered) or when the callback returns stop=true or an error.

type PendingSwapOutIndexes

PendingSwapOutIndexes defines the indexes for the pending swap out queue.

func NewPendingSwapOutIndexes

func NewPendingSwapOutIndexes(sb *collections.SchemaBuilder) PendingSwapOutIndexes

NewPendingSwapOutIndexes creates a new PendingSwapOutIndexes object.

func (PendingSwapOutIndexes) IndexesList

IndexesList returns the list of indexes for the pending swap out queue.

type PendingSwapOutQueue

type PendingSwapOutQueue struct {
	// IndexedMap is the indexed map of pending swap outs. The key is a triple of (timestamp, id, vault).
	IndexedMap *collections.IndexedMap[collections.Triple[int64, uint64, sdk.AccAddress], types.PendingSwapOut, PendingSwapOutIndexes]
	// Sequence is the sequence for generating unique swap out IDs.
	Sequence collections.Sequence
}

PendingSwapOutQueue is a queue for pending swap outs.

func NewPendingSwapOutQueue

func NewPendingSwapOutQueue(builder *collections.SchemaBuilder, cdc codec.BinaryCodec) *PendingSwapOutQueue

NewPendingSwapOutQueue creates a new PendingSwapOutQueue.

func (*PendingSwapOutQueue) Dequeue

func (p *PendingSwapOutQueue) Dequeue(ctx context.Context, timestamp int64, vault sdk.AccAddress, id uint64) error

Dequeue removes a pending swap out from the queue.

func (*PendingSwapOutQueue) Enqueue

func (p *PendingSwapOutQueue) Enqueue(ctx context.Context, pendingTime int64, req *types.PendingSwapOut) (uint64, error)

Enqueue adds a pending swap out to the queue.

func (*PendingSwapOutQueue) ExpediteSwapOut

func (p *PendingSwapOutQueue) ExpediteSwapOut(ctx context.Context, id uint64) error

ExpediteSwapOut sets the timestamp of a pending swap out to 0.

func (*PendingSwapOutQueue) Export

Export exports the pending swap out queue to genesis.

func (*PendingSwapOutQueue) GetByID

GetByID gets the pending swap out by ID.

func (*PendingSwapOutQueue) Import

Import imports the pending swap out queue from genesis.

func (*PendingSwapOutQueue) Walk

func (p *PendingSwapOutQueue) Walk(ctx context.Context, fn func(timestamp int64, id uint64, vault sdk.AccAddress, req types.PendingSwapOut) (stop bool, err error)) error

Walk iterates over all entries in the PendingSwapOutQueue. Iteration stops when the callback returns stop=true or an error.

func (*PendingSwapOutQueue) WalkByVault

func (p *PendingSwapOutQueue) WalkByVault(ctx context.Context, vaultAddr sdk.AccAddress, fn func(timestamp int64, id uint64, req types.PendingSwapOut) (stop bool, err error)) error

WalkByVault iterates over all entries in the PendingSwapOutQueue for a specific vault. Iteration stops when the callback returns stop=true or an error.

func (*PendingSwapOutQueue) WalkDue

func (p *PendingSwapOutQueue) WalkDue(ctx context.Context, now int64, fn func(timestamp int64, id uint64, vault sdk.AccAddress, req types.PendingSwapOut) (stop bool, err error)) error

WalkDue iterates over all entries in the PendingSwapOutQueue with a timestamp <= now. For each due entry, the callback is invoked. Iteration stops when a key with time > now is encountered (since keys are ordered) or when the callback returns stop=true or an error.

Jump to

Keyboard shortcuts

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