Documentation
¶
Overview ¶
Package configstate holds the configuration state Current and Global share: what was pushed, what is in force, and the checksum every configuration is identified by. What each one configures, what its checksum covers and what it reports stay with it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Accepted ¶
type Accepted struct {
Values addonutils.Values
Checksum string
}
Accepted is the configuration in force in the object: its effective values and their checksum.
func (Accepted) Checkpoint ¶
func (a Accepted) Checkpoint(cr *model.CurrentReport)
Checkpoint writes a as the settings checkpoint (AppliedValues), what the next boot restores.
type Outcome ¶
type Outcome struct {
// Err: not accepted; the last accepted configuration stays in force and the retry is held
// until Until.
Err error
Until time.Time
// Changed: the effective values in force changed (the first accept included).
Changed bool
}
Outcome is the result of Accept.
type State ¶
type State struct {
Pushed string // Pushed is the checksum last given to Accept, accepted or not.
AcceptedChecksum string // AcceptedChecksum is the one whose accept succeeded last.
Accepted *Accepted // Accepted is in force in the object; nil until the first accept.
}
State is what was given to Accept and what is in force. Configurations are identified by their checksum: most pushes repeat the content in a new value, and they must neither reconfigure the object nor cancel a run. Only Accept writes it; one loop owns it.
func (*State) Accept ¶
func (s *State) Accept(checksum string, backoff *retry.Backoff, clock retry.Clock, configure func() (addonutils.Values, string, error)) Outcome
Accept records checksum as pushed and runs configure, which takes the configuration into the object and returns the effective values with their checksum. A failure keeps the last accepted configuration in force and holds its retry in backoff, keyed by checksum and counted from the failure (validation may take long).
func (State) InForce ¶
InForce reports whether the configuration of checksum is the one the object holds and Configured reports: the last accept was of it and it succeeded. Not so after another configuration was tried since, even if that one failed, so pushing the old one again reports Configured=true.