queue

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PQItem

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

PQItem represents an item in the priority queue

type PriorityQueue

type PriorityQueue []*PQItem

PriorityQueue implements heap.Interface

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() any

Pop removes and returns the highest priority element (minimum value) from the heap

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x any)

Push adds an element to the heap

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

type ThreadSafePriorityQueue

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

ThreadSafePriorityQueue wraps PriorityQueue with concurrency controls

func NewThreadSafePriorityQueue

func NewThreadSafePriorityQueue(logger *logrus.Entry) *ThreadSafePriorityQueue

NewThreadSafePriorityQueue creates a new thread-safe priority queue

func (*ThreadSafePriorityQueue) Add

func (tspq *ThreadSafePriorityQueue) Add(item *models.WorkItem)

Add pushes a work item onto the queue with priority based on depth

func (*ThreadSafePriorityQueue) Close

func (tspq *ThreadSafePriorityQueue) Close()

Close signals that no more items will be added to the queue

func (*ThreadSafePriorityQueue) Len

func (tspq *ThreadSafePriorityQueue) Len() int

Len returns the current number of items in the queue (thread-safe)

func (*ThreadSafePriorityQueue) Pop

func (tspq *ThreadSafePriorityQueue) Pop() (*models.WorkItem, bool)

Pop retrieves and removes the highest priority work item It blocks if the queue is empty until an item is added or the queue is closed Returns the item and true, or nil and false if the queue is closed and empty

Jump to

Keyboard shortcuts

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