priorityqueue

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

The package support the priority queue for using them in conveyor.

Items with the same priority has FIFO order. Realisation has 2-element delay on empty channel because it uses standard GO channel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InsertToBody

func InsertToBody(array *[]faces.IItem, item faces.IItem, last int)

func New

func New(length int) faces.IChan

Create a new stack

func PrintBody

func PrintBody(body []faces.IItem, last int) string

PrintBody is helper for tests, don't use it for production :)

Types

type IPQ

type IPQ interface {
	Len() int32
	ChanIn() chan interface{}
	ChanOut() chan interface{}
}

type PQ

type PQ struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func Init

func Init(limit int, ctx context.Context) *PQ

func (*PQ) Body

func (pq *PQ) Body() []faces.IItem

Body()

func (*PQ) ChanIn

func (pq *PQ) ChanIn() faces.MainCh

func (*PQ) ChanOut

func (pq *PQ) ChanOut() faces.MainCh

func (*PQ) Close

func (pq *PQ) Close()

Close()

func (*PQ) Count

func (pq *PQ) Count() int

Returns the number of items in the stack

func (*PQ) Info

func (pq *PQ) Info() *nodes.ChanData

func (*PQ) IsActive

func (pq *PQ) IsActive() bool

IsActive

func (*PQ) Len

func (pq *PQ) Len() int

Returns the max available number items in the stack

func (*PQ) Print

func (pq *PQ) Print() string

Print is helper for tests, don't use it for production :)

func (*PQ) Push

func (pq *PQ) Push(item faces.IItem)

Jump to

Keyboard shortcuts

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