state

package
v0.19.930 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const InstallMetadataStateGenV2Key = "x-nuon-feature-state-v2"

InstallMetadataStateGenV2Key is the install metadata key that can disable state-gen-v2 for a specific install even when the org-level feature flag is enabled. Set to "false" to opt out: metadata["x-nuon-feature-state-v2"] = "false"

Variables

AllPartials is the ordered list of all state partials.

HintToPartials maps a hint type to the partials it affects.

Functions

func UseStateGenV2

func UseStateGenV2(orgFeatureEnabled bool, installMetadata pgtype.Hstore) bool

UseStateGenV2 returns whether v2 state generation should be used for a given install. org-level feature flag is the default; install metadata can override it to false.

Types

type ExecuteRegenerationRequest

type ExecuteRegenerationRequest struct {
	InstallID       string
	TriggeredByID   string
	TriggeredByType string

	Targets        []PartialTarget
	ForceAll       bool
	CachedState    *pkgstate.State
	LastModifiedAt map[PartialName]time.Time

	// MetricsWriter is optional — when set, Regenerate emits timing and count metrics.
	MetricsWriter metrics.Writer
}

type ExecuteRegenerationResponse

type ExecuteRegenerationResponse struct {
	State           *pkgstate.State
	UpdatedPartials []PartialName
	LastModifiedAt  map[PartialName]time.Time
	GeneratedAt     time.Time
	AppID           string
	AppName         string
	AppConfigID     string
}

type HintType

type HintType string

HintType describes what changed, allowing callers to build a []PartialTarget via TargetsForHint.

const (
	HintDeployCompleted      HintType = "deploy-completed"
	HintComponentTeardown    HintType = "component-teardown"
	HintSandboxProvisioned   HintType = "sandbox-provisioned"
	HintSandboxDeprovisioned HintType = "sandbox-deprovisioned"
	HintSandboxReprovisioned HintType = "sandbox-reprovisioned"
	HintActionRan            HintType = "action-ran"
	HintStackRunCompleted    HintType = "stack-run-completed"
	HintStackOutputsUpdated  HintType = "stack-outputs-updated"
	HintInputsUpdated        HintType = "inputs-updated"
	HintSecretsUpdated       HintType = "secrets-updated"
	HintRunnerUpdated        HintType = "runner-updated"
	HintAppConfigUpdated     HintType = "app-config-updated"
	HintInstallCreated       HintType = "install-created"
)

type PartialName

type PartialName string

PartialName identifies a component of install state that can be independently regenerated.

const (
	PartialOrg        PartialName = "org"
	PartialApp        PartialName = "app"
	PartialDomain     PartialName = "domain"
	PartialRunner     PartialName = "runner"
	PartialCloud      PartialName = "cloud"
	PartialActions    PartialName = "actions"
	PartialInputs     PartialName = "inputs"
	PartialComponents PartialName = "components"
	PartialSandbox    PartialName = "sandbox"
	PartialStack      PartialName = "stack"
	PartialSecrets    PartialName = "secrets"
)

type PartialTarget

type PartialTarget struct {
	Name     PartialName
	EntityID string
}

PartialTarget identifies a specific partial and optionally a single entity within it. EntityID scopes the update to one entity (e.g. an install_component_id for PartialComponents, or an install_action_workflow_id for PartialActions). Empty EntityID means refresh the whole partial.

func AllPartialTargets

func AllPartialTargets() []PartialTarget

func TargetsForHint

func TargetsForHint(hintType HintType, entityID string) []PartialTarget

TargetsForHint converts a HintType + optional entityID into a []PartialTarget. Use this when callers know the specific entity that changed (e.g. a component ID after deploy).

Jump to

Keyboard shortcuts

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