queue

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Actions = "Action"

	DirectQueue = "DirectQueue"
	MainQueue   = "MainQueue"
	BackupQueue = "BackupQueue"
)

Variables

View Source
var ErrInvalidQueueID = errors.New("invalid queue id")

ErrInvalidQueueID is returned when an unrecognized queue ID is provided.

Functions

func DirectInstructionToAction

func DirectInstructionToAction(i *types.DirectInstruction) (*types.Action, error)

DirectInstructionToAction converts a DirectInstruction into an Action with a randomly generated ID.

func PrepareDirectAction

func PrepareDirectAction(opType op.Type, opCommand op.Command, msg []byte) (*types.Action, error)

PrepareDirectAction prepares an action with direct instruction.

With type "direct" and submission tag "submit".

Types

type ActionQueues

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

ActionQueues manages direct, main, and backup Redis-backed queues for action submission.

func NewActionQueues

func NewActionQueues(client *redis.Client) *ActionQueues

NewActionQueues creates a new ActionQueues backed by the given Redis client.

func (*ActionQueues) Dequeue

func (as *ActionQueues) Dequeue(ctx context.Context, queueID processorutils.QueueID) (*types.Action, error)

Dequeue dequeues action from indicated queue. If no action is available, wrapped ErrEmptyQueue is dequeued.

func (*ActionQueues) Enqueue

func (as *ActionQueues) Enqueue(ctx context.Context, action *types.Action, queueID processorutils.QueueID) error

Enqueue stores the action and appends its submission ID to the indicated queue.

func (*ActionQueues) QueueLength

func (as *ActionQueues) QueueLength(ctx context.Context) (int64, error)

QueueLength returns the number of elements in the main queue.

type ActionSubmissionID

type ActionSubmissionID struct {
	ActionID      common.Hash
	SubmissionTag types.SubmissionTag
}

ActionSubmissionID uniquely identifies an action by its action ID and submission tag.

func (*ActionSubmissionID) String

func (id *ActionSubmissionID) String() string

String returns a combined string representation of the action ID and submission tag.

Jump to

Keyboard shortcuts

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