state

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MigrationComponent = "state"

MigrationComponent is the component name for state migrations.

Variables

This section is empty.

Functions

func BuildMigrationWorkflow added in v0.7.0

func BuildMigrationWorkflow() (*automa.WorkflowBuilder, error)

BuildMigrationWorkflow returns an automa workflow for executing applicable state migrations. Returns nil if no migrations are needed.

func InitMigrations added in v0.7.0

func InitMigrations()

InitMigrations registers all state migrations. Called once at startup from root.go.

Types

type ComponentState added in v0.7.0

type ComponentState struct {
	Installed  *StateEntry `yaml:"installed,omitempty"`
	Configured *StateEntry `yaml:"configured,omitempty"`
}

ComponentState represents the state of a single component.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles state persistence for software installation and configuration

func NewManager

func NewManager(fileManager fsx.Manager) *Manager

NewManager creates a new state manager

func (*Manager) Exists

func (m *Manager) Exists(softwareName string, stateType Type) (bool, error)

Exists checks if the state file exists for the given software and state type

func (*Manager) RecordState

func (m *Manager) RecordState(softwareName string, stateType Type, version string) error

RecordState creates a state file for the given software and state type

func (*Manager) RemoveState

func (m *Manager) RemoveState(softwareName string, stateType Type) error

RemoveState removes the state file for the given software and state type

type StateEntry added in v0.7.0

type StateEntry struct {
	Version string `yaml:"version"`
}

StateEntry represents a single state entry with version info.

type Type

type Type string

Type represents the type of state being managed

const (
	// TypeInstalled indicates software installation state
	TypeInstalled Type = "installed"
	// TypeConfigured indicates software configuration state
	TypeConfigured Type = "configured"
)

type UnifiedState added in v0.7.0

type UnifiedState struct {
	Version    string                     `yaml:"version"`
	Components map[string]*ComponentState `yaml:"components"`
}

UnifiedState represents the consolidated state file structure.

type UnifiedStateMigration added in v0.7.0

type UnifiedStateMigration struct {
	// contains filtered or unexported fields
}

UnifiedStateMigration consolidates individual state files into a single state.yaml. This migration applies based on file state, not version boundaries.

func NewUnifiedStateMigration added in v0.7.0

func NewUnifiedStateMigration() *UnifiedStateMigration

NewUnifiedStateMigration creates a new unified state migration.

func (*UnifiedStateMigration) Applies added in v0.7.0

func (m *UnifiedStateMigration) Applies(mctx *migration.Context) (bool, error)

Applies returns true if there are individual state files that need to be migrated. This checks for the existence of legacy state files (*.installed, *.configured) that haven't been consolidated into state.yaml yet.

func (*UnifiedStateMigration) Description added in v0.7.0

func (m *UnifiedStateMigration) Description() string

func (*UnifiedStateMigration) Execute added in v0.7.0

func (*UnifiedStateMigration) ID added in v0.7.0

func (m *UnifiedStateMigration) ID() string

func (*UnifiedStateMigration) Rollback added in v0.7.0

func (m *UnifiedStateMigration) Rollback(ctx context.Context, mctx *migration.Context) error

Jump to

Keyboard shortcuts

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