queue

package module
v0.0.0-...-ddb7da6 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: Apache-2.0 Imports: 4 Imported by: 3

README

queue

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CondWaiter

type CondWaiter interface {
	Wait()
	Signal()
	Broadcast()
}

type Conditioner

type Conditioner interface {
	sync.Locker
	CondWaiter
}

func NewCond

func NewCond() Conditioner

type Heap

type Heap []Prioritier

Slice-based min-heap implementation

func NewHeap

func NewHeap(l ...int) *Heap

func (Heap) Len

func (h Heap) Len() int

func (Heap) Less

func (h Heap) Less(i, j int) bool

func (*Heap) Pop

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

func (*Heap) Push

func (h *Heap) Push(x interface{})

func (Heap) Swap

func (h Heap) Swap(i, j int)

type HeapPriorityQueueItems

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

func NewHeapPriorityQueueItems

func NewHeapPriorityQueueItems() *HeapPriorityQueueItems

func (*HeapPriorityQueueItems) Get

func (i *HeapPriorityQueueItems) Get() (item PriorityQueueItem, ok bool)

func (*HeapPriorityQueueItems) Insert

func (i *HeapPriorityQueueItems) Insert(item PriorityQueueItem)

func (*HeapPriorityQueueItems) Len

func (i *HeapPriorityQueueItems) Len() int

type Map

type Map interface {
	Has(item T) bool
	// Insert overwrites item's value
	Insert(item T, value T)
	Get(item T) T
	Delete(item T)
}

type MapSet

type MapSet map[T]empty

func (MapSet) Delete

func (s MapSet) Delete(item T)

func (MapSet) Has

func (s MapSet) Has(item T) bool

func (MapSet) Insert

func (s MapSet) Insert(item T)

type MutexCond

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

func NewMutexCond

func NewMutexCond() *MutexCond

func (*MutexCond) Broadcast

func (m *MutexCond) Broadcast()

func (*MutexCond) Lock

func (m *MutexCond) Lock()

func (*MutexCond) Signal

func (m *MutexCond) Signal()

func (*MutexCond) Unlock

func (m *MutexCond) Unlock()

func (*MutexCond) Wait

func (m *MutexCond) Wait()

type Prioritier

type Prioritier interface {
	Priority() int
}

type PriorityQueue

type PriorityQueue interface {
	Insert(item PriorityQueueItem)
	Get() (item PriorityQueueItem, ctx context.Context, ok bool)
	Done(item PriorityQueueItem)
	Len() int
	Close()
	Closed() bool
}

func New

func New() PriorityQueue

New

type PriorityQueueItem

type PriorityQueueItem interface {
	Prioritier
	Handle() T
}

type PriorityQueueItems

type PriorityQueueItems interface {
	// Insert inserts item into the queue
	Insert(PriorityQueueItem)
	// Get gets item if available and reports whether item is returned successfully
	Get() (PriorityQueueItem, bool)
	// Len returns length of the queue
	Len() int
}

type Set

type Set interface {
	Has(item T) bool
	// Insert overwrites item in the set
	Insert(item T)
	Delete(item T)
}

func NewMapSet

func NewMapSet() Set

type SimpleMap

type SimpleMap map[T]T

func NewSimpleMap

func NewSimpleMap() SimpleMap

func (SimpleMap) Delete

func (s SimpleMap) Delete(item T)

func (SimpleMap) Get

func (s SimpleMap) Get(item T) T

func (SimpleMap) Has

func (s SimpleMap) Has(item T) bool

func (SimpleMap) Insert

func (s SimpleMap) Insert(item, value T)

type SlicePriorityQueueItems

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

func NewSlicePriorityQueueItems

func NewSlicePriorityQueueItems() *SlicePriorityQueueItems

func (*SlicePriorityQueueItems) Get

func (i *SlicePriorityQueueItems) Get() (item PriorityQueueItem, ok bool)

func (*SlicePriorityQueueItems) Insert

func (*SlicePriorityQueueItems) Len

func (i *SlicePriorityQueueItems) Len() int

type T

type T interface{}

Jump to

Keyboard shortcuts

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