queue

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package queue contains types to create queues.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

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

Queue is a simple queue with concurency support.

func New

func New(concurrency int) *Queue

New creates a queue with given concurrency.

func (*Queue) Do

func (q *Queue) Do(job func())

Do puts a job at the end of the queue and blocks until executed.

func (*Queue) DoError

func (q *Queue) DoError(job func() error) error

DoError puts a job that can return an error at the end of the queue and blocks until executed.

func (*Queue) DoErrorHi

func (q *Queue) DoErrorHi(task func() error) error

DoErrorHi puts a task that can return an error at the end of the hi-priority queue and blocks until executed.

func (*Queue) DoHi

func (q *Queue) DoHi(task func())

DoHi puts a task at the end of the hi-priority queue and blocks until executed.

func (*Queue) Work

func (q *Queue) Work(ctx context.Context) error

Work tells the queue to start executing jobs.

It blocks until the context is canceled.

Jump to

Keyboard shortcuts

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