job

package
v0.0.0-...-97dcd52 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2018 License: AGPL-3.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CleanupStep

type CleanupStep func(context.Context) (map[string]string, error)

CleanupStep is the unit of work to execute in case of failure

type Job

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

Job contains the definiton of the job to execute.

func NewJob

func NewJob(name string, steps []Step, options ...Option) (*Job, error)

NewJob returns a new Job.

func (*Job) CleanupStep

func (j *Job) CleanupStep() CleanupStep

func (*Job) ExecutionTimeout

func (j *Job) ExecutionTimeout() time.Duration

func (*Job) Name

func (j *Job) Name() string

Name returns the name which identify the job.

func (*Job) NormalDuration

func (j *Job) NormalDuration() time.Duration

func (*Job) Steps

func (j *Job) Steps() []Step

Steps returns the slice of steps.

func (*Job) SuicideTimeout

func (j *Job) SuicideTimeout() time.Duration

type Option

type Option func(*Job)

Option is used to configure the Job. It takes on argument: the Job we are operating on.

func Cleanup

func Cleanup(s CleanupStep) Option

Cleanup is the option used to set a step of cleanup

func ExecutionTimeout

func ExecutionTimeout(d time.Duration) Option

ExecutionTimeout is the option used to set the job execution timeout

func NormalDuration

func NormalDuration(d time.Duration) Option

NormalDuration is the option used to set the normal duration of job execution

func SuicideTimeout

func SuicideTimeout(d time.Duration) Option

SuicideTimeout is the option used to set the job suicide timeout

type Step

type Step func(context.Context, interface{}) (interface{}, error)

Step is a unit of work of a Job.

func Steps

func Steps(s ...Step) []Step

Steps is a syntaxic sugar for definition of a slice of Step.

Jump to

Keyboard shortcuts

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