task

package
v3.33.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutionOption

type ExecutionOption func(*executionContext)

func OnFailure

func OnFailure(task Task) ExecutionOption

func OnSuccess

func OnSuccess(task Task) ExecutionOption

func Parallel

func Parallel(tasks ...Task) ExecutionOption

func Sequential

func Sequential(tasks ...Task) ExecutionOption

func WithContext

func WithContext(ctx context.Context) ExecutionOption

type Periodic

type Periodic struct {
	// Interval of the task being run
	Interval time.Duration
	// Execute is the task function
	Execute func() error
	// OnFailure will be called when Execute returns non-nil error
	OnError func(error)
	// contains filtered or unexported fields
}

Periodic is a task that runs periodically.

func (*Periodic) Close

func (t *Periodic) Close() error

Close implements common.Closable.

func (*Periodic) Start

func (t *Periodic) Start() error

Start implements common.Runnable. Start must not be called multiple times without Close being called.

type Task

type Task func() error

func Close

func Close(v interface{}) Task

func Run

func Run(opts ...ExecutionOption) Task

func Single

func Single(task Task, opts ...ExecutionOption) Task

Jump to

Keyboard shortcuts

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