Documentation ¶
Index ¶
- type Scheduler
- func (sch *Scheduler) AddOnce(id string, start time.Time, fn func(context.Context, time.Time)) bool
- func (sch *Scheduler) AddRecurring(id string, start time.Time, freq time.Duration, ...) bool
- func (sch *Scheduler) Cancel(id string) bool
- func (sch *Scheduler) Start() bool
- func (sch *Scheduler) Stop() bool
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 wraps an underlying scheduler to provide task tracking by unique string identifiers, so jobs may be cancelled with only an identifier.
func (*Scheduler) AddOnce ¶
AddOnce schedules the given task to run at time, registered under the given ID. Returns false if task already exists for id.
func (*Scheduler) AddRecurring ¶
func (sch *Scheduler) AddRecurring(id string, start time.Time, freq time.Duration, fn func(context.Context, time.Time)) bool
AddRecurring schedules the given task to return at given period, starting at given time, registered under given id. Returns false if task already exists for id.
func (*Scheduler) Cancel ¶
Cancel attempts to cancel a scheduled task with id, returns false if no task found.
Click to show internal directories.
Click to hide internal directories.