applicationrelease

package
v0.57.11 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package applicationrelease holds the owner-signed record of one scoped application release change: the retained copy of the application's prior data, the prior intent, and the release transition it authorizes.

A forward change stops only the selected application, copies each of its governed volumes into an operation-bound retained volume, reads the copy back as a file-tree digest and then selects the target release in the StackSpec; normal generate and Apply run the change. A rollback stops the application again, copies the retained data back, proves the live tree equals the checkpoint digest and restores the prior intent; the next Apply may then start the earlier release on exactly that data. While a record is open, Apply starts only the release it expects; without one, Apply refuses every move to an earlier release.

Index

Constants

View Source
const APIVersion = "stackkit.application-release/v1"
View Source
const Directory = ".stackkit/applications/releases"

Directory holds one owner-signed record per scoped release operation.

Variables

This section is empty.

Functions

func CanAdvance

func CanAdvance(from, next State) bool

CanAdvance reports whether a record in state from may move to next.

func RemoveRetainedRuntimeFiles

func RemoveRetainedRuntimeFiles(workspace string, record Record) error

RemoveRetainedRuntimeFiles removes the operation-bound copies.

func RestoreRuntimeFiles

func RestoreRuntimeFiles(workspace string, record Record) error

RestoreRuntimeFiles verifies every retained copy, then writes each back over its live file and reads it back.

func RetainRuntimeFiles

func RetainRuntimeFiles(workspace string, record Record) error

RetainRuntimeFiles copies every live runtime file of the record into its operation-bound private copy. A copy already read back is kept; a live file that no longer has its checkpoint digest refuses, since nothing may change it while the checkpoint is open.

func ValidOperationID

func ValidOperationID(id string) bool

ValidOperationID reports whether id is a scoped release operation identity.

func VerifyRetainedRuntimeFiles

func VerifyRetainedRuntimeFiles(workspace string, record Record) error

VerifyRetainedRuntimeFiles reports whether every retained copy of the record still has its checkpoint digest. It writes nothing, so a rollback checks it before any destructive volume restore.

func VerifyRuntimeFilesAtCheckpoint

func VerifyRuntimeFilesAtCheckpoint(workspace string, record Record) error

VerifyRuntimeFilesAtCheckpoint reports whether every live runtime file of the record still has its checkpoint digest.

Types

type Image

type Image struct {
	Ref    string `json:"ref"`
	Digest string `json:"digest"`
}

type ManagedAuthority

type ManagedAuthority struct {
	CapabilityID     string `json:"capabilityId"`
	CapabilitySHA256 string `json:"capabilitySha256"`
	IssuerID         string `json:"issuerId"`
	KeyID            string `json:"keyId"`
}

ManagedAuthority is the Techstack authority of a release change on a managed node: the exact application-release.update capability the node verified against its Owner-approved trust before it stopped the application. A standalone record carries none.

type Readback

type Readback struct {
	Files  int64  `json:"files"`
	Bytes  int64  `json:"bytes"`
	Digest string `json:"digest"`
}

type Record

