Documentation ¶
Index ¶
- type Heap
- func (h *Heap) Add(obj interface{}) error
- func (h *Heap) Delete(obj interface{}) error
- func (h *Heap) Get(obj interface{}) (interface{}, bool, error)
- func (h *Heap) GetByKey(key string) (interface{}, bool, error)
- func (h *Heap) Len() int
- func (h *Heap) List() []interface{}
- func (h *Heap) Peek() interface{}
- func (h *Heap) Pop() (interface{}, error)
- func (h *Heap) Update(obj interface{}) error
- type KeyFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Heap ¶
type Heap 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(keyFn KeyFunc, lessFn lessFunc, metricRecorder metrics.MetricRecorder) *Heap
NewWithRecorder wraps an optional metricRecorder to compose a Heap object.
func (*Heap) Add ¶
Add inserts an item, and puts it in the queue. The item is updated if it already exists.
func (*Heap) Peek ¶
func (h *Heap) Peek() interface{}
Peek returns the head of the heap without removing it.
Click to show internal directories.
Click to hide internal directories.