queue

package
v0.37.10 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 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(interface{}))

CreateQueueWorkers creates queue workers to read from the queue

Types

type MessagePriorityFunc

type MessagePriorityFunc func(message interface{}) (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 interface{}) error

func (*MessageQueue) Len

func (mq *MessageQueue) Len() int

func (*MessageQueue) Remove

func (mq *MessageQueue) Remove() interface{}

type Priority

type Priority int

func GetEventPriority

func GetEventPriority(message interface{}) (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  interface{}      // 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