blocknode

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package blocknode implements the business logic layer for block-node intents.

The routing Handler receives a models.Intent, delegates preparation of effective inputs and workflow construction to the appropriate per-action handler, executes the workflow, and flushes state to disk.

Extending with a new action: implement IntentHandler[models.BlockNodeInputs] in a new file and add a case to Handler.HandleIntent. No other file changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handlers added in v0.16.0

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

Handlers is the private struct that holds all per-action handlers for block-node intents.

func NewHandlerFactory

func NewHandlerFactory(
	runtime *rsl.RuntimeResolver,
) (*Handlers, error)

NewHandlerFactory validates dependencies and returns a Handlers with all handlers initialized. All dependencies are required; any nil returns an error.

func (*Handlers) ForAction added in v0.16.0

func (h *Handlers) ForAction(
	action models.ActionType,
) (bll.IntentHandler[models.BlockNodeInputs], error)

ForAction returns the appropriate IntentHandler for the given action, or an error if the action is unsupported.

type InstallHandler

type InstallHandler struct {
	bll.BaseHandler[models.BlockNodeInputs]
	// contains filtered or unexported fields
}

InstallHandler handles the ActionInstall intent for a block node. It resolves effective inputs (applying RequiresExplicitOverride guards so fields already set by a running deployment cannot be silently overridden), then builds an install workflow that optionally bootstraps the cluster first.

func (*InstallHandler) BuildWorkflow

func (h *InstallHandler) BuildWorkflow(
	currentState state.State,
	inputs models.UserInputs[models.BlockNodeInputs],
) (*automa.WorkflowBuilder, error)

BuildWorkflow validates install preconditions and returns the workflow. If the cluster has already been created only the block node setup step is included; otherwise the full cluster bootstrap is prepended.

func (*InstallHandler) HandleIntent

func (h *InstallHandler) HandleIntent(
	ctx context.Context,
	intent models.Intent,
	inputs models.UserInputs[models.BlockNodeInputs],
) (*automa.Report, error)

HandleIntent delegates to the shared BaseHandler which orchestrates all block-node intents.

func (*InstallHandler) PrepareEffectiveInputs

func (h *InstallHandler) PrepareEffectiveInputs(
	intent models.Intent,
	inputs models.UserInputs[models.BlockNodeInputs],
) (*models.UserInputs[models.BlockNodeInputs], error)

PrepareEffectiveInputs resolves the winning value for every block-node field. For each field the priority is: StrategyCurrent > StrategyUserInput > StrategyConfig. RequiresExplicitOverride fires when the user supplied a value but the current deployed state already owns that field and --force is set — preventing silent overwrites during a plain install.

type ResetHandler

type ResetHandler struct {
	bll.BaseHandler[models.BlockNodeInputs]
	// contains filtered or unexported fields
}

ResetHandler handles the ActionReset intent for a block node. Reset tears down and re-creates the block node in place; it requires the node to already be deployed. Effective-input resolution is a no-op (the effective values from the current state are used as-is).

func (*ResetHandler) BuildWorkflow

func (h *ResetHandler) BuildWorkflow(
	currentState state.State,
	inputs models.UserInputs[models.BlockNodeInputs],
) (*automa.WorkflowBuilder, error)

BuildWorkflow validates that the block node is deployed and returns the reset workflow.

func (*ResetHandler) HandleIntent

func (h *ResetHandler) HandleIntent(
	ctx context.Context,
	intent models.Intent,
	inputs models.UserInputs[models.BlockNodeInputs],
) (*automa.Report, error)

HandleIntent delegates to the shared BaseHandler which orchestrates all block-node intents.

func (*ResetHandler) PrepareEffectiveInputs

func (h *ResetHandler) PrepareEffectiveInputs(
	intent models.Intent,
	inputs models.UserInputs[models.BlockNodeInputs],
) (*models.UserInputs[models.BlockNodeInputs], error)

PrepareEffectiveInputs for reset simply passes inputs through unchanged. All field values are taken from the current state — no resolution is needed.

type UninstallHandler

type UninstallHandler struct {
	bll.BaseHandler[models.BlockNodeInputs]
	// contains filtered or unexported fields
}

UninstallHandler handles the ActionUninstall intent for a block node. It optionally purges persistent storage before removing the Helm release.

func (*UninstallHandler) BuildWorkflow

func (h *UninstallHandler) BuildWorkflow(
	currentState state.State,
	inputs models.UserInputs[models.BlockNodeInputs],
) (*automa.WorkflowBuilder, error)

BuildWorkflow validates that the block node is deployed (unless --force) and returns the uninstall workflow.

func (*UninstallHandler) HandleIntent

func (h *UninstallHandler) HandleIntent(
	ctx context.Context,
	intent models.Intent,
	inputs models.UserInputs[models.BlockNodeInputs],
) (*automa.Report, error)

HandleIntent delegates to the shared BaseHandler which orchestrates all block-node intents.

func (*UninstallHandler) PrepareEffectiveInputs

PrepareEffectiveInputs for uninstall passes inputs through — no field resolution is required since the goal is to remove the deployment.

type UpgradeHandler

type UpgradeHandler struct {
	bll.BaseHandler[models.BlockNodeInputs]
	// contains filtered or unexported fields
}

UpgradeHandler handles the ActionUpgrade intent for a block node. Unlike InstallHandler, it does NOT apply RequiresExplicitOverride guards — the whole point of an upgrade is to change version/chart fields. Instead it enforces chart immutability (you cannot switch charts during an upgrade) and prevents version downgrade.

func (*UpgradeHandler) BuildWorkflow

func (h *UpgradeHandler) BuildWorkflow(
	currentState state.State,
	inputs models.UserInputs[models.BlockNodeInputs],
) (*automa.WorkflowBuilder, error)

BuildWorkflow validates upgrade preconditions and returns the workflow. Preconditions:

  • Block node must already be deployed.
  • Chart repository cannot be changed during an upgrade.
  • Version cannot be downgraded.

func (*UpgradeHandler) HandleIntent

func (h *UpgradeHandler) HandleIntent(
	ctx context.Context,
	intent models.Intent,
	inputs models.UserInputs[models.BlockNodeInputs],
) (*automa.Report, error)

HandleIntent delegates to the shared BaseHandler which orchestrates all block-node intents.

func (*UpgradeHandler) PrepareEffectiveInputs

func (h *UpgradeHandler) PrepareEffectiveInputs(
	intent models.Intent,
	inputs models.UserInputs[models.BlockNodeInputs],
) (*models.UserInputs[models.BlockNodeInputs], error)

PrepareEffectiveInputs resolves fields for an upgrade. Chart immutability and semver constraints are enforced inside BuildWorkflow so that all precondition errors are reported together after resolution succeeds.

Jump to

Keyboard shortcuts

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