Documentation
¶
Index ¶
- Constants
- Variables
- func AuthorizeEnvironmentMutation(state domain.StateFileV2, authority *domain.EnvironmentAuthority, ...) error
- func ComparableStateDigest(state domain.StateFileV2) (string, error)
- func ComputeEnvironmentReceiptID(environmentID, alias, clientID string) string
- func DropEnvironmentReceipt(state *domain.StateFileV2, authority *domain.EnvironmentAuthority)
- func UpsertEnvironmentReceipt(state *domain.StateFileV2, authority *domain.EnvironmentAuthority, ...) error
- func ValidateEnvironmentRecoveryScope(state domain.StateFileV2, authority *domain.EnvironmentAuthority) error
- type DirectoryGroup
- type DirectoryMutation
- type DirectoryRemoval
- type DirectoryRemovalGroup
- type GroupError
- type GroupFailurePhase
- type Kernel
- func (kernel Kernel) ApplyDirectory(ctx context.Context, mutation DirectoryMutation) (domain.MutationReceipt, error)
- func (kernel Kernel) ApplyDirectoryGroup(ctx context.Context, group DirectoryGroup) ([]domain.MutationReceipt, error)
- func (kernel Kernel) Load() (domain.StateFileV2, error)
- func (kernel Kernel) PersistStateDecision(before, desired domain.StateFileV2) error
- func (kernel Kernel) PersistStateDecisionWithDisposition(before, desired domain.StateFileV2) (domain.StateDecisionDisposition, error)
- func (kernel Kernel) PrevalidateRecovery(ctx context.Context) error
- func (kernel Kernel) Recover(ctx context.Context) error
- func (kernel Kernel) RemoveDirectory(ctx context.Context, removal DirectoryRemoval) (domain.MutationReceipt, error)
- func (kernel Kernel) RemoveDirectoryGroup(ctx context.Context, group DirectoryRemovalGroup) ([]domain.MutationReceipt, error)
- type ProjectRootPublisher
- type StateStore
Constants ¶
const ( ReceiptPhaseStateCommitted = "state_committed" ReceiptPhaseCommitted = "committed" )
Variables ¶
var ErrEnvironmentAuthority = errors.New("environment owner authority is invalid or missing")
Functions ¶
func AuthorizeEnvironmentMutation ¶
func AuthorizeEnvironmentMutation(state domain.StateFileV2, authority *domain.EnvironmentAuthority, action, installationID, bindingID, sourceKey string, allowCreate bool) error
AuthorizeEnvironmentMutation is the common ownership guard used by SDK and legacy CLI lifecycle paths before any managed effect. It never adopts an unmanaged binding and requires authority whenever the selected binding is environment-owned.
func ComparableStateDigest ¶
func ComparableStateDigest(state domain.StateFileV2) (string, error)
ComparableStateDigest uses the persisted comparison used by durable state decisions without normalizing lifecycle values or receipt content.
func DropEnvironmentReceipt ¶
func DropEnvironmentReceipt(state *domain.StateFileV2, authority *domain.EnvironmentAuthority)
func UpsertEnvironmentReceipt ¶
func UpsertEnvironmentReceipt(state *domain.StateFileV2, authority *domain.EnvironmentAuthority, installationID, bindingID, sourceKey, packageDigest string, profile *domain.ProfileAuthority, phase string) error
func ValidateEnvironmentRecoveryScope ¶
func ValidateEnvironmentRecoveryScope(state domain.StateFileV2, authority *domain.EnvironmentAuthority) error
ValidateEnvironmentRecoveryScope refuses a mixed owned/foreign or indeterminate recovery before Kernel.Recover can change any journal, receipt or native intent. One typed owner must cover the complete pending scope.
Types ¶
type DirectoryGroup ¶
type DirectoryGroup struct {
OperationGroupID string
Mutations []DirectoryMutation
DesiredState domain.StateFileV2
// PostApplyVerify runs once every mutation in the group has been applied and
// individually verified, and before the group's state commit decision. It
// exists for verification that depends on the whole group's restored
// filesystem state at once (for example, a native client registry that must
// observe every reconstructed path together before any single one can be
// confirmed). A returned error rolls back every applied mutation in the
// group; no state or native side effect from this group is ever committed.
PostApplyVerify func(context.Context) error
}
DirectoryGroup is one commit decision for a fully preflighted set of physical backends. Every directory is activated and verified before state is made authoritative. A failure before that decision rolls all activated directories back in reverse order.
type DirectoryMutation ¶
type DirectoryMutation struct {
PublicationParentAuthority *domain.ProfileAuthority
// ExpectedPublication seals the original staged objects before releasing
// a descendant handle for a fresh standalone publication. It is transient;
// the directory journal retains the corresponding versioned proof.
ExpectedPublication dirswap.PreparedPublication
// Standalone retains an auxiliary directory receipt independently of the
// package binding. Only fresh publication is allowed; it never replaces a
// package or changes its materialization/native ownership.
Standalone bool
OperationID string
InstallationID string
ClientBindingID string
Sequence int
OwnedBase string
ActivePath string
StagingPath string
BeforeDigest string
AfterDigest string
NativeObjects []domain.NativeObjectOwnership
Activation domain.ActivationState
Authentication domain.AuthenticationState
Policy domain.PolicyState
Verification domain.VerificationState
// DesiredState is the fully validated state that becomes authoritative only
// after the staged directory is active and verified. Keeping it in memory
// closes the crash window that would otherwise persist "prepared" state
// before a durable directory intent exists.
DesiredState domain.StateFileV2
Verify func(context.Context, string) error
// RequireAbsent rejects this mutation, before any journal write or
// filesystem mutation, if ActivePath already exists. See dirswap.Input's
// field of the same name.
RequireAbsent bool
// VerifyBefore proves caller ownership at the active and moved backup paths.
VerifyBefore func(context.Context, string) error
EnvironmentAuthority *domain.EnvironmentAuthority
}
type DirectoryRemoval ¶
type DirectoryRemoval struct {
DataReceiptID string
ProfileOwners []domain.PhysicalProfileOwner
OperationGroupID string
OperationID string
InstallationID string
ClientBindingID string
Sequence int
OwnedBase string
ActivePath string
BeforeDigest string
// Standalone records a removal receipt at state-file level. This is used
// when the same commit decision removes the owning binding/installation.
Standalone bool
Verify func(context.Context, string) error
EnvironmentAuthority *domain.EnvironmentAuthority
}
type DirectoryRemovalGroup ¶
type DirectoryRemovalGroup struct {
OperationGroupID string
Removals []DirectoryRemoval
DesiredState domain.StateFileV2
}
type GroupError ¶
type GroupError struct {
Phase GroupFailurePhase
Err error
}
GroupError carries the kernel's durable observation of a failed operation group. Callers must not infer rollback merely from an empty receipt slice: an empty slice can also mean that the first mutation never started.
func (*GroupError) Error ¶
func (err *GroupError) Error() string
func (*GroupError) Unwrap ¶
func (err *GroupError) Unwrap() error
type GroupFailurePhase ¶
type GroupFailurePhase string
const ( GroupFailureUnchanged GroupFailurePhase = "managed_unchanged" GroupFailureRolledBack GroupFailurePhase = "managed_rolled_back" GroupFailureUnknown GroupFailurePhase = "managed_commit_unknown" GroupFailureCommitted GroupFailurePhase = "managed_committed" )
func FailurePhase ¶
func FailurePhase(err error) GroupFailurePhase
type Kernel ¶
type Kernel struct {
Namespace string
PhysicalAuthority ports.PhysicalProfileAuthority
NativeRecovery ports.NativeTransitionRecovery
StateStore StateStore
Directory dirswap.Manager
}
func (Kernel) ApplyDirectory ¶
func (kernel Kernel) ApplyDirectory(ctx context.Context, mutation DirectoryMutation) (domain.MutationReceipt, error)
func (Kernel) ApplyDirectoryGroup ¶
func (kernel Kernel) ApplyDirectoryGroup(ctx context.Context, group DirectoryGroup) ([]domain.MutationReceipt, error)
func (Kernel) Load ¶
func (kernel Kernel) Load() (domain.StateFileV2, error)
Load implements the small state authority consumed by native recovery.
func (Kernel) PersistStateDecision ¶
func (kernel Kernel) PersistStateDecision(before, desired domain.StateFileV2) error
PersistStateDecision gives lifecycle state writes the same visibility and durability handling as directory commit decisions.
func (Kernel) PersistStateDecisionWithDisposition ¶
func (kernel Kernel) PersistStateDecisionWithDisposition(before, desired domain.StateFileV2) (domain.StateDecisionDisposition, error)
Only exact old visibility authorizes native restoration. Desired visibility with unresolved durability deliberately remains Unknown.
func (Kernel) PrevalidateRecovery ¶
PrevalidateRecovery is inert and covers the entire pending durability decision.
func (Kernel) RemoveDirectory ¶
func (kernel Kernel) RemoveDirectory(ctx context.Context, removal DirectoryRemoval) (domain.MutationReceipt, error)
func (Kernel) RemoveDirectoryGroup ¶
func (kernel Kernel) RemoveDirectoryGroup(ctx context.Context, group DirectoryRemovalGroup) ([]domain.MutationReceipt, error)
type ProjectRootPublisher ¶
type ProjectRootPublisher struct{ Kernel Kernel }
ProjectRootPublisher uses the installation's existing kernel and namespace. A committed standalone receipt owns the root after any one binding is removed. It grants no authority to replace or delete the runtime's mutable contents.
func (ProjectRootPublisher) PublishProjectRoot ¶
func (publisher ProjectRootPublisher) PublishProjectRoot(ctx context.Context, request domain.ActivationRequest, spec ports.NativeProjectRoot) (resultErr error)
func (ProjectRootPublisher) VerifyProjectRoot ¶
func (publisher ProjectRootPublisher) VerifyProjectRoot(ctx context.Context, root string, marker domain.NativeObjectOwnership) error
type StateStore ¶
type StateStore interface {
Load() (domain.StateFileV2, error)
Save(domain.StateFileV2) error
}