Documentation
¶
Overview ¶
Package oncalendar parses the subset of systemd's OnCalendar syntax that Miren accepts for scheduled tasks, and evaluates the firing times it describes.
OnCalendar is used in preference to cron because it reads left to right: "Mon *-*-* 09:00:00" is legible as "Monday at 9am" without knowing which position means what, where cron's "0 9 * * 1" is not.
Everything is evaluated in UTC. A calendar expression is a pure function of its own text, so every replica derives the same firing times from the stored config without coordinating.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DesugarEvery ¶
DesugarEvery converts an `every = "6h"` interval into the equivalent calendar expression. `every` is pure sugar: only the calendar form is ever stored, so there is exactly one scheduling mechanism.
The expansion is anchored to midnight UTC rather than to the deploy. An interval measured from "whenever this was deployed" would move every time the app ships — a daily job on an app that deploys ten times a day would fire ten times a day — and tick-based dedup could not catch it, because a new anchor produces a new tick and therefore a new entity ID. A day-aligned schedule doesn't move when you deploy, and every replica derives the same firing times from the config alone.
The cost is that only durations tiling a day evenly are accepted.
Types ¶
type Expr ¶
type Expr struct {
// contains filtered or unexported fields
}
Expr is a parsed calendar expression.
func Parse ¶
Parse parses a calendar expression. Accepted forms:
daily (and the other keywords) HH:MM[:SS] every day at that time YYYY-MM-DD HH:MM[:SS] MM-DD HH:MM[:SS] any year DOW YYYY-MM-DD HH:MM[:SS] DOW HH:MM[:SS]
Every numeric field accepts `*`, a value, a comma list, an `a..b` range, and an `a/step` or `*/step` repetition. Day-of-week accepts names, comma lists, and `Mon..Fri` ranges.