Documentation ¶
Index ¶
- Variables
- func Debug(ctx context.Context, args ...interface{})
- func Error(ctx context.Context, args ...interface{})
- func FromArguments(ctx context.Context) []interface{}
- func FromConcurrent(ctx context.Context) int
- func FromCrontab(ctx context.Context) time.Time
- func FromEnviron(ctx context.Context) []string
- func FromRepeat(ctx context.Context) int
- func FromRetry(ctx context.Context) int
- func FromStderr(ctx context.Context) io.Writer
- func FromStdin(ctx context.Context) io.Reader
- func FromStdout(ctx context.Context) io.Writer
- func Go(ctx context.Context, exec Executor) chan error
- func Info(ctx context.Context, args ...interface{})
- func Main(parent context.Context, exec Executor, opts ...Opt) error
- func NewReadCounter(rd io.Reader) io.Reader
- func NewWriteCounter(wr io.Writer) io.Writer
- func Trace(ctx context.Context, args ...interface{})
- func Wait(ctx context.Context)
- func WaitAdd(ctx context.Context, delta int)
- func WaitDone(ctx context.Context)
- func Warn(ctx context.Context, args ...interface{})
- func WithArgments(ctx context.Context, args ...interface{}) context.Context
- func WithEnviron(ctx context.Context, key string, value string) context.Context
- func WithLogger(ctx context.Context, logger Logger) context.Context
- func WithStderr(ctx context.Context, out io.Writer) context.Context
- func WithStdin(ctx context.Context, in io.Reader) context.Context
- func WithStdout(ctx context.Context, out io.Writer) context.Context
- func WithWait(ctx context.Context) context.Context
- type CancelInterruptor
- type Code
- type CommandExecutor
- type ConcurrentExecutor
- type CrontabExecutor
- type DeadlineExecutor
- type Executor
- func Command(cmd string, args ...string) Executor
- func Concurrent(c int, exec Executor) Executor
- func Crontab(plan string, exec Executor) Executor
- func Deadline(d time.Time, exec Executor) Executor
- func Guarantee(exec Executor) Executor
- func Repeat(repeat int, interval time.Duration, exec Executor) Executor
- func Report(ch chan *Result, exec Executor) Executor
- func Retry(retry int, exec Executor) Executor
- func Timeout(d time.Duration, exec Executor) Executor
- func UseExecutorMiddleware(exec Executor, middleware ...ExecutorMiddleware) Executor
- type ExecutorFunc
- type ExecutorMiddleware
- type GoFunc
- type GuaranteeExecutor
- type InterruptHandler
- type Interruptor
- type Logger
- type Opt
- type ReadCounter
- type RepeatExecutor
- type ReportExecutor
- type Result
- type RetryExecutor
- type Routine
- type TimeoutExecutor
- type WriteCounter
Constants ¶
This section is empty.
Variables ¶
var ( //ErrNoneExecutor error ErrNoneExecutor = errors.New("none executor") //ErrNoneContext error ErrNoneContext = errors.New("none context") //ErrNonePlan error ErrNonePlan = errors.New("none plan") )
var DefaultCancelInterruptors []Interruptor
DefaultCancelInterruptors include INT/TERM/KILL signals
Functions ¶
func FromArguments ¶
FromArguments extract from context
func WithArgments ¶
WithArgments inject into context
func WithEnviron ¶
WithEnviron set env
func WithLogger ¶
WithLogger context with logger
func WithStderr ¶
WithStderr set stderr
func WithStdout ¶
WithStdout set stdout
Types ¶
type CancelInterruptor ¶
type CancelInterruptor struct {
// contains filtered or unexported fields
}
CancelInterruptor definition
func NewCancelInterruptor ¶
func NewCancelInterruptor(sig syscall.Signal) *CancelInterruptor
NewCancelInterruptor if fn is nil will cancel context
func (*CancelInterruptor) Interrupt ¶
func (c *CancelInterruptor) Interrupt() InterruptHandler
Interrupt inplement the interface
func (*CancelInterruptor) Signal ¶
func (c *CancelInterruptor) Signal() syscall.Signal
Signal inplement the interface
type CommandExecutor ¶
type CommandExecutor struct {
// contains filtered or unexported fields
}
CommandExecutor struct
type ConcurrentExecutor ¶
type ConcurrentExecutor struct {
// contains filtered or unexported fields
}
ConcurrentExecutor struct
type CrontabExecutor ¶
type CrontabExecutor struct {
// contains filtered or unexported fields
}
CrontabExecutor struct
type DeadlineExecutor ¶
type DeadlineExecutor struct {
// contains filtered or unexported fields
}
DeadlineExecutor struct
type Executor ¶
type Executor interface { //Execute before stopping make sure all subroutines stopped Execute(context.Context) error }
Executor interface definition
func UseExecutorMiddleware ¶
func UseExecutorMiddleware(exec Executor, middleware ...ExecutorMiddleware) Executor
UseExecutorMiddleware wraps a Executor in one or more middleware.
type ExecutorFunc ¶
ExecutorFunc definition
type ExecutorMiddleware ¶
ExecutorMiddleware is a function that middlewares can implement to be able to chain.
type GuaranteeExecutor ¶
type GuaranteeExecutor struct {
// contains filtered or unexported fields
}
GuaranteeExecutor struct, make sure of none error return
type InterruptHandler ¶
InterruptHandler definition
type Interruptor ¶
type Interruptor interface { Signal() syscall.Signal Interrupt() InterruptHandler }
Interruptor definition
type Logger ¶
type Logger interface { Debug(args ...interface{}) Trace(args ...interface{}) Info(args ...interface{}) Error(args ...interface{}) Warn(args ...interface{}) }
Logger declare
type ReadCounter ¶
type ReadCounter struct {
// contains filtered or unexported fields
}
func (*ReadCounter) Count ¶
func (rc *ReadCounter) Count() int
type RepeatExecutor ¶
type RepeatExecutor struct {
// contains filtered or unexported fields
}
RepeatExecutor struct
type ReportExecutor ¶
type ReportExecutor struct {
// contains filtered or unexported fields
}
ReportExecutor struct
type RetryExecutor ¶
type RetryExecutor struct {
// contains filtered or unexported fields
}
RetryExecutor struct
type TimeoutExecutor ¶
type TimeoutExecutor struct {
// contains filtered or unexported fields
}
TimeoutExecutor struct
type WriteCounter ¶
type WriteCounter struct {
// contains filtered or unexported fields
}
func (*WriteCounter) Count ¶
func (wc *WriteCounter) Count() int