Versions in this module Expand all Collapse all v0 v0.0.1 Apr 27, 2021 Changes in this version + var ErrNoTasks = errors.New("no tasks") + var ErrTaskRunning = errors.New("Task is running") + func MustRun(done func(), t ...Task) error + func NewStartableTask(start func(done ...func()) (err error), stop func()) *startableTask + func NewTask(run func() (err error), stop ...func()) *task + func Run(done func(state *State), t ...Task) (err error) + func StopWait(stoper Stoper) + type Appender interface + AddTask func(t ...Task) error + Context func() context.Context + PostRun func(f ...func()) + WithContext func(ctx context.Context) (done func()) + func NewAppender() Appender + type CmdTask struct + Cmd *exec.Cmd + Log logging.Logger + PreStart func(t *CmdTask) + func NewCmdTask(cmd *exec.Cmd) *CmdTask + func (t *CmdTask) LogInfo() + func (t *CmdTask) OnDone(f ...func()) *CmdTask + func (t *CmdTask) Run() (err error) + func (t *CmdTask) SetLog(log logging.Logger) *CmdTask + func (t *CmdTask) Setup(appender Appender) error + func (t *CmdTask) Start(done func()) (stop Stoper, err error) + type ErrNotRunning struct + Task Task + func (this ErrNotRunning) Error() string + type Factory interface + Factory func() Task + type FactoryFunc func() Task + func (f FactoryFunc) Factory() Task + func (f FactoryFunc) Run() error + func (f FactoryFunc) Setup(appender Appender) (err error) + func (f FactoryFunc) Start(done func()) (stop Stoper, err error) + type OnDoneEvent struct + func (od *OnDoneEvent) CallDoneFuncs() + func (od *OnDoneEvent) DoneFuncs() []func() + func (od *OnDoneEvent) OnDone(f ...func()) + type PostRunCallback interface + TaskPosRun func() + type PostRunSlice []func() + type PostStartCallback interface + PostTaskStart func(s *State) + type PreRunCallback interface + TaskPreRun func(ta Appender) error + type PreRunSlice []func(ap Appender) error + type PreStartCallback interface + PreTaskStart func(s *State) + type PreparedTasks struct + func Prepare(t ...Task) (pt *PreparedTasks, err error) + func (this *PreparedTasks) Start(done ...func()) (state *State, err error) + func (this *PreparedTasks) Tasks() Slice + type Runner struct + Signal os.Signal + func NewRunner(t ...Task) *Runner + func (r *Runner) Add(t ...Task) (err error) + func (r *Runner) MustRunWait() + func (r *Runner) MustSigRun(sig ...os.Signal) + func (r *Runner) Run() (done chan interface{}, err error) + func (r *Runner) RunWait() (err error) + func (r *Runner) SetLog(log logging.Logger) *Runner + func (r *Runner) SigRun(sig ...os.Signal) (done chan interface{}, err error) + func (r *Runner) SigRunWait(sig ...os.Signal) (err error) + func (r *Runner) SigStop() *Runner + func (this *Runner) GetLogger() logging.Logger + func (this *Runner) SignalBinder() signald.Binder + type Slice []Task + func (tasks Slice) Run() (err error) + func (tasks Slice) Setup(appender Appender) (err error) + func (tasks Slice) Start(done func()) (s Stoper, err error) + type SliceGetter interface + Tasks func() Slice + type State struct + End time.Time + Start time.Time + func (s *State) Add(tasks ...Task) (err error) + func (s *State) Stop() + func (s *State) StopWait() + func (s *State) Wait() + func (s State) IsRunning() bool + func (s State) Len() int + func (s State) Stopers() (stopers Stopers) + func (s State) Tasks() (tasks Slice) + type StopWaiter interface + StopWait func() + type Stoper interface + IsRunning func() bool + Stop func() + func MustStart(done func(), t ...Task) (s Stoper, err error) + func NewStopDoner(stop func()) (s Stoper, done func()) + func NewStoper(stop func(), running func() bool) (s Stoper) + func Start(done func(state *State), t ...Task) (s Stoper, err error) + type Stopers []Stoper + func (s *Stopers) IsRunningOrRemove() (ok bool) + func (s Stopers) IsRunning() bool + func (s Stopers) Stop() + type Task interface + Start func(done func()) (stop Stoper, err error) + type TaskAppender struct + func (this *TaskAppender) AddSetup(s ...func(ta Appender) error) + func (this *TaskAppender) AddTask(t ...Task) (err error) + func (this *TaskAppender) Context() context.Context + func (this *TaskAppender) PostRun(f ...func()) + func (this *TaskAppender) Setup(tar Appender) (err error) + func (this *TaskAppender) TaskPostRun() + func (this *TaskAppender) Tasks() Slice + func (this *TaskAppender) WithContext(ctx context.Context) (done func()) + type TaskFactory struct + FactoryFunc func() Task + func (f *TaskFactory) Factory() Task + func (f *TaskFactory) Run() (err error) + func (f *TaskFactory) Setup(appender Appender) (err error) + func (f *TaskFactory) Start(done func()) (stop Stoper, err error) + type TaskProxy struct + RunFunc func() error + SetupFunc func(appender Appender) error + StartFunc func(done func()) (stop Stoper, err error) + T Task + func (px *TaskProxy) Run() error + func (px *TaskProxy) Setup(appender Appender) error + func (px *TaskProxy) Start(done func()) (stop Stoper, err error) + type TaskRunner interface + Run func() error + type TaskSetup func(appender Appender) error + func (TaskSetup) Run() error + func (TaskSetup) Start(done func()) (stop Stoper, err error) + func (tf TaskSetup) Setup(appender Appender) error + type TaskSetupAppender interface + Setup func(appender Appender) error + type TaskSetupError struct + Index int + Task Task + func (se *TaskSetupError) Cause() error + func (se *TaskSetupError) Error() string + type TaskSetuper interface + Setup func() error + type Tasks struct + func (tasks *Tasks) GetPreRun() []func(ta Appender) error + func (tasks *Tasks) Log() logging.Logger + func (tasks *Tasks) PreRun(f ...func(ta Appender) error) + func (tasks *Tasks) Run() (err error) + func (tasks *Tasks) SetLog(log logging.Logger) + func (tasks *Tasks) Start(done func()) (stop Stoper, err error) + func (tasks *Tasks) TaskPreRun(ts *TaskAppender) (err error)