impl

package
v0.0.0-...-977965f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
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

func NewContext(sysCtx context.Context, adminClient client.Client) *Context

NewContext ...

func (*Context) Build

func (c *Context) 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

func (*Context) Checkin

func (c *Context) Checkin(status string) error

Checkin is bridge func for reporting detailed status

func (*Context) Get

func (c *Context) Get(prop string) (interface{}, bool)

Get implements the same method in env.JobContext interface

func (*Context) GetLogger

func (c *Context) GetLogger() logger.Interface

GetLogger returns the logger

func (*Context) Init

func (c *Context) Init() error

Init ...

func (*Context) LaunchJob

func (c *Context) LaunchJob(req jmodel.JobRequest) (jmodel.JobStats, error)

LaunchJob launches sub jobs

func (*Context) OPCommand

func (c *Context) OPCommand() (string, bool)

OPCommand return the control operational command like stop/cancel if have

func (*Context) SystemContext

func (c *Context) SystemContext() context.Context

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.

func (*DemoJob) MaxFails

func (dj *DemoJob) MaxFails() uint

MaxFails is implementation of same method in Interface.

func (*DemoJob) Run

func (dj *DemoJob) Run(ctx env.JobContext, params map[string]interface{}) error

Run the replication logic here.

func (*DemoJob) ShouldRetry

func (dj *DemoJob) ShouldRetry() bool

ShouldRetry ...

func (*DemoJob) Validate

func (dj *DemoJob) Validate(params map[string]interface{}) error

Validate is implementation of same method in Interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL