Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultInterval ¶ added in v0.1.16
type DefaultInterval struct{}
DefaultInterval provides a standard implementation of the Interval interface. Plugins can use this directly or implement their own custom logic.
func NewDefaultInterval ¶ added in v0.1.16
func NewDefaultInterval() *DefaultInterval
NewDefaultInterval creates a new DefaultInterval instance.
func (*DefaultInterval) FromNowWhenNext ¶ added in v0.1.16
func (i *DefaultInterval) FromNowWhenNext(policy types.PluginPolicy) (time.Time, error)
FromNowWhenNext calculates when the next execution should occur based on the policy's recipe configuration. Returns zero time if there should be no more executions (policy expired or one-time completed).
type Interval ¶
type Interval interface {
FromNowWhenNext(policy types.PluginPolicy) (time.Time, error)
}
type NilService ¶
type NilService struct{}
NilService implements the scheduler.Service for plugins where scheduling not required
func NewNilService ¶
func NewNilService() *NilService
func (*NilService) Create ¶
func (s *NilService) Create(_ context.Context, _ types.PluginPolicy) error
func (*NilService) Update ¶
func (s *NilService) Update(_ context.Context, _, _ types.PluginPolicy) error
type PolicyFetcher ¶
type PolicyFetcher interface {
GetPluginPolicy(ctx context.Context, id uuid.UUID) (*types.PluginPolicy, error)
UpdatePluginPolicy(ctx context.Context, policy types.PluginPolicy) (*types.PluginPolicy, error)
}
type SafetyManager ¶ added in v0.1.16
type Storage ¶
type Storage interface {
Tx() storage.Tx
GetByPolicy(ctx context.Context, policyID uuid.UUID) (Scheduler, error)
Create(ctx context.Context, policyID uuid.UUID, next time.Time) error
Delete(ctx context.Context, policyID uuid.UUID) error
GetPending(ctx context.Context) ([]Scheduler, error)
SetNext(ctx context.Context, policyID uuid.UUID, next time.Time) error
}
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
func NewWorker ¶
func NewWorker( logger *logrus.Logger, client *asynq.Client, task, queue string, repo Storage, interval Interval, policy PolicyFetcher, schedulerMetrics metrics.SchedulerMetrics, safety SafetyManager, ) *Worker
Source Files
¶
Click to show internal directories.
Click to hide internal directories.