queue

package
v1.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

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