Documentation

Index

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 thread-safe producer/consumer queue that implements a heap data structure. It can be used to implement priority queues and similar data structures.

    func (*Heap) Add

    func (h *Heap) Add(obj interface{}) error

      Add inserts an item, and puts it in the queue. The item is updated if it already exists.

      func (*Heap) AddIfNotPresent

      func (h *Heap) AddIfNotPresent(obj interface{}) error

        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.

        func (*Heap) BulkAdd

        func (h *Heap) BulkAdd(list []interface{}) error

          BulkAdd adds all the items in the list to the queue.

          func (*Heap) Delete

          func (h *Heap) Delete(obj interface{}) error

            Delete removes an item.

            func (*Heap) Get

            func (h *Heap) Get(obj interface{}) (interface{}, bool, error)

              Get returns the requested item, or sets exists=false.

              func (*Heap) GetByKey

              func (h *Heap) GetByKey(key string) (interface{}, bool, error)

                GetByKey returns the requested item, or sets exists=false.

                func (*Heap) List

                func (h *Heap) List() []interface{}

                  List returns a list of all the items.

                  func (*Heap) Pop

                  func (h *Heap) Pop() (interface{}, error)

                    Pop returns the head of the heap.

                    func (*Heap) Update

                    func (h *Heap) Update(obj interface{}) error

                      Update is the same as Add in this implementation. When the item does not exist, it is added.

                      type KeyFunc

                      type KeyFunc func(obj interface{}) (string, error)

                      type LessFunc

                      type LessFunc func(interface{}, interface{}) bool

                      Source Files