Documentation ¶
Index ¶
- Constants
- func NewDefaultContext(sysCtx context.Context) env.JobContext
- type Context
- func (c *Context) Build(dep env.JobData) (env.JobContext, error)
- func (c *Context) Checkin(status string) error
- func (c *Context) Get(prop string) (interface{}, bool)
- func (c *Context) GetLogger() logger.Interface
- func (c *Context) Init() error
- func (c *Context) LaunchJob(req jmodel.JobRequest) (jmodel.JobStats, error)
- func (c *Context) OPCommand() (string, bool)
- func (c *Context) SystemContext() context.Context
- type DefaultContext
- func (c *DefaultContext) Build(dep env.JobData) (env.JobContext, error)
- func (c *DefaultContext) Checkin(status string) error
- func (c *DefaultContext) Get(prop string) (interface{}, bool)
- func (c *DefaultContext) GetLogger() logger.Interface
- func (c *DefaultContext) LaunchJob(req jmodel.JobRequest) (jmodel.JobStats, error)
- func (c *DefaultContext) OPCommand() (string, bool)
- func (c *DefaultContext) SystemContext() context.Context
- type DemoJob
Constants ¶
const (
// KnownJobDemo is name of demo job
KnownJobDemo = "DEMO"
)
Variables ¶
This section is empty.
Functions ¶
func NewDefaultContext ¶
func NewDefaultContext(sysCtx context.Context) env.JobContext
NewDefaultContext is constructor of building DefaultContext
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context ...
func NewContext ¶
NewContext ...
func (*Context) Build ¶
Build implements the same method in env.JobContext interface This func will build the job execution context before running
func (*Context) OPCommand ¶
OPCommand return the control operational command like stop/cancel if have
func (*Context) SystemContext ¶
SystemContext implements the same method in env.JobContext interface
type DefaultContext ¶
type DefaultContext struct {
// contains filtered or unexported fields
}
DefaultContext provides a basic job context
func (*DefaultContext) Build ¶
func (c *DefaultContext) Build(dep env.JobData) (env.JobContext, error)
Build implements the same method in env.JobContext interface This func will build the job execution context before running 构造需要执行 job 的 context,将三个函数通过注入的方式提取到 jobContext 中
func (*DefaultContext) Checkin ¶
func (c *DefaultContext) Checkin(status string) error
Checkin is bridge func for reporting detailed status
func (*DefaultContext) Get ¶
func (c *DefaultContext) Get(prop string) (interface{}, bool)
Get implements the same method in env.JobContext interface
func (*DefaultContext) GetLogger ¶
func (c *DefaultContext) GetLogger() logger.Interface
GetLogger returns the logger
func (*DefaultContext) LaunchJob ¶
func (c *DefaultContext) LaunchJob(req jmodel.JobRequest) (jmodel.JobStats, error)
LaunchJob launches sub jobs
func (*DefaultContext) OPCommand ¶
func (c *DefaultContext) OPCommand() (string, bool)
OPCommand return the control operational command like stop/cancel if have
func (*DefaultContext) SystemContext ¶
func (c *DefaultContext) SystemContext() context.Context
SystemContext implements the same method in env.JobContext interface
type DemoJob ¶
type DemoJob struct{}
DemoJob is the job to demostrate the job interface.