Documentation ¶
Overview ¶
Package scheduler maintains scheduler utility for scheduling arbitrary jobs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Job ¶
type Job interface { // ID returns the job id. ID() string // Interval returns the interval at which job should be rescheduled and // a bool determining if job should be scheduled starting now. // If false, first run will be at time now+interval. Interval() (time.Duration, bool) // ShouldEnable specifies if the job should be enabled for scheduling. ShouldEnable(context.Context) bool // Run triggers the job for single execution. It returns error if any // and a bool stating if scheduler should continue or stop scheduling. Run(context.Context) (bool, error) }
Job defines the interface between the schedule manager and the actual job.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler implements job schedule manager and offers a way to schedule/unschedule new jobs.
func (*Scheduler) IsScheduled ¶
IsScheduled returns true if job was scheduled.
func (*Scheduler) ScheduleJob ¶
ScheduleJob adds a job to schedule at defined interval.
func (*Scheduler) UnscheduleJob ¶
UnscheduleJob removes the job from schedule.
Click to show internal directories.
Click to hide internal directories.