parallel

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2019 License: Apache-2.0 Imports: 3 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBounedRunner

func NewBounedRunner(maxParallel int, failFast bool) *runner

Create a new single capacity runner - a runner we can only add tasks to as long as there is a free goroutine in the Run() loop to handle it. maxParallel - number of go routines for task processing, maxParallel always will be a positive number. failFast - if set to true the runner will stop on first error.

func NewRunner

func NewRunner(maxParallel int, capacity uint, failFast bool) *runner

Create a new capacity runner - a runner we can add tasks to without blocking as long as the capacity is not reached. maxParallel - number of go routines for task processing, maxParallel always will be a positive number. acceptBeforeBlocking - number of tasks that can be added until a free processing goruntine is needed. failFast - is set to true the will stop on first error.

Types

type OnErrorFunc

type OnErrorFunc func(error)

type Runner

type Runner interface {
	AddTask(TaskFunc) (int, error)
	AddTaskWithError(TaskFunc, OnErrorFunc) (int, error)
	Run()
	Done()
	Cancel()
	Errors() map[int]error
}

type TaskFunc

type TaskFunc func(int) error

Jump to

Keyboard shortcuts

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