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

updateengine

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateStaged      State = "staged"
	StateTrial       State = "trial"
	StateCommitted   State = "committed"
	StateRollingBack State = "rolling_back"
	StateRolledBack  State = "rolled_back"
	StateFailed      State = "failed"

	PhaseStage    Phase = "stage"
	PhaseVerify   Phase = "verify"
	PhaseActivate Phase = "activate"
	PhaseHealth   Phase = "health"
	PhaseCommit   Phase = "commit"
	PhaseRollback Phase = "rollback"
)
View Source
const (
	StableCoreShimName    = "agentdock.exe"
	StableTrayShimName    = "agentdock-tray.exe"
	GenerationCoreName    = "agentdock-core.exe"
	GenerationTrayName    = "agentdock-tray.exe"
	GenerationArbiterName = "agentdock-arbiter.exe"
)
View Source
const SchemaVersion = 1

Variables

This section is empty.

Functions

func NewTransactionID

func NewTransactionID() (string, error)

func NormalizeVersion

func NormalizeVersion(value string) string

func ValidateVersion

func ValidateVersion(value string) error

ValidateVersion keeps version strings safe as a single generation-directory name on all supported platforms. NormalizeVersion intentionally remains comparison-only; callers that persist or join a version into a path must validate it.

func WaitForVersion

func WaitForVersion(ctx context.Context, endpoints []string, targetVersion string, timeout time.Duration) error

Types

type ActiveVersion

type ActiveVersion struct {
	SchemaVersion   int       `json:"schema_version"`
	ActiveVersion   string    `json:"active_version"`
	FallbackVersion string    `json:"fallback_version,omitempty"`
	State           State     `json:"state"`
	TransactionID   string    `json:"transaction_id,omitempty"`
	UpdatedAt       time.Time `json:"updated_at"`
}

func (ActiveVersion) Validate

func (active ActiveVersion) Validate() error

type Arbiter

type Arbiter struct {
	Store  *Store
	Driver Driver
}

func (Arbiter) Run

func (arbiter Arbiter) Run(ctx context.Context, transactionID string) (Result, error)

type Driver

type Driver interface {
	PrepareTrial(context.Context, Transaction) error
	VerifyTrial(context.Context, Transaction) ([]string, error)
	Commit(context.Context, Transaction) error
	Rollback(context.Context, Transaction) error
}

type Failure

type Failure struct {
	Code    string    `json:"code"`
	Message string    `json:"message"`
	At      time.Time `json:"at"`
}

type HealthResponse

type HealthResponse struct {
	OK      bool   `json:"ok"`
	Version string `json:"version"`
}

type MacOSPlan

type MacOSPlan struct {
	SourceArbiterPath  string `json:"source_arbiter_path,omitempty"`
	TargetAppPath      string `json:"target_app_path"`
	TrialAppPath       string `json:"trial_app_path"`
	HandoffPath        string `json:"handoff_path,omitempty"`
	ResultPath         string `json:"result_path,omitempty"`
	ServiceStatePath   string `json:"service_state_path,omitempty"`
	HealthURL          string `json:"health_url,omitempty"`
	AppWasRunning      bool   `json:"app_was_running,omitempty"`
	CoreWasEnabled     bool   `json:"core_was_enabled,omitempty"`
	TunnelEnabled      bool   `json:"tunnel_enabled,omitempty"`
	BootstrapMigration bool   `json:"bootstrap_migration,omitempty"`
}

type Phase

type Phase string

type Result

type Result struct {
	SchemaVersion   int       `json:"schema_version"`
	TransactionID   string    `json:"transaction_id"`
	Platform        string    `json:"platform"`
	SourceVersion   string    `json:"source_version"`
	TargetVersion   string    `json:"target_version"`
	ActiveVersion   string    `json:"active_version,omitempty"`
	FallbackVersion string    `json:"fallback_version,omitempty"`
	State           State     `json:"state"`
	CompletedAt     time.Time `json:"completed_at"`
	Failure         *Failure  `json:"failure,omitempty"`
	Warnings        []string  `json:"warnings,omitempty"`
}

func (Result) Validate

func (result Result) Validate() error

type State

type State string

type Store

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

func NewStore

func NewStore(root string) (*Store, error)

func (*Store) ActivePath

