Documentation
¶
Index ¶
- func NewHeapDelays(cap int) heap.Interface
- func NewHeapElements(cap int) heap.Interface
- type Delay
- type DelayQueue
- type Element
- type HeapDelays
- type HeapElements
- type PriorityQueue
- func (pq *PriorityQueue) Fix(elem *Element)
- func (pq *PriorityQueue) Len() int
- func (pq *PriorityQueue) Peek(idx int) *Element
- func (pq *PriorityQueue) Pop() (*Element, bool)
- func (pq *PriorityQueue) Push(elem *Element)
- func (pq *PriorityQueue) Queue() <-chan *Element
- func (pq *PriorityQueue) Remove(elem *Element) *Element
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHeapDelays ¶
func NewHeapElements ¶
Types ¶
type Delay ¶
type Delay struct { V interface{} // value D time.Duration // delay: min time.Millisecond is better // contains filtered or unexported fields }
impl the std lib heap interface
type DelayQueue ¶
func NewDelayQueue ¶
func (*DelayQueue) Fix ¶
func (dq *DelayQueue) Fix(delay *Delay)
func (*DelayQueue) Len ¶
func (dq *DelayQueue) Len() int
func (*DelayQueue) Peek ¶
func (dq *DelayQueue) Peek(idx int) *Delay
func (*DelayQueue) Pop ¶
func (dq *DelayQueue) Pop() (*Delay, bool)
func (*DelayQueue) Push ¶
func (dq *DelayQueue) Push(delay *Delay)
func (*DelayQueue) Queue ¶
func (dq *DelayQueue) Queue() <-chan *Delay
func (*DelayQueue) Remove ¶
func (dq *DelayQueue) Remove(delay *Delay) *Delay
type Element ¶
type Element struct { V interface{} // value P int // priority: max is first pop // contains filtered or unexported fields }
type HeapDelays ¶
type HeapDelays struct {
// contains filtered or unexported fields
}
func (*HeapDelays) Len ¶
func (hd *HeapDelays) Len() int
func (*HeapDelays) Less ¶
func (hd *HeapDelays) Less(i, j int) bool
func (*HeapDelays) Pop ¶
func (hd *HeapDelays) Pop() interface{}
func (*HeapDelays) Push ¶
func (hd *HeapDelays) Push(x interface{})
func (*HeapDelays) Swap ¶
func (hd *HeapDelays) Swap(i, j int)
type HeapElements ¶
type HeapElements struct {
// contains filtered or unexported fields
}
impl the std lib heap interface
func (*HeapElements) Len ¶
func (he *HeapElements) Len() int
func (*HeapElements) Less ¶
func (he *HeapElements) Less(i, j int) bool
func (*HeapElements) Pop ¶
func (he *HeapElements) Pop() interface{}
func (*HeapElements) Push ¶
func (he *HeapElements) Push(x interface{})
func (*HeapElements) Swap ¶
func (he *HeapElements) Swap(i, j int)
type PriorityQueue ¶
func NewPriorityQueue ¶
func NewPriorityQueue(ctx context.Context, cap int) *PriorityQueue
func (*PriorityQueue) Fix ¶
func (pq *PriorityQueue) Fix(elem *Element)
func (*PriorityQueue) Len ¶
func (pq *PriorityQueue) Len() int
func (*PriorityQueue) Peek ¶
func (pq *PriorityQueue) Peek(idx int) *Element
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() (*Element, bool)
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(elem *Element)
func (*PriorityQueue) Queue ¶
func (pq *PriorityQueue) Queue() <-chan *Element
func (*PriorityQueue) Remove ¶
func (pq *PriorityQueue) Remove(elem *Element) *Element
Click to show internal directories.
Click to hide internal directories.