Documentation ¶
Index ¶
- Variables
- 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
- type CmdTask
- type ErrNotRunning
- type Factory
- type FactoryFunc
- type OnDoneEvent
- type PostRunCallback
- type PostRunSlice
- type PostStartCallback
- type PreRunCallback
- type PreRunSlice
- type PreStartCallback
- type PreparedTasks
- type Runner
- func (r *Runner) Add(t ...Task) (err error)
- func (this *Runner) GetLogger() logging.Logger
- 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) SignalBinder() signald.Binder
- type Slice
- type SliceGetter
- type State
- type StopWaiter
- type Stoper
- type Stopers
- type Task
- type TaskAppender
- 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
- type TaskProxy
- type TaskRunner
- type TaskSetup
- type TaskSetupAppender
- type TaskSetupError
- type TaskSetuper
- type Tasks
- 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)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoTasks = errors.New("no tasks")
View Source
var (
ErrTaskRunning = errors.New("Task is running")
)
Functions ¶
func NewStartableTask ¶
func NewStartableTask(start func(done ...func()) (err error), stop func()) *startableTask
Types ¶
type Appender ¶
type Appender interface { SliceGetter AddTask(t ...Task) error PostRun(f ...func()) Context() context.Context WithContext(ctx context.Context) (done func()) }
func NewAppender ¶
func NewAppender() Appender
type CmdTask ¶
type CmdTask struct { Cmd *exec.Cmd Log logging.Logger PreStart func(t *CmdTask) // contains filtered or unexported fields }
func NewCmdTask ¶
type ErrNotRunning ¶
type ErrNotRunning struct {
Task Task
}
func (ErrNotRunning) Error ¶
func (this ErrNotRunning) Error() string
type FactoryFunc ¶
type FactoryFunc func() Task
func (FactoryFunc) Factory ¶
func (f FactoryFunc) Factory() Task
func (FactoryFunc) Run ¶
func (f FactoryFunc) Run() error
func (FactoryFunc) Setup ¶
func (f FactoryFunc) Setup(appender Appender) (err error)
func (FactoryFunc) Start ¶
func (f FactoryFunc) Start(done func()) (stop Stoper, err error)
type OnDoneEvent ¶
type OnDoneEvent struct {
// contains filtered or unexported fields
}
func (*OnDoneEvent) CallDoneFuncs ¶
func (od *OnDoneEvent) CallDoneFuncs()
func (*OnDoneEvent) DoneFuncs ¶
func (od *OnDoneEvent) DoneFuncs() []func()
func (*OnDoneEvent) OnDone ¶
func (od *OnDoneEvent) OnDone(f ...func())
type PostRunCallback ¶
type PostRunCallback interface {
TaskPosRun()
}
type PostRunSlice ¶
type PostRunSlice []func()
type PostStartCallback ¶
type PostStartCallback interface {
PostTaskStart(s *State)
}
type PreRunCallback ¶
type PreRunSlice ¶
type PreStartCallback ¶
type PreStartCallback interface {
PreTaskStart(s *State)
}
type PreparedTasks ¶
type PreparedTasks struct {
// contains filtered or unexported fields
}
func Prepare ¶
func Prepare(t ...Task) (pt *PreparedTasks, err error)
func (*PreparedTasks) Start ¶
func (this *PreparedTasks) Start(done ...func()) (state *State, err error)
func (*PreparedTasks) Tasks ¶
func (this *PreparedTasks) Tasks() Slice
type Runner ¶
type Runner struct { *State *OnDoneEvent Signal os.Signal // contains filtered or unexported fields }
func (*Runner) MustRunWait ¶
func (r *Runner) MustRunWait()
func (*Runner) MustSigRun ¶
func (*Runner) SignalBinder ¶
type SliceGetter ¶
type SliceGetter interface {
Tasks() Slice
}
type State ¶
type State struct { OnDoneEvent Start time.Time End time.Time // contains filtered or unexported fields }
type StopWaiter ¶
type StopWaiter interface {
StopWait()
}
type Stoper ¶
type Stoper interface { Stop() IsRunning() bool }
func NewStopDoner ¶
func NewStopDoner(stop func()) (s Stoper, done func())
type TaskAppender ¶
type TaskAppender struct {
// contains filtered or unexported fields
}
func (*TaskAppender) AddSetup ¶
func (this *TaskAppender) AddSetup(s ...func(ta Appender) error)
func (*TaskAppender) AddTask ¶
func (this *TaskAppender) AddTask(t ...Task) (err error)
func (*TaskAppender) Context ¶
func (this *TaskAppender) Context() context.Context
func (*TaskAppender) PostRun ¶
func (this *TaskAppender) PostRun(f ...func())
func (*TaskAppender) Setup ¶
func (this *TaskAppender) Setup(tar Appender) (err error)
func (*TaskAppender) TaskPostRun ¶
func (this *TaskAppender) TaskPostRun()
func (*TaskAppender) Tasks ¶
func (this *TaskAppender) Tasks() Slice
func (*TaskAppender) WithContext ¶
func (this *TaskAppender) WithContext(ctx context.Context) (done func())
type TaskFactory ¶
type TaskFactory struct { FactoryFunc func() Task // contains filtered or unexported fields }
func (*TaskFactory) Factory ¶
func (f *TaskFactory) Factory() Task
func (*TaskFactory) Run ¶
func (f *TaskFactory) Run() (err error)
func (*TaskFactory) Setup ¶
func (f *TaskFactory) Setup(appender Appender) (err error)
func (*TaskFactory) Start ¶
func (f *TaskFactory) Start(done func()) (stop Stoper, err error)
type TaskProxy ¶
type TaskRunner ¶
type TaskRunner interface {
Run() error
}
type TaskSetupAppender ¶
type TaskSetupError ¶
func (*TaskSetupError) Cause ¶
func (se *TaskSetupError) Cause() error
func (*TaskSetupError) Error ¶
func (se *TaskSetupError) Error() string
type TaskSetuper ¶
type TaskSetuper interface {
Setup() error
}
type Tasks ¶
type Tasks struct { TaskAppender // contains filtered or unexported fields }
func (*Tasks) TaskPreRun ¶
func (tasks *Tasks) TaskPreRun(ts *TaskAppender) (err error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.