runner

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = errors.New("runner received timeout")

ErrTimeout is returned when Runner's Run method fails due to a timeout event.

Functions

This section is empty.

Types

type Runnable

type Runnable interface {
	Run(ctx context.Context) error
}

Runnable is the interface that wraps the basic Run method.

Run should be implemented by any task intended to be executed by the Runner.

type RunnableFunc

type RunnableFunc func(ctx context.Context) error

The RunnableFunc type is an adapter to allow the use of ordinary functions as Runnable tasks. If f is a function with the appropriate signature, RunnableFunc(f) is a Runnable that calls f.

func (RunnableFunc) Run

func (f RunnableFunc) Run(ctx context.Context) error

Run calls f()

type Runner

type Runner interface {
	Run(ctx context.Context, task Runnable) error
}

Runner is the interface that wraps the basic Run method.

Run executes submitted Runnable tasks.

func New

func New() Runner

New constructs a new ready-to-use Runner for running a Runnable task.

func NewWithTimeout added in v0.2.1

func NewWithTimeout(d time.Duration) Runner

NewWithTimeout constructs a new ready-to-use Runner with the specified timeout for running a Runnable task.

Jump to

Keyboard shortcuts

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