Documentation
¶
Overview ¶
Package state manages deployment state for quad-ops, tracking current and previous commit hashes per repository to enable rollback, and content hashes per unit for change detection.
Index ¶
- type RepoState
- type State
- func (s *State) ChangedUnits(newStates map[string]UnitState) []string
- func (s *State) GetManagedUnits(repoName string) []string
- func (s *State) GetPrevious(repoName string) string
- func (s *State) GetUnitState(unitName string) (UnitState, bool)
- func (s *State) RemoveUnitState(unitName string)
- func (s *State) Save(path string) error
- func (s *State) SetCommit(repoName, commitHash string)
- func (s *State) SetManagedUnits(repoName string, units []string)
- func (s *State) SetUnitState(unitName string, us UnitState)
- type UnitState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RepoState ¶
type RepoState struct {
Current string `json:"current"`
Previous string `json:"previous,omitempty"`
}
RepoState tracks the deployed commit hashes for a single repository.
type State ¶
type State struct {
Repositories map[string]RepoState `json:"repositories"`
ManagedUnits map[string][]string `json:"managed_units,omitempty"`
UnitStates map[string]UnitState `json:"unit_states,omitempty"`
}
State holds the deployment state for all repositories.
func (*State) ChangedUnits ¶ added in v0.30.8
ChangedUnits compares new unit states against stored states and returns unit names that previously existed with different content or bind mount hashes. New units (not previously tracked) are excluded — they only need start, not restart.
func (*State) GetManagedUnits ¶ added in v0.30.1
GetManagedUnits returns the quadlet unit filenames managed for a repository.
func (*State) GetPrevious ¶
GetPrevious returns the previous commit hash for the named repository. Returns empty string if no previous state exists.
func (*State) GetUnitState ¶ added in v0.30.8
GetUnitState returns the stored content hashes for a unit. The second return value is false if no state exists for the unit.
func (*State) RemoveUnitState ¶ added in v0.30.8
RemoveUnitState removes stored content hashes for a unit.
func (*State) SetCommit ¶
SetCommit records a new deployment for the named repository, shifting the current commit to previous.
func (*State) SetManagedUnits ¶ added in v0.30.1
SetManagedUnits records the quadlet unit filenames managed for a repository.
func (*State) SetUnitState ¶ added in v0.30.8
SetUnitState records content hashes for a unit.