state

package
v0.30.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package state manages deployment state for quad-ops, tracking current and previous commit hashes per repository to enable rollback.

Index

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"`
}

State holds the deployment state for all repositories.

func Load

func Load(path string) (*State, error)

Load reads the state file from disk. Returns an empty state if the file does not exist.

func (*State) GetManagedUnits added in v0.30.1

func (s *State) GetManagedUnits(repoName string) []string

GetManagedUnits returns the quadlet unit filenames managed for a repository.

func (*State) GetPrevious

func (s *State) GetPrevious(repoName string) string

GetPrevious returns the previous commit hash for the named repository. Returns empty string if no previous state exists.

func (*State) Save

func (s *State) Save(path string) error

Save writes the state to disk, creating parent directories as needed.

func (*State) SetCommit

func (s *State) SetCommit(repoName, commitHash string)

SetCommit records a new deployment for the named repository, shifting the current commit to previous.

func (*State) SetManagedUnits added in v0.30.1

func (s *State) SetManagedUnits(repoName string, units []string)

SetManagedUnits records the quadlet unit filenames managed for a repository.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL