apply

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package apply owns the typed request, result, error, and activator contracts plus concrete activation-strategy adapters. Package service alone owns orchestration, canonical execution order, and registry persistence.

Index

Constants

View Source
const (
	ResultSchemaID = "pasture.install.apply-result/v1"
	ErrorSchemaID  = "pasture.install.apply-error/v1"
)

ResultSchemaID and ErrorSchemaID are the frozen transient document schemas.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionRow

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

ActionRow is one ordered cell outcome.

func NewActionRow

func NewActionRow(c cell.Cell, operation Operation, status Status, management Management, observation registry.Observation, diagnostic string) ActionRow

func (ActionRow) Cell

func (r ActionRow) Cell() cell.Cell

func (ActionRow) Diagnostic

func (r ActionRow) Diagnostic() string

func (ActionRow) Management

func (r ActionRow) Management() Management

func (ActionRow) Observation

func (r ActionRow) Observation() registry.Observation

func (ActionRow) Operation

func (r ActionRow) Operation() Operation

func (ActionRow) Status

func (r ActionRow) Status() Status

type Activator

Activator is the production boundary implemented by each closed activation strategy. Inspect must be read-only. Ensure and Remove must return facts based on a live postcondition check, including when they return an action error.

type ApplyError

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

ApplyError is the transient pre-plan apply-error/v1 document.

func NewApplyError

func NewApplyError(source Source, stage, reason, where, impact, fix string, remediation Remediation) *ApplyError

func (*ApplyError) Error

func (e *ApplyError) Error() string

Error implements the error interface.

func (*ApplyError) Fix

func (e *ApplyError) Fix() string

Fix returns the actionable repair instruction.

func (*ApplyError) Impact

func (e *ApplyError) Impact() string

Impact returns what the failure means for the caller and live state.

func (*ApplyError) Location

func (e *ApplyError) Location() string

Location returns the production location that detected the failure.

func (*ApplyError) MarshalJSON

func (e *ApplyError) MarshalJSON() ([]byte, error)

MarshalJSON renders the frozen apply-error/v1 document.

func (*ApplyError) Reason

func (e *ApplyError) Reason() string

Reason returns the concrete reason the stage failed.

func (*ApplyError) Remediation

func (e *ApplyError) Remediation() Remediation

Remediation returns the closed caller action associated with the repair.

func (*ApplyError) Source

func (e *ApplyError) Source() Source

Source returns the controller associated with the failed request.

func (*ApplyError) Stage

func (e *ApplyError) Stage() string

Stage returns the operation stage that rejected the request.

type DirectFileActivator

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

DirectFileActivator is the real filesystem implementation for direct-file activation. Source controls registry ownership only; paths come exclusively from validated activation contracts.

func NewDirectFileActivator

func NewDirectFileActivator(policies ...DirectFilePolicy) (*DirectFileActivator, error)

func (*DirectFileActivator) Ensure

func (*DirectFileActivator) Inspect

func (*DirectFileActivator) Remove

func (*DirectFileActivator) StrategyKind

func (*DirectFileActivator) ValidateBindings

func (a *DirectFileActivator) ValidateBindings(bindings []activation.ComponentActivation) error

ValidateBindings proves at service construction that policy dispatch is an exact bijection with the statically bound DirectFile cells.

type DirectFileDecorationMode

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

func PassThroughDecoration

func PassThroughDecoration() DirectFileDecorationMode

func PendingNativeTrustDecoration

func PendingNativeTrustDecoration(diagnostic string) (DirectFileDecorationMode, error)

type DirectFilePolicy

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

DirectFilePolicy is one cell-bound validation and outcome-decoration policy. The constructor keeps the cell and functions coupled and rejects zero policy.

func PassThroughDirectFile

func PassThroughDirectFile(c cell.Cell) (DirectFilePolicy, error)

PassThroughDirectFile preserves the generic direct-file behavior byte for byte while still making the policy binding explicit.

func PendingNativeTrustDirectFile

func PendingNativeTrustDirectFile(c cell.Cell, validate DirectFileValidator, diagnostic string) (DirectFilePolicy, error)

func (DirectFilePolicy) Cell

func (p DirectFilePolicy) Cell() cell.Cell

type DirectFileRequest

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

DirectFileRequest is the immutable policy view of one direct-file operation. Policies receive validated typed identities rather than filesystem paths.

