Help us shape the future of Go! Take the 2026 Go Developer Survey

servicecontrol

package
v0.55.8 Latest Latest
Warning

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

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

Documentation

Overview

Package servicecontrol owns the local, owner-approved desired state and bounded execution contract for StackKits-managed services.

Index

Constants

View Source
const (
	StateAPIVersion  = "stackkit.service-desired-state/v1"
	ResultAPIVersion = "stackkit.service-action-result/v1"
	LogsAPIVersion   = "stackkit.service-logs/v1"

	ActionStart   = "start"
	ActionStop    = "stop"
	ActionRestart = "restart"
	ActionLogs    = "logs"

	DesiredRunning = "running"
	DesiredStopped = "stopped"

	ReasonCriticalControlPlane = "critical_control_plane"
	ReasonPlanChanged          = "desired_state_plan_changed"
	ReasonContractChanged      = "desired_state_contract_changed"
	ReasonUnknownService       = "unknown_service"
	ReasonOwnerApproval        = "owner_approval_required"
	ReasonRuntimeUnavailable   = "service_runtime_unavailable"
)

Variables

This section is empty.

Functions

func ProjectPlanControls added in v0.50.6

func ProjectPlanControls(raw []byte) (map[string][]Control, error)

ProjectPlanControls shares the controller projection with manifests built from an independently verified canonical ResolvedPlan. It does not authorize execution.

Types

type Check

type Check struct {
	Name   string `json:"name"`
	Status string `json:"status"`
	Detail string `json:"detail,omitempty"`
}

type Control added in v0.50.6

type Control = serviceDefinition

Control is the existing canonical service control, including its module provenance.

type Controller

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

func NewOSController

func NewOSController(workspace, planPath string, plan generationartifact.VerifiedPlan) (*Controller, error)

func (*Controller) Logs

func (c *Controller) Logs(ctx context.Context, serviceKey string, tail int, cursor string) (LogsResult, error)

func (*Controller) ManagerPlanBinding added in v0.53.4

func (c *Controller) ManagerPlanBinding(state platformdeploy.HostDeployment, applyResultHash string) (platformdeploy.HostManagerPlanBinding, error)

ManagerPlanBinding narrows an independently verified current Apply to the controller's exact canonical service contract. It does not admit Apply.

func (*Controller) Mutate

func (c *Controller) Mutate(ctx context.Context, action, serviceKey string, ownerApproved bool) (Result, error)

func (*Controller) ReconcileAfterApply

func (c *Controller) ReconcileAfterApply(ctx context.Context) error

ReconcileAfterApply reapplies durable stopped intent through the declared adapter. Changes to selected services invalidate their stopped intent fail-closed. A narrower Apply leaves signed intent for unselected services untouched. Apply already holds the lifecycle mutation lock; reconciliation must not call public Mutate or recursively acquire that same cross-process lock.

type DesiredService

type DesiredService struct {
	State     string                 `json:"state"`
	ChangedAt time.Time              `json:"changedAt"`
	Binding   *DesiredServiceBinding `json:"binding,omitempty"`
}

type DesiredServiceBinding added in v0.53.1

type DesiredServiceBinding struct {
	PlanHash            string `json:"planHash"`
	ServiceContractHash string `json:"serviceContractHash"`
}

DesiredServiceBinding retains a stopped service's original signed authority when an unrelated service is controlled under a later plan.

type DesiredState

type DesiredState struct {
	APIVersion          string                                  `json:"apiVersion"`
	OwnerRef            string                                  `json:"ownerRef"`
	PlanHash            string                                  `json:"planHash"`
	ServiceContractHash string                                  `json:"serviceContractHash"`
	Revision            uint64                                  `json:"revision"`
	Services            map[string]DesiredService               `json:"services"`
	UpdatedAt           time.Time                               `json:"updatedAt"`
	Signature           localevidence.OwnerPolicyStateSignature `json:"signature"`
}

type Error

type Error struct {
	ReasonCode string
	Retryable  bool
	Message    string
}

func (*Error) Error

func (e *Error) Error() string

type LogEntry

type LogEntry struct {
	Timestamp time.Time `json:"timestamp"`
	Message   string    `json:"message"`
}

type LogsResult

type LogsResult struct {
	APIVersion  string     `json:"apiVersion"`
	ServiceKey  string     `json:"serviceKey"`
	Entries     []LogEntry `json:"entries"`
	NextCursor  string     `json:"nextCursor,omitempty"`
	Truncated   bool       `json:"truncated"`
	EvidenceRef string     `json:"evidenceRef,omitempty"`
}

type ManagerTransitionResult added in v0.53.4

type ManagerTransitionResult struct {
	APIVersion    string `json:"apiVersion"`
	OperationID   string `json:"operationId"`
	Project       string `json:"project"`
	From          string `json:"from"`
	To            string `json:"to"`
	Status        string `json:"status"`
	ExternalID    string `json:"externalId"`
	RecipeDigest  string `json:"recipeDigest"`
	RuntimeDigest string `json:"runtimeDigest"`
	EvidenceRef   string `json:"evidenceRef,omitempty"`
}

func CancelNativeKomodoCoreTransfer added in v0.53.9

func CancelNativeKomodoCoreTransfer(ctx context.Context, workspace, workload, resume string, approved bool) (ManagerTransitionResult, error)

CancelNativeKomodoCoreTransfer restores the signed source claim only while this protocol has never sent an attachment request to the target Core.

func InspectOwnedWorkloadManager added in v0.53.4

func InspectOwnedWorkloadManager(workspace, workload string) (ManagerTransitionResult, error)

InspectOwnedWorkloadManager reads the durable transfer outcome after an uncertain client response. It never repeats an API mutation.

func TransitionAppliedWorkloadManager added in v0.53.4

func TransitionAppliedWorkloadManager(ctx context.Context, workspace, workload, to, resume string, approved bool, bind func(platformdeploy.HostDeployment) (platformdeploy.HostManagerPlanBinding, error)) (ManagerTransitionResult, error)

TransitionAppliedWorkloadManager obtains fresh signed-Apply admission inside the same lifecycle lock that covers the attachment and custody mutation.

func TransitionNativeKomodoCore added in v0.53.9

func TransitionNativeKomodoCore(ctx context.Context, workspace, workload, resume string, approved bool, selectPlan func(platformdeploy.HostDeployment) (string, error)) (ManagerTransitionResult, error)

TransitionNativeKomodoCore transfers only an already custodied host recipe. Fresh generated-plan selection is verified inside the existing lifecycle lock; the subsequent normal Apply still owns all recipe and runtime effects.

func TransitionOwnedWorkloadManager added in v0.53.4

func TransitionOwnedWorkloadManager(ctx context.Context, workspace, workload, to, resume string, approved bool) (ManagerTransitionResult, error)

TransitionOwnedWorkloadManager uses the existing owner-bound node custody. It transfers API attachment, never application data or generated recipes. A retained application remains addressable even after an unrelated scoped plan became current; an unclaimed project is never implicitly adopted.

type Result

type Result struct {
	APIVersion    string  `json:"apiVersion"`
	Action        string  `json:"action"`
	ServiceKey    string  `json:"serviceKey"`
	DesiredState  string  `json:"desiredState"`
	ObservedState string  `json:"observedState"`
	Revision      uint64  `json:"revision"`
	Checks        []Check `json:"checks"`
	ReasonCode    string  `json:"reasonCode,omitempty"`
	Retryable     bool    `json:"retryable"`
	OperationRef  string  `json:"operationRef,omitempty"`
	EvidenceRef   string  `json:"evidenceRef,omitempty"`
}

Jump to

Keyboard shortcuts

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