stateutil

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package stateutil provides shared utilities for fetching and working with blueprint instance state across TUI components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DescribeEngineState added in v0.10.0

func DescribeEngineState(engineConfig *stateio.EngineConfig) string

DescribeEngineState describes the state an import or export works on, such as "memfile state in /path", or "state" when there is no engine config to describe.

func FetchInstanceState

func FetchInstanceState(ctx context.Context, eng engine.DeployEngine, instanceID, instanceName string) *state.InstanceState

FetchInstanceState attempts to fetch the instance state for an existing deployment. Returns nil if the instance doesn't exist or if there's an error (new deployment case).

func FindChildInstanceState

func FindChildInstanceState(instanceState *state.InstanceState, childName string) *state.InstanceState

FindChildInstanceState finds the instance state for a child blueprint by name.

func FindLinkState

func FindLinkState(instanceState *state.InstanceState, name string) *state.LinkState

FindLinkState finds a link state by logical name.

func FindResourceState

func FindResourceState(instanceState *state.InstanceState, name string) *state.ResourceState

FindResourceState finds a resource state by logical name. It uses the instance state's ResourceIDs map to look up the resource ID, then retrieves the state from Resources.

func FormatFailureText added in v0.10.0

func FormatFailureText(heading string, details []LabelledValue, err error) string

FormatFailureText formats an import or export failure as plain text for headless output: the heading and error summary on the first line, then the given details, the cause and the hint, each indented under it.

func RenderFailure added in v0.10.0

func RenderFailure(
	styles *stylespkg.Styles,
	heading string,
	details []LabelledValue,
	err error,
	width int,
) string

RenderFailure renders an import or export failure for a TUI: the heading, the given details followed by the error and its cause as aligned labelled lines, and the hint on what to do. Every line is wrapped to fit within width.

func RenderProgress added in v0.10.0

func RenderProgress(spinnerView string, status string, width int) string

RenderProgress renders the status line shown while an import or export runs: the spinner followed by the status, wrapped to fit within width.

Types

type LabelledValue added in v0.10.0

type LabelledValue struct {
	Label string
	Value string
}

LabelledValue is one line of a failure view, such as the state or file an import or export was working on.

Jump to

Keyboard shortcuts

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