Documentation
¶
Index ¶
- Variables
- func ArgumentsFrom(ctx context.Context) ([]interface{}, bool)
- func Debug(ctx context.Context, args ...interface{})
- func EnvironFrom(ctx context.Context) []string
- func Error(ctx context.Context, args ...interface{})
- func FromConcurrent(ctx context.Context) int
- func FromCrontab(ctx context.Context) time.Time
- func FromRepeat(ctx context.Context) int
- func FromRetry(ctx context.Context) int
- func Go(ctx context.Context, exec Executor) chan error
- func Info(ctx context.Context, args ...interface{})
- func Main(exec Executor, opts ...Opt) error
- func StderrFrom(ctx context.Context) io.Writer
- func StdinFrom(ctx context.Context) io.Reader
- func StdoutFrom(ctx context.Context) 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 CountReader
- type CountWriter
- 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 Pool
- type PoolOpt
- type RepeatExecutor
- type ReportExecutor
- type Result
- type RetryExecutor
- type Routine
- type TimeoutExecutor
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 ArgumentsFrom ¶ added in v1.1.0
ArgumentsFrom extract from context
func EnvironFrom ¶ added in v1.1.0
EnvironFrom get env
func StderrFrom ¶ added in v1.1.0
StderrFrom get stderr
func StdoutFrom ¶ added in v1.1.0
StdoutFrom get stdout
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 CountReader ¶ added in v1.1.0
type CountReader struct {
// contains filtered or unexported fields
}
CountReader count io reader
func NewCountReader ¶ added in v1.1.0
func NewCountReader(rd io.Reader) *CountReader
NewCountReader new
type CountWriter ¶ added in v1.1.0
type CountWriter struct {
// contains filtered or unexported fields
}
CountWriter count io writer
func NewCountWriter ¶ added in v1.1.0
func NewCountWriter(wr io.Writer) *CountWriter
NewCountWriter new
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 Pool ¶ added in v1.1.0
type Pool struct {
// contains filtered or unexported fields
}
Pool struct
type PoolOpt ¶ added in v1.1.0
type PoolOpt func(*Pool)
PoolOpt opt for pool
func MaxOfRequestBufferSize ¶ added in v1.1.0
MaxOfRequestBufferSize opt
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