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.
Click to show internal directories.
Click to hide internal directories.