Documentation ¶
Index ¶
- type RunContext
- func (r *RunContext) Cancel()
- func (r *RunContext) ChildContext() *RunContext
- func (r *RunContext) ForkContext() RunContext
- func (r *RunContext) IsAlive() bool
- func (r *RunContext) IsChild() bool
- func (r *RunContext) Result(err error)
- func (r *RunContext) SetWaitGroup(wg *sync.WaitGroup)
- func (r *RunContext) Success()
- func (r *RunContext) Timeout(timeout time.Duration)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RunContext ¶
type RunContext struct { // Logger is sub-logger instance for the job Logger log.Logger // Context is context.Context instance for current job. Context context.Context // Error is job result channel Error chan error // RootVars used to hold variables of root context RootVars scope.Vars // contains filtered or unexported fields }
RunContext used to store job state and communicate between task runner and job
func NewRunContext ¶
NewRunContext creates a new job context instance
func (*RunContext) Cancel ¶
func (r *RunContext) Cancel()
Cancel cancels the context and stops all jobs used by this context
func (*RunContext) ChildContext ¶
func (r *RunContext) ChildContext() *RunContext
ChildContext creates a new child context with separate Error channel and context
func (*RunContext) ForkContext ¶
func (r *RunContext) ForkContext() RunContext
ForkContext creates a context copy, but creates a separate sub-logger
func (*RunContext) IsAlive ¶
func (r *RunContext) IsAlive() bool
IsAlive checks if context was not finished
func (*RunContext) IsChild ¶
func (r *RunContext) IsChild() bool
IsChild checks if context is child context
func (*RunContext) Result ¶
func (r *RunContext) Result(err error)
Result reports job result and finished the context
func (*RunContext) SetWaitGroup ¶
func (r *RunContext) SetWaitGroup(wg *sync.WaitGroup)
SetWaitGroup sets wait group instance for current job
This value will be used later to call wg.Done() when job was finished.
func (*RunContext) Success ¶
func (r *RunContext) Success()
Success reports successful result.
Alias to Result(nil)
func (*RunContext) Timeout ¶
func (r *RunContext) Timeout(timeout time.Duration)
Timeout adds timeout to the context