delayheap

package
v0.10.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2020 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DelayHeap

type DelayHeap struct {
	// contains filtered or unexported fields
}

DelayHeap wraps a heap and gives operations other than Push/Pop. The inner heap is sorted by the time in the WaitUntil field of delayHeapNode

func NewDelayHeap

func NewDelayHeap() *DelayHeap

func (*DelayHeap) Contains

func (p *DelayHeap) Contains(heapNode HeapNode) bool

func (*DelayHeap) Length

func (p *DelayHeap) Length() int

func (*DelayHeap) Peek

func (p *DelayHeap) Peek() *delayHeapNode

func (*DelayHeap) Pop

func (p *DelayHeap) Pop() *delayHeapNode

func (*DelayHeap) Push

func (p *DelayHeap) Push(dataNode HeapNode, next time.Time) error

func (*DelayHeap) Remove

func (p *DelayHeap) Remove(heapNode HeapNode) error

func (*DelayHeap) Update

func (p *DelayHeap) Update(heapNode HeapNode, waitUntil time.Time) error

type HeapNode

type HeapNode interface {
	Data() interface{} // The data object
	ID() string        // ID of the object, used in conjunction with namespace for deduplication
	Namespace() string // Namespace of the object, can be empty
}

HeapNode is an interface type implemented by objects stored in the DelayHeap

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL