runnerinstall

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package runnerinstall owns shared-node installation operations, independently of the runner's process and task locks.

Index

Constants

View Source
const (
	MaxRequestBytes = 4 << 10
	MaxRecordBytes  = 64 << 10
	PairingName     = "node-token"
	ServiceName     = "llm-test-runner.service"
	ProgramPath     = "/opt/llm-test-runner"
	StatePath       = "/var/lib/llm-test-runner"
	InstallPath     = "/var/lib/llm-test-runner-install"
	IdentityPath    = InstallPath + "/identity.json"
	PairingPath     = InstallPath + "/" + PairingName
)

Variables

View Source
var (
	ErrInvalid         = errors.New("invalid_installation_request")
	ErrRootRequired    = errors.New("installation_root_required")
	ErrUnsupported     = errors.New("unsupported_installation_platform")
	ErrBusy            = errors.New("installation_busy")
	ErrConflict        = errors.New("installation_operation_conflict")
	ErrUnownedPath     = errors.New("installation_path_not_owned")
	ErrPairingRequired = errors.New("node_pairing_repair_required")
	ErrUpgradeRequired = errors.New("runner_upgrade_required")
	ErrService         = errors.New("runner_service_unavailable")
	ErrIntegrity       = errors.New("installation_integrity_failed")
	ErrUninstalled     = errors.New("runner_uninstalled")
)

Functions

func ErrorCode

func ErrorCode(err error) string

func ErrorFromCode

func ErrorFromCode(code string) error

ErrorFromCode accepts only the installer's fixed public diagnostics. SSH stderr is never returned verbatim to a desktop caller or written into a report.

Types

type Identity

type Identity struct {
	Contract       int    `json:"contract"`
	NodeID         string `json:"node_id"`
	InstallationID string `json:"installation_id"`
	ListenPort     uint16 `json:"listen_port"`
	TokenSHA256    string `json:"token_sha256"`
}

func DecodeIdentity

func DecodeIdentity(document []byte) (Identity, error)

func (Identity) Validate

func (identity Identity) Validate() error

type Operation

type Operation struct {
	Request   Request   `json:"request"`
	Stage     string    `json:"stage"`
	ChangedAt time.Time `json:"changed_at"`
	ErrorCode string    `json:"error_code"`
	Result    *Result   `json:"result"`
}

func DecodeOperation

func DecodeOperation(document []byte) (Operation, error)

type Progress

type Progress struct {
	OperationID string `json:"operation_id"`
	Stage       string `json:"stage"`
}

func (Progress) Validate

func (progress Progress) Validate() error

type Request

type Request struct {
	Contract       int    `json:"contract"`
	OperationID    string `json:"operation_id"`
	ArtifactSHA256 string `json:"artifact_sha256"`
	ListenPort     uint16 `json:"listen_port"`
}

func DecodeRequest

func DecodeRequest(reader io.Reader) (Request, error)

func (Request) Validate

func (request Request) Validate() error

type Result

type Result struct {
	Contract    int                    `json:"contract"`
	OperationID string                 `json:"operation_id"`
	Runner      jobcontract.RunnerInfo `json:"runner"`
	ListenPort  uint16                 `json:"listen_port"`
	Reused      bool                   `json:"reused"`
	ObservedAt  time.Time              `json:"observed_at"`
}

func Provision

func Provision(ctx context.Context, request Request, progress func(Progress)) (Result, error)

Provision installs once or reuses the existing current-contract runner. A different artifact never upgrades an existing installation through this path.

func (Result) Validate

func (result Result) Validate() error

type UninstallManifest

type UninstallManifest struct {
	BuildIDs    []string `json:"build_ids"`
	UnitSHA256  string   `json:"unit_sha256"`
	OwnerSHA256 string   `json:"owner_sha256"`
}

UninstallManifest freezes the only program files eligible for removal. State, pairing, content, backups, accounts, and lock inodes are retained.

type UninstallOperation

type UninstallOperation struct {
	Request        UninstallRequest  `json:"request"`
	Manifest       UninstallManifest `json:"manifest"`
	Stage          string            `json:"stage"`
	PauseConfirmed bool              `json:"pause_confirmed"`
	RestoreService bool              `json:"restore_service"`
	ChangedAt      time.Time         `json:"changed_at"`
	ErrorCode      string            `json:"error_code"`
	Result         *UninstallResult  `json:"result"`
}

