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 ¶
- func DiffUnits(oldUnits, newUnits map[string]struct{}) []string
- type RepoState
- type State
- func (s *State) ChangedUnits(newStates map[string]UnitState) []string
- func (s *State) CollectAllManagedUnits() map[string]struct{}
- func (s *State) GetImageDigest(image string) 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) PruneRemovedRepos(configuredRepos map[string]struct{})
- func (s *State) RemoveUnitState(unitName string)
- func (s *State) Save(path string) error
- func (s *State) SetCommit(repoName, commitHash string)
- func (s *State) SetImageDigest(image, digest 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 ¶
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"`
ImageDigests map[string]string `json:"image_digests,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) CollectAllManagedUnits ¶ added in v0.31.1
CollectAllManagedUnits returns a set of all unit filenames across all repositories.
func (*State) GetImageDigest ¶ added in v0.32.0
GetImageDigest returns the stored remote digest for an image.
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) PruneRemovedRepos ¶ added in v0.31.1
PruneRemovedRepos clears managed units for repositories no longer present in the provided set of configured repository names.
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) SetImageDigest ¶ added in v0.32.0
SetImageDigest records the remote digest for an image after a successful pull.
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.