taskgroup

package module
v0.0.0-...-4f2ca77 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: MIT Imports: 4 Imported by: 0

README

taskgroup

CI GoDoc codecov experimental

context.Context native goroutine manager.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

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

func FailFast

func FailFast(ctx context.Context, opts ...Option) (*Group, context.Context, context.CancelFunc)

func New

func New(opts ...Option) *Group

func (*Group) Add

func (g *Group) Add(t Task)

func (*Group) AddFunc

func (g *Group) AddFunc(f func(ctx context.Context) error)

func (*Group) Process

func (g *Group) Process(ctx context.Context) error

type Interceptor

type Interceptor func(ctx context.Context, report func(error), t Task, r Runner)

func ChainInterceptor

func ChainInterceptor(is ...Interceptor) Interceptor

func WithGoroutine

func WithGoroutine() Interceptor

func WithRecover

func WithRecover() Interceptor

func WithRetry

func WithRetry(strategy func(context.Context, int, error) (time.Duration, bool)) Interceptor

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithFoldFunc

func WithFoldFunc(f func(acc, err error) error) Option

type PanicError

type PanicError struct {
	Raw interface{}
}

func (*PanicError) Error

func (pe *PanicError) Error() string

func (*PanicError) Unwrap

func (pe *PanicError) Unwrap() error

type Runner

type Runner interface {
	Run(ctx context.Context, report func(error), t Task)
}
var DefaultRunner Runner = defaultRunner

type Task

type Task interface {
	Process(ctx context.Context) error
}

type TaskFunc

type TaskFunc func(ctx context.Context) error

func (TaskFunc) Process

func (f TaskFunc) Process(ctx context.Context) error

Jump to

Keyboard shortcuts

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