Documentation
¶
Overview ¶
Package pubgate is the publication gate's state (ADR-0064 part D, "When the gate is armed"): whether it is armed, by which activation and why, the segment the promotion came from, and the disarm rule.
Contract ¶
- Arming records the activation's lineage, the time, the reason, and the promoted-from segment (the lineage this node followed, capped at the version it had applied) when there is one. It also records the diagnostic window (cap, cap + Jump] (R1-L1).
- Disarm is automatic once every enrolled, non-revoked node has, since the arming, been classified trusted (R1-M8). Accounting is by node ID: a node counts only with a trusted classification seen at or after the arming. With no enrolled node, nothing is pending.
- The stored form is versioned. A value that does not decode, or an unknown version, is an error: the application decides what an unreadable gate means.
Boundary ¶
A leaf: standard library only, no package state, no init, no goroutine, no clock of its own (times are passed in). The application owns where the gate is stored, when it arms and disarms, which nodes are enrolled, how reports are classified, auditing, and every serving decision built on the gate.
Index ¶
Constants ¶
const Jump int64 = 1 << 20
Jump is the counter jump an arming makes above every trusted last it knows (ADR-0064 part D, "The version counter"); the diagnostic window's width.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Source ¶
Source is the segment a promotion came from: the lineage this node followed and the version it had applied (a lower bound of what that leader issued).
type State ¶
type State struct {
Armed bool
// Lineage is the activation that armed the gate.
Lineage [16]byte
// At is when the gate last armed or disarmed.
At time.Time
// Reason is why it last armed or disarmed.
Reason string
// Source is the promoted-from segment; nil when the promotion followed no
// lineage (an empty or resyncing record).
Source *Source
}
State is the gate's state. The zero value is unarmed.
func Arm ¶
Arm returns the state armed by activation l at now for reason, with the promoted-from segment src (nil for none).