func DecodeUninstallOperation

func DecodeUninstallOperation(document []byte) (UninstallOperation, error)

func RecoverUninstall

func RecoverUninstall(
	ctx context.Context,
	request UninstallRequest,
	progress func(UninstallProgress),
) (UninstallOperation, error)

RecoverUninstall restores service admission only before file removal begins. Once removal starts, Uninstall is the sole continuation of that operation.

func Uninstall

func Uninstall(
	ctx context.Context,
	request UninstallRequest,
	progress func(UninstallProgress),
) (UninstallOperation, error)

Uninstall continues only the exact durable operation. It preserves all state and pairing information; completed removal blocks automatic reprovisioning.

func (UninstallOperation) Validate

func (operation UninstallOperation) Validate() error

type UninstallProgress

type UninstallProgress struct {
	OperationID string `json:"operation_id"`
	Stage       string `json:"stage"`
}

func (UninstallProgress) Validate

func (progress UninstallProgress) Validate() error

type UninstallRequest

type UninstallRequest struct {
	Contract        int    `json:"contract"`
	OperationID     string `json:"operation_id"`
	NodeID          string `json:"node_id"`
	InstallationID  string `json:"installation_id"`
	ExpectedBuildID string `json:"expected_build_id"`
}

func DecodeUninstallRequest

func DecodeUninstallRequest(reader io.Reader) (UninstallRequest, error)

func (UninstallRequest) Validate

func (request UninstallRequest) Validate() error

type UninstallResult

type UninstallResult struct {
	Contract     int       `json:"contract"`
	OperationID  string    `json:"operation_id"`
	Uninstalled  bool      `json:"uninstalled"`
	DataRetained bool      `json:"data_retained"`
	ObservedAt   time.Time `json:"observed_at"`
}

type UpgradeOperation

type UpgradeOperation struct {
	Request         UpgradeRequest `json:"request"`
	Stage           string         `json:"stage"`
	ChangedAt       time.Time      `json:"changed_at"`
	ErrorCode       string         `json:"error_code"`
	ResumeAttempted bool           `json:"resume_attempted"`
	Restorable      bool           `json:"restorable"`
	Result          *UpgradeResult `json:"result"`
}

func DecodeUpgradeOperation

func DecodeUpgradeOperation(document []byte) (UpgradeOperation, error)

func RecoverUpgrade

func RecoverUpgrade(ctx context.Context, request UpgradeRequest, progress func(UpgradeProgress)) (UpgradeOperation, error)

func RetryUpgrade

func RetryUpgrade(ctx context.Context, request UpgradeRequest, progress func(UpgradeProgress)) (UpgradeOperation, error)

func Upgrade

func Upgrade(ctx context.Context, request UpgradeRequest, progress func(UpgradeProgress)) (UpgradeOperation, error)

Upgrade creates a single durable operation. Repeating the exact request reads its journal; RetryUpgrade is the explicit instruction to continue interrupted work.

func (UpgradeOperation) Validate

func (operation UpgradeOperation) Validate() error

type UpgradeProgress

type UpgradeProgress struct {
	OperationID string `json:"operation_id"`
	Stage       string `json:"stage"`
}

func (UpgradeProgress) Validate

func (progress UpgradeProgress) Validate() error

type UpgradeRequest

type UpgradeRequest struct {
	Contract        int    `json:"contract"`
	OperationID     string `json:"operation_id"`
	NodeID          string `json:"node_id"`
	InstallationID  string `json:"installation_id"`
	ExpectedBuildID string `json:"expected_build_id"`
	ArtifactSHA256  string `json:"artifact_sha256"`
}

func DecodeUpgradeRequest

func DecodeUpgradeRequest(reader io.Reader) (UpgradeRequest, error)

func (UpgradeRequest) Validate

func (request UpgradeRequest) Validate() error

type UpgradeResult

type UpgradeResult struct {
	Contract    int                    `json:"contract"`
	OperationID string                 `json:"operation_id"`
	Runner      jobcontract.RunnerInfo `json:"runner"`
	ObservedAt  time.Time              `json:"observed_at"`
}

func (UpgradeResult) Validate

func (result UpgradeResult) Validate() error

Jump to

Keyboard shortcuts

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