Documentation
¶
Overview ¶
Package state provides cluster state discovery functions. TODO: This is a temporary implementation. It will be refactored into a proper state management system in a future PR.
Index ¶
- Constants
- func BuildMigrationWorkflow() (*automa.WorkflowBuilder, error)
- func GetBlockNodeNamespace() (string, error)
- func InitMigrations()
- type ComponentState
- type Manager
- type StateEntry
- type Type
- type UnifiedState
- type UnifiedStateMigration
- func (m *UnifiedStateMigration) Applies(mctx *migration.Context) (bool, error)
- func (m *UnifiedStateMigration) Description() string
- func (m *UnifiedStateMigration) Execute(ctx context.Context, mctx *migration.Context) error
- func (m *UnifiedStateMigration) ID() string
- func (m *UnifiedStateMigration) Rollback(ctx context.Context, mctx *migration.Context) error
Constants ¶
const (
// BlockNodeChartName is the chart name used to identify block node installations
BlockNodeChartName = "block-node-server"
)
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 GetBlockNodeNamespace ¶ added in v0.9.0
GetBlockNodeNamespace discovers the namespace where block node is installed by querying Helm releases and matching the chart name. Returns the namespace if found, empty string if not installed, or an error if discovery failed.
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 ¶
NewManager creates a new state manager
func (*Manager) Exists ¶
Exists checks if the state file exists for the given software and state type
func (*Manager) RecordState ¶
RecordState creates a 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 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) ID ¶ added in v0.7.0
func (m *UnifiedStateMigration) ID() string