Documentation
¶
Overview ¶
Package heap provides a typed min-heap with addressable items, so the scheduler can re-key or remove an entry in O(log n) without searching.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Heap ¶
type Heap[T any] struct { // contains filtered or unexported fields }
Heap is a min-heap keyed by int64 (the scheduler uses UnixNano). The zero value is usable. It is not safe for concurrent use.
func (*Heap[T]) Fix ¶
Fix changes it's key and restores heap order. Items not stored in h (never pushed, or already popped or removed) are ignored.
func (*Heap[T]) Peek ¶
Peek returns the minimum item without removing it; ok is false when the heap is empty.
func (*Heap[T]) Pop ¶
Pop removes and returns the minimum item; ok is false when the heap is empty. The returned item's Index becomes -1.
Click to show internal directories.
Click to hide internal directories.