Documentation
¶
Overview ¶
Package scheduler provides task scheduling and job management.
Index ¶
- func DefaultJobs() []*models.ScheduledJob
- type Handler
- type Option
- func WithCache(c *cache.RedisCache) Option
- func WithConnectorFactory(factory connector.Factory) Option
- func WithCron(c *cron.Cron) Option
- func WithCronParser(p cron.Parser) Option
- func WithEmailAccountLister(repo emailAccountLister) Option
- func WithEmailHandler(handler connector.Handler) Option
- func WithJobs(jobs []*models.ScheduledJob) Option
- func WithLocation(loc *time.Location) Option
- func WithLogger(l *log.Logger) Option
- func WithPushConfig(cfg push.PushConfig) Option
- func WithReminderHub(h notifications.Hub) Option
- func WithTicketAutoCloser(repo ticketAutoCloser) Option
- type PluginAdapter
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultJobs ¶
func DefaultJobs() []*models.ScheduledJob
DefaultJobs returns a cloned copy of the built-in scheduled jobs.
Types ¶
type Handler ¶
type Handler func(context.Context, *models.ScheduledJob) error
Handler executes a scheduled job.
type Option ¶
type Option func(*options)
Option applies configuration to the scheduler service.
func WithCache ¶
func WithCache(c *cache.RedisCache) Option
WithCache injects the Redis/Valkey cache client used for status persistence.
func WithConnectorFactory ¶
WithConnectorFactory overrides the inbound connector factory.
func WithCronParser ¶
WithCronParser allows replacing the cron expression parser.
func WithEmailAccountLister ¶
func WithEmailAccountLister(repo emailAccountLister) Option
WithEmailAccountLister injects the repository used for email polling.
func WithEmailHandler ¶
WithEmailHandler injects the connector.Handler used to process inbound messages.
func WithJobs ¶
func WithJobs(jobs []*models.ScheduledJob) Option
WithJobs registers explicit job definitions instead of defaults.
func WithLocation ¶
WithLocation sets the scheduler timezone location.
func WithLogger ¶
WithLogger injects a custom logger implementation.
func WithPushConfig ¶ added in v0.8.1
func WithPushConfig(cfg push.PushConfig) Option
WithPushConfig injects VAPID configuration for push notifications.
func WithReminderHub ¶
func WithReminderHub(h notifications.Hub) Option
WithReminderHub injects a custom reminder hub for dispatching pending reminders.
func WithTicketAutoCloser ¶
func WithTicketAutoCloser(repo ticketAutoCloser) Option
WithTicketAutoCloser injects a custom ticket auto-close repository.
type PluginAdapter ¶ added in v0.9.0
type PluginAdapter struct {
// contains filtered or unexported fields
}
PluginAdapter adapts the product scheduler.Service to the plugin runtime's PlatformScheduler interface, breaking the transitive import dependency from internal/plugin to internal/models and internal/services/scheduler.
func NewPluginAdapter ¶ added in v0.9.0
func NewPluginAdapter(svc *Service) *PluginAdapter
NewPluginAdapter wraps a scheduler.Service as a PlatformScheduler.
func (*PluginAdapter) AddJob ¶ added in v0.9.0
func (a *PluginAdapter) AddJob(job *plugin.PlatformScheduledJob) error
AddJob translates a platform-level job to the product's ScheduledJob and delegates to the underlying scheduler.Service.
func (*PluginAdapter) RegisterHandler ¶ added in v0.9.0
func (a *PluginAdapter) RegisterHandler(name string, handler func(ctx context.Context, job *plugin.PlatformScheduledJob) error)
RegisterHandler wraps a platform-level handler so it can be registered with the product scheduler.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service coordinates scheduled job execution.
func NewService ¶
NewService wires a scheduler around the shared database connection.
func (*Service) AddJob ¶
func (s *Service) AddJob(job *models.ScheduledJob) error
AddJob dynamically adds a job to the scheduler. The job's Handler field should match a registered handler name. Can be called after the scheduler has started.
func (*Service) RegisterHandler ¶
RegisterHandler attaches or replaces a handler for the given name. Passing nil removes the handler.