Documentation ¶
Index ¶
- type RunContext
- func (r *RunContext) Cancel()
- func (r *RunContext) ChildContext() sdk.JobContextAccessor
- func (r *RunContext) Context() context.Context
- func (r *RunContext) Errors() chan error
- func (r *RunContext) ForkContext() sdk.JobContextAccessor
- func (r *RunContext) IsAlive() bool
- func (r *RunContext) IsChild() bool
- func (r *RunContext) Log() sdk.Logger
- func (r *RunContext) Result(err error)
- func (r *RunContext) SetErrorChannel(ch chan error)
- func (r *RunContext) SetVars(newVars sdk.Vars)
- func (r *RunContext) SetWaitGroup(wg *sync.WaitGroup)
- func (r *RunContext) Success()
- func (r *RunContext) Timeout(timeout time.Duration)
- func (r *RunContext) Vars() sdk.Vars
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RunContext ¶
type RunContext struct { // Error is job result channel Error chan error // RootVars used to hold variables of root context RootVars sdk.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() sdk.JobContextAccessor
ChildContext creates a new child context with separate Error channel and context
func (*RunContext) Context ¶
func (r *RunContext) Context() context.Context
Context returns Go context instance assigned to the current job context
func (*RunContext) Errors ¶ added in v0.8.0
func (r *RunContext) Errors() chan error
Errors returns job errors channel
func (*RunContext) ForkContext ¶
func (r *RunContext) ForkContext() sdk.JobContextAccessor
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) Log ¶ added in v0.8.0
func (r *RunContext) Log() sdk.Logger
Log provides logger for current job context
func (*RunContext) Result ¶
func (r *RunContext) Result(err error)
Result reports job result and finished the context
func (*RunContext) SetErrorChannel ¶ added in v0.11.0
func (r *RunContext) SetErrorChannel(ch chan error)
SetErrorChannel sets custom error report channel
func (*RunContext) SetVars ¶ added in v0.11.0
func (r *RunContext) SetVars(newVars sdk.Vars)
SetVars sets context variables
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
func (*RunContext) Vars ¶ added in v0.11.0
func (r *RunContext) Vars() sdk.Vars
Vars returns a set of variables attached to this context