Documentation
¶
Overview ¶
Package occurrence computes the LOGICAL fire times of a recurring schedule.
The distinction this package exists to defend: an occurrence is a property of the schedule and the calendar, not of when a daemon happened to wake up. A weekly task due Monday 10:00 has exactly one Monday-10:00 occurrence whether the machine was awake for it, noticed it eight hours late, or was restarted three times in between. That is what lets a duplicate scheduler callback, a restart, and a late catch-up all resolve to the SAME ledger identity, so the unique (task, occurrence) constraint can do its job.
It lives under internal/gateway because that is where cron parsing is allowed to live (internal/guard.TestSingleCronParser): one scheduler, one parser.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Between ¶
Between returns the logical occurrences in the half-open window (after, until], oldest first, at most limit of them.
When there are more than limit, the MOST RECENT are kept and the count of dropped older ones is returned. Recency is the right bias: a stale hourly occurrence from three weeks ago has almost no value, and replaying thousands of them is how a laptop returning from a long sleep turns into a stampede.
func ID ¶
ID is the durable identity of ONE logical firing. This is the string that becomes the ledger's occurrence key, so it must depend only on the schedule and the calendar — never on wall-clock-at-discovery, hostname, or attempt.
Types ¶
type Spec ¶
type Spec struct {
Cron string
Every string
At string
TZ string // named zone for Cron; empty = local
}
Spec is a trigger's timing, in the same three forms the rest of memcode uses. Exactly one of Cron, Every or At is set.