Documentation
¶
Index ¶
- type JobCallback
- type JobSchedule
- type Service
- func (s *Service) ListSchedules(ctx context.Context) ([]JobSchedule, error)
- func (s *Service) LoadFromSettings(ctx context.Context) error
- func (s *Service) NextRun(jobName string) (time.Time, bool)
- func (s *Service) RegisterJob(jobName string, callback JobCallback) error
- func (s *Service) Start()
- func (s *Service) Stop() context.Context
- func (s *Service) Timezone() string
- func (s *Service) UpdateJobSchedule(ctx context.Context, jobName string, enabled bool, cronSpec string) error
- func (s *Service) UpdateTimezone(ctx context.Context, timezone string) error
- func (s *Service) ValidateCron(spec string) error
- type SettingsStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JobCallback ¶
JobCallback is invoked by scheduler ticks.
type JobSchedule ¶
type JobSchedule struct {
JobName string `json:"job_name"`
Enabled bool `json:"enabled"`
CronSpec string `json:"cron_spec"`
NextRun time.Time `json:"next_run,omitempty"`
LastError string `json:"last_error,omitempty"`
}
JobSchedule is one persisted scheduler configuration with runtime next-run state.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service loads, validates, and executes cron schedules backed by settings.
func (*Service) ListSchedules ¶
func (s *Service) ListSchedules(ctx context.Context) ([]JobSchedule, error)
ListSchedules returns persisted schedule configuration plus runtime next-run values.
func (*Service) LoadFromSettings ¶
LoadFromSettings rebuilds entries using persisted settings.
func (*Service) RegisterJob ¶
func (s *Service) RegisterJob(jobName string, callback JobCallback) error
RegisterJob registers a runtime callback for a supported job name.
func (*Service) Start ¶
func (s *Service) Start()
Start begins cron execution for currently loaded entries.
func (*Service) UpdateJobSchedule ¶
func (s *Service) UpdateJobSchedule(ctx context.Context, jobName string, enabled bool, cronSpec string) error
UpdateJobSchedule validates, persists, and applies one job schedule at runtime.
func (*Service) UpdateTimezone ¶
UpdateTimezone persists timezone and reloads schedule entries.
func (*Service) ValidateCron ¶
ValidateCron validates cron spec with support for 5-field and optional-seconds format.