qgroup

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

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

Go to latest
Published: Jan 22, 2017 License: GPL-3.0 Imports: 3 Imported by: 0

README

QGroup CircleCI Go Report Card GoDoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

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

Func has func(context.Context) and context. The context uses with DoWithContext().

type QGroup

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

QGroup represents function calling queues and settings

func NewGroup

func NewGroup(opts ...QGroupOption) *QGroup

NewGroup returnes QGroup struct is configured with QGroupOptions

func (*QGroup) Cancel

func (g *QGroup) Cancel() error

Cancel can cancel all queue calling tasks

func (*QGroup) Do

func (g *QGroup) Do(key string, fn func(context.Context)) error

Do enqueues the given function in a queue with key name If a queue of the key doesn't exists,Do makes a new queue with key name

func (*QGroup) DoWithContext

func (g *QGroup) DoWithContext(key string, ctx context.Context, fn func(context.Context)) error

DoWithContext the given function and the given ctx in q queue with key name

type QGroupOption

type QGroupOption func(g *QGroup)

A QGroupOption is a functional option type for QGroup

func WithMaxQueue

func WithMaxQueue(maxQueue int) QGroupOption

WithMaxQueue configures max number of queue items. Default is 0.

func WithTimeout

func WithTimeout(d time.Duration) QGroupOption

WithTimeout configures function call timeout. if a function reaches the timeout, ctx in the function returns a channel.

Jump to

Keyboard shortcuts

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