queue

package
v0.46.2-util-print-rec... Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KiB = 1 << (10 * iota)
	MiB
)
View Source
const DefaultNumWorkers = 50
View Source
const HighPriority = Priority(10)
View Source
const LowPriority = Priority(1)
View Source
const MediumPriority = Priority(5)

Variables

This section is empty.

Functions

func CreateQueueWorkers

func CreateQueueWorkers(ctx context.Context, numWorks uint64, queue network.MessageQueue, callback func(any))

CreateQueueWorkers creates queue workers to read from the queue

Types

type MessagePriorityFunc

type MessagePriorityFunc func(message any) (Priority, error)

MessagePriorityFunc - the callback function to derive priority of a message

type MessageQueue

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

MessageQueue is the heap based priority queue implementation of the MessageQueue implementation

func NewMessageQueue

func NewMessageQueue(ctx context.Context, priorityFunc MessagePriorityFunc, metrics module.NetworkInboundQueueMetrics) *MessageQueue

func (*MessageQueue) Insert

func (mq *MessageQueue) Insert(message any) error

func (*MessageQueue) Len

func (mq *MessageQueue) Len() int

func (*MessageQueue) Remove

func (mq *MessageQueue) Remove() any

type Priority

type Priority int

func GetEventPriority

func GetEventPriority(message any) (Priority, error)

GetEventPriority returns the priority of the flow event message. It is an average of the priority by message type and priority by message size

type QMessage

type QMessage struct {
	Payload  any              // the decoded message
	Size     int              // the size of the message in bytes
	Target   channels.Channel // the target channel to lookup the engine
	SenderID flow.Identifier  // senderID for logging
}

QMessage is the message that is enqueued for each incoming message

Jump to

Keyboard shortcuts

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