Documentation
¶
Index ¶
- Constants
- func NewOperationID(operation Operation) (string, error)
- type Approval
- type ArtifactEvidence
- type Authority
- type CheckpointAuthority
- type Contract
- type ControlAuthority
- type Evidence
- type ExecuteInput
- type Executor
- type Member
- type Membership
- type Mutation
- type MutationAuthority
- type MutationRecord
- type Operation
- type OperationContract
- type PhaseEvidence
- type PhaseRecord
- type PhaseRequest
- type PlanBinding
- type Preparation
- type RecoveryAuthority
- type RecoveryRequest
- type Service
- type State
- type Store
- func (store Store) BeginPrepared(mutation Mutation, operationID string, ownerApproved bool, now time.Time, ...) (State, error)
- func (store Store) Load(contract Contract) (State, error)
- func (store Store) LoadForPlan(plan resolvedplan.ResolvedPlan) (Contract, State, error)
- func (store Store) MarkRecovered(mutation Mutation, operationID string, ownerApproved bool, ...) (State, error)
- func (store Store) RecordPhase(mutation Mutation, operationID string, artifact ArtifactEvidence, ...) (State, error)
- func (store Store) RequireRecovery(mutation Mutation, operationID, diagnostic string, now time.Time) (State, error)
- func (store Store) Resume(mutation Mutation, operationID string, ownerApproved bool, now time.Time) (State, error)
Constants ¶
const ( APIVersion = "stackkit.fleet-lifecycle/v1" Kind = "FleetLifecycle" )
const ( StateAPIVersion = "stackkit.fleet-mutation-state/v1" PhaseEvidenceAPIVersion = "stackkit.fleet-mutation-evidence/v1" StatusRunning = "running" StatusRecoveryRequired = "recovery-required" StatusSucceeded = "succeeded" StatusRecovered = "recovered" )
Variables ¶
This section is empty.
Functions ¶
func NewOperationID ¶
NewOperationID returns a collision-resistant, readable local identity.
Types ¶
type ArtifactEvidence ¶
type Authority ¶
type Authority struct {
Source string `json:"source"`
PlanBinding PlanBinding `json:"planBinding"`
OwnerApprovalRequired bool `json:"ownerApprovalRequired"`
LocalCustodyRequired bool `json:"localCustodyRequired"`
ProviderLifecycleOwned bool `json:"providerLifecycleOwned"`
MultiServerOrchestrationOwned bool `json:"multiServerOrchestrationOwned"`
CredentialCustodyOwned bool `json:"credentialCustodyOwned"`
}
type CheckpointAuthority ¶
type Contract ¶
type Contract struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
StackID string `json:"stackId"`
FleetRef string `json:"fleetRef,omitempty"`
SpecHash string `json:"specHash"`
InventoryHash string `json:"inventoryHash"`
Scope string `json:"scope"`
Membership Membership `json:"membership"`
Authority Authority `json:"authority"`
Operations map[Operation]OperationContract `json:"operations"`
}
func Project ¶
func Project(plan resolvedplan.ResolvedPlan) (Contract, error)
Project returns the exact compiler-owned fleet lifecycle contract carried by one integrity-valid ResolvedPlan. Callers do not reconstruct membership, operation semantics, or authority exclusions themselves.
type ControlAuthority ¶
type ExecuteInput ¶
type ExecuteInput struct {
OperationID string
Operation Operation
CurrentPlan resolvedplan.ResolvedPlan
TargetPlan resolvedplan.ResolvedPlan
SourceMemberRef string
TargetMemberRef string
OwnerApproved bool
}
type Executor ¶
type Executor interface {
Prepare(context.Context, Mutation) (Preparation, error)
ExecutePhase(context.Context, PhaseRequest) (ArtifactEvidence, error)
Recover(context.Context, RecoveryRequest) (ArtifactEvidence, error)
}
Executor owns the finite local phase implementations. It receives no provider allocation, multi-server orchestration, or credential-custody authority from the lifecycle service.
type Membership ¶
type Membership struct {
Members []Member `json:"members"`
ControlAuthority ControlAuthority `json:"controlAuthority"`
}
type Mutation ¶
type Mutation struct {
Authority MutationAuthority
Contract OperationContract
}
Mutation is the exact compiler-owned operation bound to current and target ResolvedPlans. The operation contract is kept beside the persisted authority so runners never reconstruct phases or approval semantics.
func BindMutation ¶
func BindMutation( currentPlan, targetPlan resolvedplan.ResolvedPlan, operation Operation, sourceMemberRef, targetMemberRef string, ) (Mutation, error)
BindMutation verifies both plans and admits only the membership delta owned by the selected compiler contract.
type MutationAuthority ¶
type MutationAuthority struct {
StackID string `json:"stackId"`
FleetRef string `json:"fleetRef,omitempty"`
Operation Operation `json:"operation"`
CurrentPlanHash string `json:"currentPlanHash"`
TargetPlanHash string `json:"targetPlanHash"`
CurrentSpecHash string `json:"currentSpecHash"`
TargetSpecHash string `json:"targetSpecHash"`
CurrentInventoryHash string `json:"currentInventoryHash"`
TargetInventoryHash string `json:"targetInventoryHash"`
SourceMemberRef string `json:"sourceMemberRef,omitempty"`
TargetMemberRef string `json:"targetMemberRef,omitempty"`
ContractDigest string `json:"contractDigest"`
}
MutationAuthority is the immutable authority carried by every durable fleet mutation record and phase-evidence document.
type MutationRecord ¶
type MutationRecord struct {
ID string `json:"id"`
Authority MutationAuthority `json:"authority"`
OwnerRef string `json:"ownerRef"`
Status string `json:"status"`
CurrentPhase string `json:"currentPhase"`
Attempt uint64 `json:"attempt"`
Checkpoint CheckpointAuthority `json:"checkpoint"`
Recovery RecoveryAuthority `json:"recovery"`
Phases []PhaseRecord `json:"phases"`
RecoveryEvidence *PhaseRecord `json:"recoveryEvidence,omitempty"`
LastError string `json:"lastError,omitempty"`
StartedAt time.Time `json:"startedAt"`
UpdatedAt time.Time `json:"updatedAt"`
CompletedAt time.Time `json:"completedAt,omitempty"`
PreviousDigest string `json:"previousDigest,omitempty"`
Digest string `json:"digest"`
}
type OperationContract ¶
type OperationContract struct {
Name Operation `json:"name"`
SourceMember string `json:"sourceMember"`
TargetMember string `json:"targetMember"`
TargetPlanRequired bool `json:"targetPlanRequired"`
TargetPlanMustDiffer bool `json:"targetPlanMustDiffer"`
Mutation bool `json:"mutation"`
Destructive bool `json:"destructive"`
OwnerApproval Approval `json:"ownerApproval"`
CheckpointRequired bool `json:"checkpointRequired"`
RecoveryRequired bool `json:"recoveryRequired"`
Phases []string `json:"phases"`
Evidence Evidence `json:"evidence"`
}
type PhaseEvidence ¶
type PhaseEvidence struct {
APIVersion string `json:"apiVersion"`
OperationID string `json:"operationId"`
Sequence uint64 `json:"sequence"`
Phase string `json:"phase"`
Status string `json:"status"`
Authority MutationAuthority `json:"authority"`
Checkpoint CheckpointAuthority `json:"checkpoint"`
Recovery RecoveryAuthority `json:"recovery"`
Artifact ArtifactEvidence `json:"artifact"`
PreviousEvidenceDigest string `json:"previousEvidenceDigest,omitempty"`
RecordedAt time.Time `json:"recordedAt"`
Signature localevidence.OwnerLifecycleMutationSignature `json:"signature"`
}
PhaseEvidence is an immutable, Owner-signed result for one compiler-owned fleet phase. The full document is stored under its content digest.
type PhaseRecord ¶
type PhaseRequest ¶
type PhaseRequest struct {
OperationID string
Attempt uint64
Phase string
Authority MutationAuthority
Checkpoint CheckpointAuthority
Recovery RecoveryAuthority
Completed []PhaseRecord
}
type PlanBinding ¶
type PlanBinding struct {
CurrentHashField string `json:"currentHashField"`
TargetHashField string `json:"targetHashField"`
StackIdentityField string `json:"stackIdentityField"`
FleetIdentityField string `json:"fleetIdentityField"`
SpecIdentityField string `json:"specIdentityField"`
InventoryField string `json:"inventoryField"`
}
type Preparation ¶
type Preparation struct {
Checkpoint ArtifactEvidence
RecoveryRef string
}
type RecoveryAuthority ¶
type RecoveryRequest ¶
type RecoveryRequest struct {
OperationID string
Attempt uint64
FailedPhase string
LastError string
Authority MutationAuthority
Checkpoint CheckpointAuthority
Recovery RecoveryAuthority
Completed []PhaseRecord
}
type Service ¶
func (Service) Execute ¶
Execute starts and completes one mutation through the exact compiler phase sequence. On any post-Begin failure the durable state is moved to recovery-required before the error is returned.
type State ¶
type State struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
WorkspaceHash string `json:"workspaceHash"`
StackID string `json:"stackId"`
FleetRef string `json:"fleetRef,omitempty"`
OwnerRef string `json:"ownerRef,omitempty"`
CurrentPlanHash string `json:"currentPlanHash,omitempty"`
CurrentOperation string `json:"currentOperation,omitempty"`
Operations []MutationRecord `json:"operations"`
UpdatedAt time.Time `json:"updatedAt,omitempty"`
StateDigest string `json:"stateDigest,omitempty"`
Signature localevidence.OwnerLifecycleMutationSignature `json:"signature,omitempty"`
}
State is the one local fleet lifecycle projection consumed unchanged by the CLI, MCP status tool, and State Console.
type Store ¶
type Store struct {
Workspace string
}
func (Store) BeginPrepared ¶
func (store Store) BeginPrepared( mutation Mutation, operationID string, ownerApproved bool, now time.Time, prepare func() (Preparation, error), ) (State, error)
BeginPrepared holds the fleet state lock while the caller establishes the exact checkpoint and recovery authority, then persists the first signed record before any mutation phase can run.
func (Store) Load ¶
Load verifies the complete signed state and every referenced immutable phase document. A missing state is represented as an empty projection.
func (Store) LoadForPlan ¶
func (store Store) LoadForPlan(plan resolvedplan.ResolvedPlan) (Contract, State, error)
LoadForPlan projects and verifies fleet state from the same canonical plan used by the runtime status surface.
func (Store) MarkRecovered ¶
func (Store) RecordPhase ¶
func (store Store) RecordPhase( mutation Mutation, operationID string, artifact ArtifactEvidence, now time.Time, ) (State, error)
RecordPhase commits one successful phase as immutable Owner evidence. The next phase is always selected from the compiler contract, never by a caller.