Documentation
¶
Index ¶
- Constants
- func CanonicalStableVersion(field, value string) (string, error)
- func CompareCanonicalStableVersions(left, right string) (int, error)
- func NormalizeClientVersion(value string) (string, error)
- type ActiveJob
- type ApplyRequest
- type CentralServerVersion
- type CentralVersionError
- type CentralVersionSource
- type CentralVersionSourceConfig
- type Controller
- type ControllerError
- type DesiredState
- type DirectApplyRequest
- type DirectController
- type DirectStatus
- type IndexedRelease
- type JobTicket
- type Manifest
- type Operation
- type ReleaseIndex
- type StatusRequest
- type UnixControllerConfig
- type UpdaterStatus
- type UpgradeEdge
- type WatchdogStatus
Constants ¶
const ( CentralVersionInvalidCode = "central_version_invalid" )
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" )
const CentralServerVersionURL = "https://imadmin.dirextalk.ai/api/appVersion/current?appId=1&channelId=server"
const SupportedManifestVersion = 1
const SupportedReleaseIndexVersion = 1
Variables ¶
This section is empty.
Functions ¶
func CanonicalStableVersion ¶ added in v1.0.5
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
CompareCanonicalStableVersions compares two canonical stable SemVer values.
func NormalizeClientVersion ¶
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 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 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 ¶
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 IndexedRelease ¶
type Manifest ¶
type Manifest struct {
ManifestVersion int `json:"manifest_version"`
Version string `json:"version"`
Image string `json:"image"`
ImageDigest string `json:"image_digest"`
BaselineResetFromVersion string `json:"baseline_reset_from_version,omitempty"`
UpgradeFrom []string `json:"upgrade_from"`
SchemaVersion int `json:"schema_version"`
SchemaCompatVersion int `json:"schema_compat_version"`
MinimumClientVersion string `json:"minimum_client_version"`
MaximumClientVersionExclusive string `json:"maximum_client_version_exclusive"`
BackupRequired bool `json:"backup_required"`
RollbackSupported bool `json:"rollback_supported"`
RollbackMode string `json:"rollback_mode"`
ReleaseNotesURL string `json:"release_notes_url"`
}
func ValidateManifest ¶
func (Manifest) AllowsUpgradeFrom ¶
func (Manifest) SupportsClient ¶
func (Manifest) ValidateUpgradeFrom ¶
ValidateUpgradeFrom verifies one explicit source-to-target release edge. Release indexes call this for every edge instead of inferring compatibility from version ordering alone.
type ReleaseIndex ¶
type ReleaseIndex struct {
ReleaseIndexVersion int `json:"release_index_version"`
LatestVersion string `json:"latest_version"`
Releases []IndexedRelease `json:"releases"`
UpgradeEdges []UpgradeEdge `json:"upgrade_edges"`
}
func ValidateReleaseArtifacts ¶
func ValidateReleaseArtifacts(manifestData, manifestChecksum, indexData, indexChecksum []byte) (ReleaseIndex, error)
ValidateReleaseArtifacts verifies the exact bytes published as the four immutable GitHub Release assets. It intentionally does not trim input.
func ValidateReleaseIndex ¶
func ValidateReleaseIndex(data []byte) (ReleaseIndex, error)
type StatusRequest ¶
type UnixControllerConfig ¶
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"`
}