queue

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IterateOperation

type IterateOperation func(task interface{}, index int) string

type Queue

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

func NewQueue

func NewQueue() *Queue

NewQueue creates a new queue.

func (*Queue) Add

func (q *Queue) Add(task interface{})

Add adds the last element.

func (*Queue) AddWatcher

func (q *Queue) AddWatcher(queueWatcher QueueWatcher)

AddWatcher adds queue watcher.

func (*Queue) ChangesDisable

func (q *Queue) ChangesDisable()

func (*Queue) ChangesEnable

func (q *Queue) ChangesEnable(runCallbackOnPreviousChanges bool)

Включить вызов QueueChangeCallback при каждом изменении В паре с ChangesDisabled могут быть использованы, чтобы производить массовые изменения. Если runCallbackOnPreviousChanges true, то будет вызвана QueueChangeCallback

func (*Queue) IsEmpty

func (q *Queue) IsEmpty() bool

func (*Queue) IterateWithLock

func (q *Queue) IterateWithLock(operation IterateOperation) io.Reader

IterateWithLock executes operation on all elements of the queue with a queue lock.

func (*Queue) Length

func (q *Queue) Length() int

func (*Queue) Peek

func (q *Queue) Peek() (task interface{}, err error)

Peek examines the first element (get without delete).

func (*Queue) Pop

func (q *Queue) Pop() (task interface{})

Pop pops the first element (delete).

func (*Queue) Push

func (q *Queue) Push(task interface{})

Push pushes the element as the first element.

func (*Queue) WithLock

func (q *Queue) WithLock(operation TaskOperation) string

WithLock executes operation on the first element of the queue with a queue lock.

type QueueWatcher

type QueueWatcher interface {
	QueueChangeCallback()
}

type TaskOperation

type TaskOperation func(topTask interface{}) string

Тип метода — операция над первым элементом очереди

Jump to

Keyboard shortcuts

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