impl

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 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 added in v1.7.0

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 added in v1.7.0

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 added in v1.7.0

type DefaultContext struct {
	// contains filtered or unexported fields
}

DefaultContext provides a basic job context

func (*DefaultContext) Build added in v1.7.0

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

func (*DefaultContext) Checkin added in v1.7.0

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

Checkin is bridge func for reporting detailed status

func (*DefaultContext) Get added in v1.7.0

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

Get implements the same method in env.JobContext interface

func (*DefaultContext) GetLogger added in v1.7.0

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

GetLogger returns the logger

func (*DefaultContext) LaunchJob added in v1.7.0

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

LaunchJob launches sub jobs

func (*DefaultContext) OPCommand added in v1.7.0

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

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

func (*DefaultContext) SystemContext added in v1.7.0

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