Documentation
¶
Overview ¶
Package nodesettings holds the policy for settings that are persisted on first start and enforced on every subsequent start. It has no database or configuration dependencies so the policy can be tested in isolation.
Index ¶
Constants ¶
const ( LatchOff = "off" LatchOn = "on" )
Latch and taint value encodings.
const NoStartEra = "none"
NoStartEra is the canonical persisted value recording that a database was created (or last confirmed) with no start era override. start_era's class is FrozenFillOnce, which treats an empty configured value as "not known yet" (see evaluate.go) -- correct for a caller that genuinely cannot supply the gate, but wrong for the ordinary case of a full node startup with no --start-era flag, where "" meant "nothing to compare" and the gate was silently never recorded. Every writer that can distinguish "no start era" from "don't know" must persist this sentinel instead of "", so a later --start-era dijkstra against that database is compared against something rather than filling in for free.
Variables ¶
This section is empty.
Functions ¶
func EncodeLatchBool ¶
EncodeLatchBool renders a LatchBool value. carried is the associated setting, such as a pledge leverage factor, and is empty for gates that carry nothing.
Types ¶
type Class ¶
type Class int
Class determines how a gate reacts when the configured value differs from the persisted one.
const ( // Frozen requires the configured value to equal the persisted one. Frozen Class = iota // FrozenFillOnce behaves like Frozen but treats an empty configured // value as "not known yet" and an empty persisted value as fillable. FrozenFillOnce // LatchEnum permits movement forward through Ordered only. LatchEnum // LatchBool permits off to on only. Values are LatchOff, LatchOn, or // LatchOn plus a carried value (see EncodeLatchBool). LatchBool // Taint is a sticky bit: once on it stays on and stops being compared, // and it may never be turned on for a database that lacks it. Taint )
type Gate ¶
type Gate struct {
// Name is the key stored in node_settings_gate.
Name string
// Label is the operator-facing name used in error messages. It defaults
// to Name when empty. storage_mode and network must label themselves
// "storage mode" and "network" to preserve the message wording that
// existing tests in database/storage_mode_test.go assert against.
Label string
// Class selects the enforcement rule.
Class Class
// Ordered lists permitted LatchEnum values in transition order. It is
// unused by every other class.
Ordered []string
// OverrideEligible allows a persisted value to supply the effective
// value when the configured one was not set explicitly. A gate is
// eligible only when its persisted value is self-sufficient, needing
// no companion configuration that is not itself persisted.
OverrideEligible bool
// Remedy overrides the operator-facing fix description used in a
// Mismatch's Reason for the Frozen and FrozenFillOnce classes, whose
// default reason ("changing it requires re-syncing from scratch") is
// wrong for a gate whose real fix is not a resync. Empty uses the
// default.
Remedy string
}
Gate describes one persisted setting.
type Result ¶
type Result struct {
// Effective is the value the caller should actually use for each gate
// present in configured, after any override.
Effective Values
// Writes are the values to persist. Empty when nothing changed.
Writes Values
// Mismatches is non-empty when startup must fail.
Mismatches []Mismatch
}
Result is the outcome of an evaluation.
func Evaluate ¶
Evaluate applies the registry to a persisted and configured value set.
explicit reports, per gate, whether the configured value came from an operator (a flag, an environment variable, or a config file) rather than a built-in default. It is the only thing separating "resume what this database already is" from "the operator asked for something incompatible", so callers that genuinely mean every value they pass, such as database.New, mark them all explicit and get strict validation with no override behavior.
A gate absent from configured is skipped: the caller does not know that value yet, which is normal for tool paths that never load a cardano config.