func (DirectFileRequest) ArtifactID

func (r DirectFileRequest) ArtifactID() artifact.BundleID

func (DirectFileRequest) Cell

func (r DirectFileRequest) Cell() cell.Cell

func (DirectFileRequest) DestinationRoot

func (r DirectFileRequest) DestinationRoot() string

func (DirectFileRequest) Key

func (r DirectFileRequest) Key() registry.Key

func (DirectFileRequest) Operation

func (r DirectFileRequest) Operation() Operation

func (DirectFileRequest) Prior

func (r DirectFileRequest) Prior() (registry.Record, bool)

func (DirectFileRequest) Source

func (r DirectFileRequest) Source() Source

func (DirectFileRequest) StrategyKind

func (r DirectFileRequest) StrategyKind() activation.StrategyKind

type DirectFileValidator

type DirectFileValidator func(DirectFileRequest) error

type Management

type Management uint8

Management identifies whose authority, if any, the row represents.

const (
	ManagementUnknown Management = iota
	ManagementPasture
	ManagementExternal
	ManagementDeclarative
)

func (Management) IsValid

func (m Management) IsValid() bool

func (Management) String

func (m Management) String() string

type Operation

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

Operation is the intended action for a cell.

func Ensure

func Ensure() Operation

func Inspect

func Inspect() Operation

func RemoveOp

func RemoveOp() Operation

func (Operation) IsValid

func (o Operation) IsValid() bool

func (Operation) String

func (o Operation) String() string

type Outcome

type Outcome struct {
	Status      Status
	Observation registry.Observation
	Record      *registry.Record
	Diagnostic  string
}

Outcome is one live-inspected activator result. Record is the strongest confirmed fact and is persisted before execution advances to another cell.

type Remediation

type Remediation uint8

Remediation is the closed caller action family carried by apply errors.

const (
	RemediationInvalid Remediation = iota
	RemediationApplyCell
	RemediationApplySelection
	RemediationRerunInstaller
	RemediationRerunHomeManager
	RemediationManualNativeTrust
	RemediationManualRepair
)

func (Remediation) String

func (r Remediation) String() string

type Result

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

Result is the transient apply-result document.

func NewResult

func NewResult(source Source, scope registry.Scope, ok bool, rows []ActionRow) Result

func (Result) MarshalJSON

func (r Result) MarshalJSON() ([]byte, error)

MarshalJSON renders the frozen apply-result/v1 document with ordered rows.

func (Result) OK

func (r Result) OK() bool

OK reports whether every executed row succeeded (no failure occurred).

func (Result) Rows

func (r Result) Rows() []ActionRow

Rows returns the ordered action rows.

func (Result) Scope

func (r Result) Scope() registry.Scope

func (Result) Source

func (r Result) Source() Source

Source returns the control source (installer or home-manager).

type Scope

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

Scope selects one logical registry table. Project scope carries one canonical root, allowing the same service to be reused by project reconciliation.

func GlobalScope

func GlobalScope() Scope

func ProjectScope

func ProjectScope(root registry.ProjectRoot) (Scope, error)

func (Scope) IsValid

func (s Scope) IsValid() bool

func (Scope) Key

func (s Scope) Key(c cell.Cell) (registry.Key, error)

Key resolves a validated cell into this scope's registry key.

func (Scope) Kind

func (s Scope) Kind() registry.Scope

func (Scope) ProjectRoot

func (s Scope) ProjectRoot() registry.ProjectRoot

type Source

type Source uint8

Source identifies the controller applying desired state.

const (
	SourceInvalid Source = iota
	SourceInstaller
	SourceHomeManager
)

func HomeManagerSource

func HomeManagerSource() Source

func InstallerSource

func InstallerSource() Source

func (Source) IsValid

func (s Source) IsValid() bool

func (Source) String

func (s Source) String() string

type Status

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

Status is a typed action-row outcome.

func Completed

func Completed() Status

Status accessors for callers and goldens.

func Failed

func Failed() Status

func InstalledPendingTrust

func InstalledPendingTrust() Status

func ManagedDeclaratively

func ManagedDeclaratively() Status

func NoOp

func NoOp() Status

func Unattempted

func Unattempted() Status

func (Status) IsValid

func (s Status) IsValid() bool

func (Status) String

func (s Status) String() string

Jump to

Keyboard shortcuts

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