Documentation
¶
Index ¶
Constants ¶
const ( Actions = "Action" DirectQueue = "DirectQueue" MainQueue = "MainQueue" BackupQueue = "BackupQueue" )
Variables ¶
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.
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.