queue

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 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

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x any)

func (PriorityQueue) Swap

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

type ThreadSafePriorityQueue

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

ThreadSafePriorityQueue wraps PriorityQueue with a mutex and condition variable.

func NewThreadSafePriorityQueue

func NewThreadSafePriorityQueue(logger *slog.Logger) *ThreadSafePriorityQueue

func (*ThreadSafePriorityQueue) Add

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

Add pushes a work item onto the queue (priority = depth).

func (*ThreadSafePriorityQueue) Close

func (tspq *ThreadSafePriorityQueue) Close()

Close marks the queue as closed and wakes all blocked Pop callers.

func (*ThreadSafePriorityQueue) Len

func (tspq *ThreadSafePriorityQueue) Len() int

Len returns the current number of items in the queue.

func (*ThreadSafePriorityQueue) Pop

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

Pop blocks until an item is available or the queue is closed. Returns (item, true) or (nil, false) when closed and empty.

Jump to

Keyboard shortcuts

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