type Record struct {
	APIVersion     string `json:"apiVersion"`
	OperationID    string `json:"operationId"`
	State          State  `json:"state"`
	UseCaseRef     string `json:"useCaseRef"`
	WorkloadRef    string `json:"workloadRef"`
	ModuleRef      string `json:"moduleRef"`
	NodeRef        string `json:"nodeRef"`
	ComposeProject string `json:"composeProject"`
	EntryComponent string `json:"entryComponent"`
	PriorRelease   string `json:"priorRelease"`
	PriorImage     Image  `json:"priorImage"`
	TargetRelease  string `json:"targetRelease"`
	TargetImage    Image  `json:"targetImage"`
	// TargetUntested marks a target outside the catalog's tested releases,
	// accepted explicitly by the owner.
	TargetUntested bool `json:"targetUntested,omitempty"`
	// Managed is set when Techstack manages the node; the intent change was
	// admitted by that capability, and resume and rollback stay bound to it.
	Managed        *ManagedAuthority `json:"managed,omitempty"`
	PriorSpecHash  string            `json:"priorSpecHash"`
	TargetSpecHash string            `json:"targetSpecHash"`
	// PriorSpec and TargetSpec are the exact canonical StackSpec bytes.
	PriorSpec        []byte   `json:"priorSpec"`
	TargetSpec       []byte   `json:"targetSpec"`
	PlanHash         string   `json:"planHash"`
	KopiaHelperImage string   `json:"kopiaHelperImage"`
	Volumes          []Volume `json:"volumes"`
	// RuntimeFiles are the private runtime files of a native installation
	// (the Marketplace) retained beside its volumes and restored with them.
	RuntimeFiles []RuntimeFile `json:"runtimeFiles,omitempty"`
	CreatedAt    time.Time     `json:"createdAt"`
	UpdatedAt    time.Time     `json:"updatedAt"`

	Signature localevidence.OwnerApplicationReleaseSignature `json:"signature"`
}

func List

func List(workspace string) ([]Record, error)

List returns every verified record, oldest first.

func OpenFor

func OpenFor(workspace, workload string) (Record, bool, error)

OpenFor returns the one record that still governs a workload.

func Persist

func Persist(workspace string, record Record) (Record, error)

Persist signs and atomically replaces the record of its operation. A new record must start at StateCheckpointStarted; an existing one may move only along the declared transitions.

func Read

func Read(workspace, operation string) (Record, error)

Read returns the verified record of one operation.

func (Record) Open

func (record Record) Open() bool

Open reports whether the record still governs its application: retained data exists or a transition is incomplete.

type RuntimeFile

type RuntimeFile struct {
	// Path is relative to the workspace root.
	Path string `json:"path"`
	// SHA256 is the lowercase hex digest of the checkpointed bytes.
	SHA256 string `json:"sha256"`
}

RuntimeFile is one private runtime file of a native installation that a release checkpoint retains beside the application's volumes. For the Marketplace these are its Compose recipe, its environment (APP_KEY and database credentials), its custody (API token, server identity) and its SSH key: Coolify migrates its database forward on start, so a rollback restores the database together with the custody that matches it.

func CaptureRuntimeFiles

func CaptureRuntimeFiles(workspace string, paths []string) ([]RuntimeFile, error)

CaptureRuntimeFiles reads the live private files and returns their checkpoint digests.

type State

type State string
const (
	// StateCheckpointStarted: the application may be stopped and its
	// retained copies may be incomplete; live data is unchanged.
	StateCheckpointStarted State = "checkpoint-started"
	// StateCheckpointed: retained copies are complete and read back, the
	// target release is selected, and the application stays stopped until
	// Apply starts the target release.
	StateCheckpointed State = "checkpointed"
	// StateRollbackStarted: live data may be partly restored.
	StateRollbackStarted State = "rollback-started"
	// StateRolledBack: live data equals the checkpoint, the prior intent is
	// selected, and the next Apply may start the prior release.
	StateRolledBack State = "rolled-back"
	// StateAbandoned: a checkpoint that never completed was released; the
	// prior intent and runtime stay authoritative.
	StateAbandoned State = "abandoned"
	// StateFinalized: retained copies are removed; the record is history.
	StateFinalized State = "finalized"
)

type Volume

type Volume struct {
	ComponentRef   string    `json:"componentRef"`
	LogicalName    string    `json:"logicalName"`
	ComposeProject string    `json:"composeProject"`
	LiveName       string    `json:"liveName"`
	RollbackName   string    `json:"rollbackName"`
	Checkpoint     *Readback `json:"checkpoint,omitempty"`
}

Volume is one governed live volume of the application and its retained, operation-bound copy.

Jump to

Keyboard shortcuts

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