concurrency

package
v1.11.5-rc.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrManagerAlreadyStarted = errors.New("manager already started")

Functions

This section is empty.

Types

type Runner added in v1.11.0

type Runner func(context.Context) error

Runner is a function that runs a task.

type RunnerManager added in v1.11.0

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

RunnerManager is a manager for runners. It runs all runners in parallel and waits for all runners to finish. If any runner returns, the RunnerManager will stop all other runners and return any error.

func NewRunnerManager added in v1.11.0

func NewRunnerManager(runners ...Runner) *RunnerManager

NewRunnerManager creates a new RunnerManager.

func (*RunnerManager) Add added in v1.11.0

func (r *RunnerManager) Add(runner ...Runner) error

Add adds a new runner to the RunnerManager.

func (*RunnerManager) Run added in v1.11.0

func (r *RunnerManager) Run(ctx context.Context) (err error)

Run runs all runners in parallel and waits for all runners to finish. If any runner returns, the RunnerManager will stop all other runners and return any error.

Jump to

Keyboard shortcuts

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