executor

package
v2.0.0-...-1c13370 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor interface {
	//Add adds a task to executor queue
	Add(task Task)
	//Wait waits for all executors to finish or one of them to error based on option selected
	Wait() error
}

Executor is the interface for a basic executor pipeline

func NewExecutor

func NewExecutor(options ...Option) Executor

NewExecutor builds and returns an executor

type Option

type Option func(*config)

Option represents different options available for Executor

func WithConcurrency

func WithConcurrency(n int) Option

WithConcurrency sets the number of concurrent works

func WithFailOnError

func WithFailOnError(fail bool) Option

WithFailOnError fails all task if even a single task returns a error

type Task

type Task func() error

Task is the basic task that gets executed in executor

Jump to

Keyboard shortcuts

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