processes

package
v1.2.85 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAborted = errors.Warning("processes: abort")
)

Functions

func IsAbortErr

func IsAbortErr(err error) (ok bool)

Types

type Process

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

func New

func New() *Process

func (*Process) Abort

func (p *Process) Abort(timeout time.Duration) (err error)

func (*Process) Add

func (p *Process) Add(name string, units ...Unit)

func (*Process) Start

func (p *Process) Start(ctx context.Context) (results <-chan Result)

func (*Process) Steps

func (p *Process) Steps() (n int64)

func (*Process) Units

func (p *Process) Units() (n int64)

type ProcessController

type ProcessController interface {
	Steps() (n int64)
	Units() (n int64)
	Start(ctx context.Context) (results <-chan Result)
	Abort(timeout time.Duration) (err error)
}

type Result

type Result struct {
	StepNo   int64
	StepNum  int64
	StepName string
	UnitNo   int64
	UnitNum  int64
	Data     interface{}
	Error    error
}

func (Result) String

func (result Result) String() string

type Step

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

func (*Step) Execute

func (step *Step) Execute(ctx context.Context) (err error)

type Unit

type Unit interface {
	Handle(ctx context.Context) (result interface{}, err error)
}

Jump to

Keyboard shortcuts

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