Skip to main content

Module timing

Module timing 

Source
Expand description

timing.v1: a stream’s cadence, its deadline and its lifespan (spec/profiles/timing/v1.md, #908).

The profile’s session-free half: the declaration read from a resolved resource (§2.2, §2.3), a reader’s deadline tracker for one provider and resource (§2.5), the lifespan of each sample a reader judges (§2.6), the period over a tool’s window (§2.7), and §5’s three questions.

declaration(kind, annotations)        ─▶ declared {period, deadline, lifespan, below_period} │ invalid [reasons] │ ignored │ not this profile's
Tracker::observe(at, event)           ─▶ missed {due, by, owner} │ met │ ended {gone, forgotten} │ beyond_bound     §2.5
  events: start │ arrival(member, expired) │ owner(present, unconfirmed, absent) │ member_gone │ tick
LifespanReader::judge(stamp)          ─▶ live │ expired │ unobservable │ not asked │ not this profile's, + reason  §2.6
period_window(period, window, …)      ─▶ kept │ not_kept │ too_short │ not_heard                                 §2.7
Holding::observe(tracker, reports, at) ─▶ each member's held time: while heard, missed or waited for, to its first end §2.7
deadline_met / period_kept / lifespan_expired ─▶ yes │ no │ unobservable │ not_asked │ not_this_profiles        §5
roll_up / roll_up_first               ─▶ a resource's or a run's answer, and its first member's reason          §5

There is no I/O and no clock here. A reader takes each arrival’s instant on its monotonic clock and each sample’s age on its wall clock, follows its provider’s presence, and hands them over as values: the runtime drives Tracker from its subscription and a one-shot timer at Tracker::next_due, and a tool drives the same tracker over its window. A sample’s age is freshness::StampAge, and a clock that falsified the deployment’s word is found as freshness.v1 §2.6 finds one, with freshness::ClockMeasure.

Structs§

DeadlineAccount
The tracker’s account of one member over the window (§2.7).
Declared
A timed resource’s values (§2.2), each None when its key is absent.
HeldSpan
How long a tool held one member in its window, so far (§2.7): its longest unbroken stretch, see Holding.
Holding
How long a tool held each member of one tracker in its window (§2.7; text 0.5, F-278, F-280): the account DeadlineAccount::held reads, the longest unbroken stretch it held the member, never the sum of its stretches.
Judged
An answer and its reason.
LifespanReader
One reader’s lifespan judgement over one reading of one provider’s resource (§2.6): the subscription’s lifetime, or a tool’s window. It remembers, per stamping clock, the stamp furthest ahead, so that a clock that falsified the deployment’s word stays unobservable for the rest of the reading.
Mono
An instant on the reader’s monotonic clock (§0): the time since an origin of the reader’s choosing, which never steps backwards.
PeriodReading
period_window’s answer: the verdict, the arrivals in the span, and the span’s length (None when not heard).
Sample
One sample’s lifespan judgement (§2.6).
Stamped
A sample’s stamp as a lifespan reader sees it (§2.6).
Tracker
One reader’s deadline tracker for one provider address and one resource (§2.5): a pure state machine over (instant, event) inputs. At each event it first judges every member it holds at that instant, then applies the event; Tracker::next_due is when a miss is next due, for a one-shot timer that meets the detection bound.
Window
What a tool’s window establishes of every member (§2.7).

Enums§

Answer
A question of §5, answered in the three states: a pole of each established kind, and the unestablished kinds apart (core O5).
Declaration
What a reader reads of a resolved resource or a requirement (§2.2, §2.3).
EndReason
Why a reader stopped judging a member (§2.5).
Event
What a reader hands its tracker, at an instant (§2.5).
Invalid
Why a declaration is invalid (§2.2), in the order checked.
MemberState
Where a held member stands (§2.5).
OwnerState
The owner’s token as the reader observes it (§0).
PeriodVerdict
What one member’s arrivals over a window say of its period (§2.7).
Question
§5’s three questions, each with the pole that is its finding.
Reason
Why an answer is what it is: the fixtures’ reasons (§2.6, §5).
Report
A report a tracker makes (§2.5).
SampleVerdict
The answer of one sample’s lifespan (§2.6).

Constants§

BOUND_FLOOR
The floor of the detection bound (§2.5): 1 ms.
DEADLINE_MS
timing.deadline_ms (§4).
FORGET_AFTER
How long after its last arrival a member that is not known, once missed, is forgotten (§2.5): an hour, core §2.7’s liveness span of a stream member.
LIFESPAN_MS
timing.lifespan_ms (§4).
MAX_MS
The largest value, in milliseconds: 2^53−1, the canonical domain’s bound (§2.2, core §9.5).
NAME
The profile’s name, as an annotation key’s prefix carries it.
PERIOD_MS
timing.period_ms (§4).
PROFILE
The profile’s id, as a contract lists it in uses.
VOCABULARY
The published vocabulary (§4): the keys under timing., which W105 reads in place of core Appendix D’s interim row (core 0.53), unchanged.

Functions§

deadline_met
§5’s first question: did this member meet its deadline over the window? No is the finding.
declaration
Reads the declaration of a resource of kind from its resolved annotations (§2.2, §2.3): [defaults], then [defaults.<kind>], then its own, as the contract model merges them (core §9.3). The kind is read first, then each key alone. Another timing.<key> is W105’s and plays no part.
declaration_of
declaration of a resource of a contract.
detection_bound
The detection bound of a deadline (§2.5): max(deadline/50, 1 ms). A reader reports a miss at most this long after it is due.
lifespan_expired
§5’s third question: did a sample of this member arrive expired? Yes is the finding.
period_kept
§5’s second question: did the owner keep this member’s period over the window? No is the finding.
period_window
One member’s period over a window from from to to (§2.7), on the reader’s monotonic clock: the span starts at from for a known member, else at its first arrival within the window, and ends at ended when the member ended within the window, else at to; its arrivals are those within the span, both ends included.
requirement_declaration
The declaration of a requirement ([requires.<role>]) from its own annotations (§2.3): a key of the vocabulary there means nothing at this version, and a linter warns of it.
roll_up
§5’s roll-up of one question over a resource or a run, read by its finding (text 0.2, F-264), a member not asked, or not this profile’s, set aside: the finding when any member’s answer is the finding; the other pole when every member’s answer is that pole or set aside, and at least one is that pole; when every member is set aside, and there is at least one, not this profile’s when every one is, else not asked (text 0.4, F-277); unobservable otherwise, an unobservable member and none the finding, or no member at all.
roll_up_first
§5’s roll-up with its reason (text 0.5, F-279): roll_up’s answer over members, each its key, its answer and its reason, and the first member giving that answer in byte order of the keys, with its reason, whatever order they come in; None over no member. Over one member or more the answer is always some member’s: unobservable is the roll-up’s only when a member’s is, or when there is none.
tracker_for
The tracker a reader judges a resource of kind and declaration d by (§2.2, §2.5): None when it judges no deadline, the resource not a stream, its declaration invalid, no deadline declared, or the deadline below the period (text 0.2, F-259). bound and known are Tracker::new’s.
zid_value
A zid’s value from its text (core §3.3): 1 to 32 hexadecimal digits, case and leading zeros carrying no meaning.