scheduler

package
v0.0.0-...-f3e8d88 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

README

package scheduler

This package is responsible of sending checks to the execution pipeline with an interval specified for any number of instance configurations coming along with any check. Only one Scheduler instance is supposed to run at any time and even if this is not a requirement, a use case for multiple schedulers didn't show up and therefore wasn't tested.

Scheduler

A Scheduler instance keeps a collection of time.Tickers associated to a list of check.Checks: every time the ticker fires, all the checks in that list are sent to the execution pipeline. Every queue runs in its own goroutine. The Scheduler expose an interface based on methods attached to the struct but the implementation makes use of channels to synchronize the queues and to talk with the scheduler loop to send commands like Run, Reload, Stop.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scheduler

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

Scheduler keeps things rolling. More docs to come...

func NewScheduler

func NewScheduler(checksPipe chan<- check.Check) *Scheduler

NewScheduler create a Scheduler and returns a pointer to it.

func (*Scheduler) Cancel

func (s *Scheduler) Cancel(id check.ID) error

Cancel remove a Check from the scheduled queue. If the check is not in the scheduler, this is a noop.

func (*Scheduler) Enter

func (s *Scheduler) Enter(check check.Check) error

Enter schedules a `Check`s for execution accordingly to the `Check.Interval()` value. If the interval is 0, the check is supposed to run only once.

func (*Scheduler) Reload

func (s *Scheduler) Reload(timeout ...time.Duration) error

Reload the scheduler

func (*Scheduler) Run

func (s *Scheduler) Run()

Run is the Scheduler main loop. This doesn't block but waits for the queues to be ready before returning.

func (*Scheduler) Stop

func (s *Scheduler) Stop(timeout ...time.Duration) error

Stop the scheduler, optionally pass an integer to specify the timeout in `time.Duration` format.

Jump to

Keyboard shortcuts

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