func (store *Store) ActivePath() string

func (*Store) Complete

func (store *Store) Complete(transaction Transaction, state State, failure *Failure, warnings []string) (Result, error)

func (*Store) CurrentResultPath

func (store *Store) CurrentResultPath() string

func (*Store) ReadActive

func (store *Store) ReadActive() (ActiveVersion, error)

func (*Store) ReadResult

func (store *Store) ReadResult(transactionID string) (Result, error)

func (*Store) ReadTransaction

func (store *Store) ReadTransaction() (Transaction, error)

func (*Store) ResultPath

func (store *Store) ResultPath(transactionID string) string

func (*Store) Root

func (store *Store) Root() string

func (*Store) TransactionPath

func (store *Store) TransactionPath() string

func (*Store) WriteActive

func (store *Store) WriteActive(active ActiveVersion) error

func (*Store) WriteResult

func (store *Store) WriteResult(result Result) error

func (*Store) WriteTransaction

func (store *Store) WriteTransaction(transaction Transaction) error

type Transaction

type Transaction struct {
	SchemaVersion   int          `json:"schema_version"`
	TransactionID   string       `json:"transaction_id"`
	Platform        string       `json:"platform"`
	SourceVersion   string       `json:"source_version"`
	TargetVersion   string       `json:"target_version"`
	ActiveVersion   string       `json:"active_version,omitempty"`
	FallbackVersion string       `json:"fallback_version,omitempty"`
	State           State        `json:"state"`
	Phase           Phase        `json:"phase"`
	StartedAt       time.Time    `json:"started_at"`
	UpdatedAt       time.Time    `json:"updated_at"`
	CompletedAt     *time.Time   `json:"completed_at,omitempty"`
	Failure         *Failure     `json:"failure,omitempty"`
	Warnings        []string     `json:"warnings,omitempty"`
	Windows         *WindowsPlan `json:"windows,omitempty"`
	MacOS           *MacOSPlan   `json:"macos,omitempty"`
}

func NewTransaction

func NewTransaction(platform, sourceVersion, targetVersion string) (Transaction, error)

func (Transaction) Validate

func (transaction Transaction) Validate() error

type WindowsLayout

type WindowsLayout struct {
	Root string
}

func NewWindowsLayout

func NewWindowsLayout(root string) (WindowsLayout, error)

func (WindowsLayout) BinDir

func (layout WindowsLayout) BinDir() string

func (WindowsLayout) CoreShim

func (layout WindowsLayout) CoreShim() string

func (WindowsLayout) EnsureBase

func (layout WindowsLayout) EnsureBase() error

func (WindowsLayout) GenerationArbiter

func (layout WindowsLayout) GenerationArbiter(version string) string

func (WindowsLayout) GenerationCore

func (layout WindowsLayout) GenerationCore(version string) string

func (WindowsLayout) GenerationDir

func (layout WindowsLayout) GenerationDir(version string) string

func (WindowsLayout) GenerationSkills

func (layout WindowsLayout) GenerationSkills(version string) string

func (WindowsLayout) GenerationTray

func (layout WindowsLayout) GenerationTray(version string) string

func (WindowsLayout) IsGenerationBinary

func (layout WindowsLayout) IsGenerationBinary(path string) bool

func (WindowsLayout) TrayShim

func (layout WindowsLayout) TrayShim() string

func (WindowsLayout) VersionsDir

func (layout WindowsLayout) VersionsDir() string

type WindowsPlan

type WindowsPlan struct {
	InstallRoot        string   `json:"install_root"`
	SourceGeneration   string   `json:"source_generation"`
	TargetGeneration   string   `json:"target_generation"`
	HealthURLs         []string `json:"health_urls,omitempty"`
	TaskName           string   `json:"task_name,omitempty"`
	PrivilegeMode      string   `json:"privilege_mode,omitempty"`
	CoreWasRunning     bool     `json:"core_was_running,omitempty"`
	TrayWasRunning     bool     `json:"tray_was_running,omitempty"`
	TunnelWasRunning   bool     `json:"tunnel_was_running,omitempty"`
	ProgressUIHandoff  bool     `json:"progress_ui_handoff,omitempty"`
	BootstrapMigration bool     `json:"bootstrap_migration,omitempty"`
}

Jump to

Keyboard shortcuts

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