releasecontrol

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	CentralVersionUnavailableCode = "central_version_unavailable"
	CentralVersionInvalidCode     = "central_version_invalid"
)
View Source
const (
	DefaultUpdaterSocketPath       = "/run/dirextalk-updater/http.sock"
	DefaultUpdaterControlTokenPath = "/etc/dirextalk-updater/control-token"
	ControlTokenHeader             = "X-Dirextalk-Control-Token"
	ControlStatusPath              = "/_dirextalk/updater/v1/control/status"
	ControlJobsPath                = "/_dirextalk/updater/v1/control/jobs"
	ControlDesiredStatePath        = "/_dirextalk/updater/v1/control/desired-state"
	ApplyConfirmation              = "apply_release_change"
)
View Source
const CentralServerVersionURL = "https://imadmin.dirextalk.ai/api/appVersion/current?appId=1&channelId=server"

Variables

This section is empty.

Functions

func CanonicalStableVersion added in v1.0.5

func CanonicalStableVersion(field, value string) (string, error)

CanonicalStableVersion rejects whitespace, prereleases, and build metadata. It is stricter than the historical client-report normalizer because central records and direct updater targets are unambiguous release identifiers.

func CompareCanonicalStableVersions added in v1.0.5

func CompareCanonicalStableVersions(left, right string) (int, error)

CompareCanonicalStableVersions compares two canonical stable SemVer values.

func NormalizeClientVersion

func NormalizeClientVersion(value string) (string, error)

Types

type ActiveJob added in v1.0.5

type ActiveJob struct {
	JobID            string `json:"job_id"`
	Status           string `json:"status"`
	CurrentVersion   string `json:"current_version,omitempty"`
	TargetVersion    string `json:"target_version,omitempty"`
	ServiceAvailable bool   `json:"service_available"`
}

ActiveJob is the public, token-free progress subset the updater returns to message-server status callers. It deliberately has no plan, image, digest, command, path, recovery point, or job bearer fields.

type ApplyRequest

type ApplyRequest struct {
	PlanToken      string `json:"plan_token"`
	IdempotencyKey string `json:"idempotency_key"`
	Confirm        string `json:"confirm"`
}

type CentralServerVersion added in v1.0.5

type CentralServerVersion struct {
	AppID       string
	ChannelID   string
	Version     string
	PreVersion  string
	UpdateNotes string
}

CentralServerVersion is the narrowly validated part of the centrally owned server release record. The message server intentionally does not use the release URL, image name, digest, or other infrastructure fields from this endpoint.

type CentralVersionError added in v1.0.5

type CentralVersionError struct {
	Code    string
	Message string
	// contains filtered or unexported fields
}

func AsCentralVersionError added in v1.0.5

func AsCentralVersionError(err error) (*CentralVersionError, bool)

func (*CentralVersionError) Error added in v1.0.5

func (e *CentralVersionError) Error() string

func (*CentralVersionError) Unwrap added in v1.0.5

func (e *CentralVersionError) Unwrap() error

type CentralVersionSource added in v1.0.5

type CentralVersionSource interface {
	CurrentServerVersion(context.Context) (CentralServerVersion, error)
}

CentralVersionSource retrieves the fixed appId=1/server release record. Its small interface lets ProductCore tests exercise compatibility gates without making network requests.

func NewCentralVersionSource added in v1.0.5

func NewCentralVersionSource(config CentralVersionSourceConfig) CentralVersionSource

NewCentralVersionSource always targets the configured Dirextalk admin endpoint. Callers cannot change this URL through ProductCore parameters.

type CentralVersionSourceConfig added in v1.0.5

type CentralVersionSourceConfig struct {
	HTTPClient *http.Client
}

type Controller

type Controller interface {
	Status(context.Context, StatusRequest) (UpdaterStatus, error)
	Apply(context.Context, ApplyRequest) (JobTicket, error)
	SetDesiredState(context.Context, DesiredState) error
}

func NewUnixController

func NewUnixController(config UnixControllerConfig) Controller

