const closedMsg … type LessFunc … type heapItem … type itemKeyValue … type heapData … var _ … // Less compares two objects and returns true if the first one should go // in front of the second one in the heap. func (h *heapData) Less(i, j int) bool { … } // Len returns the number of items in the Heap. func (h *heapData) Len() int { … } // Swap implements swapping of two elements in the heap. This is a part of standard // heap interface and should never be called directly. func (h *heapData) Swap(i, j int) { … } // Push is supposed to be called by heap.Push only. func (h *heapData) Push(kv interface{ … } // Pop is supposed to be called by heap.Pop only. func (h *heapData) Pop() interface{ … } type Heap … // Close the Heap and signals condition variables that may be waiting to pop // items from the heap. func (h *Heap) Close() { … } // Add inserts an item, and puts it in the queue. The item is updated if it // already exists. func (h *Heap) Add(obj interface{ … } // BulkAdd adds all the items in the list to the queue and then signals the condition // variable. It is useful when the caller would like to add all of the items // to the queue before consumer starts processing them. func (h *Heap) BulkAdd(list []interface{ … } // AddIfNotPresent inserts an item, and puts it in the queue. If an item with // the key is present in the map, no changes is made to the item. // // This is useful in a single producer/consumer scenario so that the consumer can // safely retry items without contending with the producer and potentially enqueueing // stale items. func (h *Heap) AddIfNotPresent(obj interface{ … } // addIfNotPresentLocked assumes the lock is already held and adds the provided // item to the queue if it does not already exist. func (h *Heap) addIfNotPresentLocked(key string, obj interface{ … } // Update is the same as Add in this implementation. When the item does not // exist, it is added. func (h *Heap) Update(obj interface{ … } // Delete removes an item. func (h *Heap) Delete(obj interface{ … } // Pop waits until an item is ready. If multiple items are // ready, they are returned in the order given by Heap.data.lessFunc. func (h *Heap) Pop() (interface{ … } // List returns a list of all the items. func (h *Heap) List() []interface{ … } // ListKeys returns a list of all the keys of the objects currently in the Heap. func (h *Heap) ListKeys() []string { … } // Get returns the requested item, or sets exists=false. func (h *Heap) Get(obj interface{ … } // GetByKey returns the requested item, or sets exists=false. func (h *Heap) GetByKey(key string) (interface{ … } // IsClosed returns true if the queue is closed. func (h *Heap) IsClosed() bool { … } // NewHeap returns a Heap which can be used to queue up items to process. func NewHeap(keyFn KeyFunc, lessFn LessFunc) *Heap { … }