servicecontrol

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 27 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

This section is empty.

Types

type Check

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

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) 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. Any plan or service-contract change invalidates the state fail-closed.

type DesiredService

type DesiredService struct {
	State     string    `json:"state"`
	ChangedAt time.Time `json:"changedAt"`
}

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 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