type ControllerError

type ControllerError struct {
	Status  int
	Code    string
	Message string
}

func AsControllerError

func AsControllerError(err error) (*ControllerError, bool)

func (*ControllerError) Error

func (e *ControllerError) Error() string

type DesiredState

type DesiredState string
const (
	DesiredStateRunning       DesiredState = "running"
	DesiredStateUpgrading     DesiredState = "upgrading"
	DesiredStateMaintenance   DesiredState = "maintenance"
	DesiredStateDeprovisioned DesiredState = "deprovisioned"
)

type DirectApplyRequest added in v1.0.5

type DirectApplyRequest struct {
	TargetVersion  string `json:"target_version"`
	IdempotencyKey string `json:"idempotency_key"`
	Confirm        string `json:"confirm"`
}

DirectApplyRequest is the v2 central-version upgrade command. The target is a release identifier only; callers cannot select infrastructure details.

type DirectController added in v1.0.5

type DirectController interface {
	StatusDirect(context.Context) (DirectStatus, error)
	ApplyDirect(context.Context, DirectApplyRequest) (JobTicket, error)
}

DirectController is implemented by current updaters. It is separate from Controller so legacy v1 plan-token behavior remains source compatible while v2 can fail closed when installed updater binaries have not been migrated.

type DirectStatus added in v1.0.5

type DirectStatus struct {
	Available      bool           `json:"available"`
	UpdaterReady   bool           `json:"updater_ready"`
	CurrentVersion string         `json:"current_version"`
	DesiredState   string         `json:"desired_state"`
	ActiveJob      *ActiveJob     `json:"active_job,omitempty"`
	Watchdog       WatchdogStatus `json:"watchdog"`
}

DirectStatus is the small v2 updater control response. It intentionally excludes release discovery, plans, and operations; central version lookup is performed by the message server at apply time instead.

type JobTicket

type JobTicket struct {
	JobID     string `json:"job_id"`
	JobToken  string `json:"job_token"`
	StatusURL string `json:"status_url"`
	Status    string `json:"status,omitempty"`
}

type Operation

type Operation struct {
	Kind          string `json:"kind"`
	PlanToken     string `json:"plan_token"`
	TargetVersion string `json:"target_version,omitempty"`
	ExpiresAt     string `json:"expires_at,omitempty"`
	Confirm       string `json:"confirm,omitempty"`
}

type StatusRequest

type StatusRequest struct {
	CurrentVersion             string `json:"current_version"`
	CurrentSchemaVersion       int    `json:"current_schema_version"`
	CurrentSchemaCompatVersion int    `json:"current_schema_compat_version"`
	ClientVersion              string `json:"client_version"`
}

type UnixControllerConfig

type UnixControllerConfig struct {
	SocketPath       string
	ControlTokenPath string
	Timeout          time.Duration
}

type UpdaterStatus

type UpdaterStatus struct {
	Available        bool           `json:"available"`
	ReleaseAvailable bool           `json:"release_available"`
	UpdateAvailable  bool           `json:"update_available"`
	DiscoveryStatus  string         `json:"discovery_status"`
	CheckedAt        string         `json:"checked_at,omitempty"`
	CurrentVersion   string         `json:"current_version"`
	LatestVersion    string         `json:"latest_version,omitempty"`
	ClientVersion    string         `json:"client_version,omitempty"`
	Compatibility    string         `json:"compatibility"`
	Reasons          []string       `json:"reasons"`
	ReleaseNotesURL  string         `json:"release_notes_url,omitempty"`
	Operations       []Operation    `json:"operations"`
	Watchdog         WatchdogStatus `json:"watchdog"`
}

type WatchdogStatus

type WatchdogStatus struct {
	Status         string `json:"status"`
	Degraded       bool   `json:"degraded"`
	CooldownUntil  string `json:"cooldown_until,omitempty"`
	LastObservedAt string `json:"last_observed_at,omitempty"`
	ErrorCode      string `json:"error_code,omitempty"`
}

Jump to

Keyboard shortcuts

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