Documentation ¶
Index ¶
- type Parameter
- type Service
- func (s *Service) CancelJob(ctx context.Context, name string) error
- func (s *Service) CancelJobIfExists(ctx context.Context, name string)
- func (s *Service) CancelJobs(ctx context.Context, prefix string)
- func (s *Service) JobExists(ctx context.Context, name string) bool
- func (s *Service) ListJobs(ctx context.Context) []string
- func (s *Service) RunJob(ctx context.Context, name string) error
- func (s *Service) RunJobIfExists(ctx context.Context, name string)
- func (s *Service) ScheduleJob(ctx context.Context, name string, runtime time.Time, jobFunc scheduler.JobFunc, ...) error
- func (s *Service) SchedulePeriodicJob(ctx context.Context, name string, runtimeFunc scheduler.RuntimeFunc, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parameter ¶
type Parameter interface {
// contains filtered or unexported methods
}
Parameter is the interface for service parameters.
func WithLogLevel ¶
WithLogLevel sets the log level for the module.
func WithMonitor ¶
func WithMonitor(monitor metrics.SchedulerMonitor) Parameter
WithMonitor sets the monitor for this module.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a controller service.
func (*Service) CancelJob ¶
CancelJob removes a named job. If the job does not exist it will return an appropriate error.
func (*Service) CancelJobIfExists ¶ added in v1.2.0
CancelJobIfExists cancels a job that may or may not exist. If this is a period job then all future instances are cancelled.
func (*Service) CancelJobs ¶
CancelJobs cancels all jobs with the given prefix. If the prefix matches a period job then all future instances are cancelled.
func (*Service) RunJob ¶
RunJob runs a named job immediately. If the job does not exist it will return an appropriate error.
func (*Service) RunJobIfExists ¶
RunJobIfExists runs a job if it exists. This does not return an error if the job does not exist.
func (*Service) ScheduleJob ¶
func (s *Service) ScheduleJob(ctx context.Context, name string, runtime time.Time, jobFunc scheduler.JobFunc, data interface{}) error
ScheduleJob schedules a one-off job for a given time. Note that if the parent context is cancelled the job wil not run.
func (*Service) SchedulePeriodicJob ¶
func (s *Service) SchedulePeriodicJob(ctx context.Context, name string, runtimeFunc scheduler.RuntimeFunc, runtimeData interface{}, jobFunc scheduler.JobFunc, jobData interface{}) error
SchedulePeriodicJob schedules a job to run in a loop. The loop starts by calling runtimeFunc, which sets the time for the first run. Once the time as specified by runtimeFunc is met, jobFunc is called. Once jobFunc returns, go back to the beginning of the loop.