scheduler

package
v1.8.0-rc2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ScheduleItem

type ScheduleItem struct {
	TaskID      int64 // used as the param in the hook
	SrcResource *model.Resource
	DstResource *model.Resource
}

ScheduleItem is an item that can be scheduled

type ScheduleResult

type ScheduleResult struct {
	TaskID int64
	JobID  string
	Error  error
}

ScheduleResult is the result of the schedule for one item

type Scheduler

type Scheduler interface {
	// Preprocess the resources and returns the item list that can be scheduled
	Preprocess([]*model.Resource, []*model.Resource) ([]*ScheduleItem, error)
	// Schedule the items. If got error when scheduling one of the items,
	// the error should be put in the corresponding ScheduleResult and the
	// returning error of this function should be nil
	Schedule([]*ScheduleItem) ([]*ScheduleResult, error)
	// Stop the job specified by ID
	Stop(id string) error
}

Scheduler schedules

func NewScheduler

func NewScheduler(js cjob.Client) Scheduler

NewScheduler returns an instance of Scheduler

Jump to

Keyboard shortcuts

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