Documentation
¶
Overview ¶
Package collect holds the values long-running collectors publish between recomputes (design §4.1 gap 2). A change requests a recompute through pkg/trigger; the engine reads a Snapshot per computation and its Print on every confirm tick (D-019).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Snapshot ¶
type Snapshot struct {
// Values is a copy of the map; the values' Data is shared and read-only.
Values map[string]Value
// Print covers each key's fingerprint, state, reason and expiry, so an
// expiry is a change. It is zero for an empty store.
Print uint64
}
Snapshot is the store's values at one instant. An expired value is already Unavailable in it, without data.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds the collected values by key, "<collector>/<key>". It is safe for concurrent use.
func New ¶
New returns an empty Store that notifies changes on every change; a nil changes never notifies.
func (*Store) Fail ¶
Fail marks key as Failing or Off with reason and drops its data; any other st is recorded as Failing. It notifies when the state or reason changes. A stopped collector's failure is dropped.
func (*Store) Publish ¶
Publish stores data under key with State OK, expiring after ttl (zero means never), and takes ownership of data. It notifies only when the fingerprint changes, the previous value was not current or the expiry moves earlier (or appears), so the engine schedules it. A stopped collector's publish is dropped.
type Value ¶
type Value struct {
// Data is owned by the store once published: the collector never mutates
// it afterwards and readers treat it as read-only.
Data any
// Fingerprint identifies Data; an equal fingerprint is no change.
Fingerprint uint64
// At is when the value was last published or failed.
At time.Time
// Expires is when the value turns Unavailable; zero means never.
Expires time.Time
State State
// Reason explains a state other than OK.
Reason string
}
Value is one published value. Data is set only while State is OK.