jobmanager

package
v4.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidArgs = errors.New("invalid arguments")

Functions

This section is empty.

Types

type Cursor

type Cursor struct {
	Path      string
	SortBy    string
	Reverse   bool
	LastValue string
	Limit     int64
}

func (*Cursor) Decode

func (c *Cursor) Decode(s string) error

func (Cursor) Encode

func (c Cursor) Encode() string

type JobManager

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

func New

func (*JobManager) Cancel

func (m *JobManager) Cancel(ctx context.Context, path, body string) error

Cancel deletes the job with path and body.

func (*JobManager) Disable

func (m *JobManager) Disable(ctx context.Context, path, body string) (*table.Job, error)

Disable prevents a job from from running until re-enabled. Disabling an I/P job does not cancel its current run.

func (*JobManager) Enable

func (m *JobManager) Enable(ctx context.Context, path, body string) (*table.Job, error)

Enable reschedules a disabled job so that it will run again.

func (*JobManager) Get

func (m *JobManager) Get(ctx context.Context, path, body string) (*table.Job, error)

func (*JobManager) List

func (m *JobManager) List(ctx context.Context, path, sortBy string, reverse bool, limit int64) (jobs []table.Job, cursor string, err error)

func (*JobManager) ListContinue

func (m *JobManager) ListContinue(ctx context.Context, cursor string) (jobs []table.Job, nextCursor string, err error)

func (*JobManager) Running

func (m *JobManager) Running() int

Running returns the number of running jobs currently.

func (*JobManager) Schedule

func (m *JobManager) Schedule(ctx context.Context, path, body string, opt ScheduleOptions) (*table.Job, error)

Schedule inserts a new job to the table or replaces existing one. Returns the created or replaced job.

type ScheduleOptions

type ScheduleOptions struct {
	OneOff    bool
	Immediate bool
	FirstRun  time.Time
	Location  *time.Location
	Interval  duration.Duration
}

Jump to

Keyboard shortcuts

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