Documentation ¶
Index ¶
- Constants
- type Coordinator
- func (c *Coordinator) RunCancelled(ctx context.Context, runID influxdb.ID) error
- func (c *Coordinator) RunForced(ctx context.Context, task *influxdb.Task, run *influxdb.Run) error
- func (c *Coordinator) RunRetried(ctx context.Context, task *influxdb.Task, run *influxdb.Run) error
- func (c *Coordinator) TaskCreated(ctx context.Context, task *influxdb.Task) error
- func (c *Coordinator) TaskDeleted(ctx context.Context, id influxdb.ID) error
- func (c *Coordinator) TaskUpdated(ctx context.Context, from, to *influxdb.Task) error
- type CoordinatorOption
- type Executor
- type SchedulableTask
Constants ¶
const DefaultLimit = 1000
DefaultLimit is the maximum number of tasks that a given taskd server can own
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
Coordinator is the intermediary between the scheduling/executing system and the rest of the task system
func NewCoordinator ¶
func NewCoordinator(log *zap.Logger, scheduler scheduler.Scheduler, executor Executor, opts ...CoordinatorOption) *Coordinator
func (*Coordinator) RunCancelled ¶
func (c *Coordinator) RunCancelled(ctx context.Context, runID influxdb.ID) error
RunCancelled speaks directly to the executor to cancel a task run
func (*Coordinator) RunForced ¶
func (c *Coordinator) RunForced(ctx context.Context, task *influxdb.Task, run *influxdb.Run) error
RunForced speaks directly to the Executor to run a task immediately
func (*Coordinator) RunRetried ¶
func (c *Coordinator) RunRetried(ctx context.Context, task *influxdb.Task, run *influxdb.Run) error
RunRetried speaks directly to the executor to re-try a task run immediately
func (*Coordinator) TaskCreated ¶
func (c *Coordinator) TaskCreated(ctx context.Context, task *influxdb.Task) error
TaskCreated asks the Scheduler to schedule the newly created task
func (*Coordinator) TaskDeleted ¶
func (c *Coordinator) TaskDeleted(ctx context.Context, id influxdb.ID) error
TaskDeleted asks the Scheduler to release the deleted task
func (*Coordinator) TaskUpdated ¶
func (c *Coordinator) TaskUpdated(ctx context.Context, from, to *influxdb.Task) error
TaskUpdated releases the task if it is being disabled, and schedules it otherwise
type CoordinatorOption ¶
type CoordinatorOption func(*Coordinator)
func WithLimitOpt ¶
func WithLimitOpt(i int) CoordinatorOption
type Executor ¶
type Executor interface { ManualRun(ctx context.Context, id influxdb.ID, runID influxdb.ID) (executor.Promise, error) Cancel(ctx context.Context, runID influxdb.ID) error }
Executor is an abstraction of the task executor with only the functions needed by the coordinator
type SchedulableTask ¶
type SchedulableTask struct { *influxdb.Task // contains filtered or unexported fields }
SchedulableTask is a wrapper around the Task struct, giving it methods to make it compatible with the Scheduler
func NewSchedulableTask ¶
func NewSchedulableTask(task *influxdb.Task) (SchedulableTask, error)
NewSchedulableTask transforms an influxdb task to a schedulable task type
func (SchedulableTask) ID ¶
func (t SchedulableTask) ID() scheduler.ID
func (SchedulableTask) LastScheduled ¶
func (t SchedulableTask) LastScheduled() time.Time
LastScheduled parses the task's LatestCompleted value as a Time object
func (SchedulableTask) Offset ¶
func (t SchedulableTask) Offset() time.Duration
Offset returns a time.Duration for the Task's offset property
func (SchedulableTask) Schedule ¶
func (t SchedulableTask) Schedule() scheduler.Schedule
Schedule takes the time a Task is scheduled for and returns a Schedule object