Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config interface {
Cron() (*configv1alpha1.CronExecutionConfig, error)
}
Config knows how to return the cron config.
type Option ¶
type Option func(*Schedule)
Option is a kind of functional option.
func WithConfigLoader ¶
WithConfigLoader sets the config loader to a custom one.
type Schedule ¶
type Schedule struct {
// contains filtered or unexported fields
}
Schedule stores a list of JobConfigs that should be scheduled, and returns any JobConfigs that are not yet scheduled.
This data structure assumes that time never goes backwards (i.e. is monotonically increasing) between successive calls. In case of clock skew which moves the clock backwards, any already scheduled jobs will be simply skipped. This data structure is not thread-safe, nor does it provide any sort of concurrency control.
func (*Schedule) Bump ¶
Bump will set the JobConfig's next scheduled time in the internal heap, relative to but after popTime. If the JobConfig is in the heap previously, it will be updated.
A typical pattern would involve:
- Call Pop() to get the next JobConfig to be scheduled. This causes it to be removed from the heap.
- Actually schedule the JobConfig.
- Call Bump() to "commit" the update, which will add it back to the internal heap with a new priority.
Ideally, the caller should only call Bump after the JobConfig has been removed (via Pop or Delete) from the heap.