Documentation ¶
Index ¶
- type Heap
- func (h *Heap[T]) AddOrUpdate(obj T)
- func (h *Heap[T]) Delete(obj T) error
- func (h *Heap[T]) Get(obj T) (T, bool)
- func (h *Heap[T]) GetByKey(key string) (T, bool)
- func (h *Heap[T]) Has(obj T) bool
- func (h *Heap[T]) Len() int
- func (h *Heap[T]) List() []T
- func (h *Heap[T]) Peek() (T, bool)
- func (h *Heap[T]) Pop() (T, error)
- type KeyFunc
- type LessFunc
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 producer/consumer queue that implements a heap data structure. It can be used to implement priority queues and similar data structures.
func NewWithRecorder ¶
func NewWithRecorder[T any](keyFn KeyFunc[T], lessFn LessFunc[T], metricRecorder metrics.MetricRecorder) *Heap[T]
NewWithRecorder wraps an optional metricRecorder to compose a Heap object.
func (*Heap[T]) AddOrUpdate ¶
func (h *Heap[T]) AddOrUpdate(obj T)
AddOrUpdate inserts an item, and puts it in the queue. The item is updated if it already exists.
Click to show internal directories.
Click to hide internal directories.