Documentation
¶
Index ¶
- Constants
- func CanonicalServerVersion(field, value string) (string, error)
- func CanonicalStableVersion(field, value string) (string, error)
- func CompareCanonicalServerVersions(left, right string) (int, error)
- func CompareCanonicalStableVersions(left, right string) (int, error)
- func NormalizeClientVersion(value string) (string, error)
- func NormalizeReleaseCatalogOrigin(origin string) (string, error)
- func ReleaseCatalogEndpoint(origin, channel string) (string, error)
- type ActiveJob
- type AgentStatus
- type ApplyRequest
- type CentralAgentVersion
- type CentralAgentVersionSource
- type CentralServerVersion
- type CentralVersionError
- type CentralVersionSource
- type CentralVersionSourceConfig
- type Controller
- type ControllerError
- type DesiredState
- type JobTicket
- type ReleaseComponent
- type Status
- type UnixControllerConfig
- 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" )
Variables ¶
This section is empty.
Functions ¶
func CanonicalServerVersion ¶ added in v1.1.3
CanonicalServerVersion accepts canonical stable and development server versions while continuing to reject whitespace and other SemVer variants.
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 that require stable versions are unambiguous release identifiers.
func CompareCanonicalServerVersions ¶ added in v1.1.3
CompareCanonicalServerVersions compares canonical server versions within the same release channel. Stable and development channels are intentionally not comparable because servers cannot upgrade across channels.
func CompareCanonicalStableVersions ¶ added in v1.0.5
CompareCanonicalStableVersions compares two canonical stable SemVer values.
func NormalizeClientVersion ¶
func NormalizeReleaseCatalogOrigin ¶ added in v1.1.6
NormalizeReleaseCatalogOrigin validates one deployment-owned HTTPS origin. ProductCore receives only sources derived from this origin and cannot supply or override request destinations.
func ReleaseCatalogEndpoint ¶ added in v1.1.6
ReleaseCatalogEndpoint derives one fixed appId=1 release channel from the validated deployment origin. Only code-owned channel names are accepted.
Types ¶
type ActiveJob ¶ added in v1.0.5
type ActiveJob struct {
JobID string `json:"job_id"`
Component string `json:"component"`
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 AgentStatus ¶ added in v1.1.3
type AgentStatus struct {
Available bool `json:"available"`
CurrentVersion string `json:"current_version,omitempty"`
Reasons []string `json:"reasons,omitempty"`
}
AgentStatus is the receipt-bound Agent runtime fact reported by the host updater. Central release discovery remains owned by message-server.
type ApplyRequest ¶
type ApplyRequest struct {
Component ReleaseComponent `json:"component"`
TargetVersion string `json:"target_version"`
MinimumServerVersion string `json:"minimum_server_version"`
IdempotencyKey string `json:"idempotency_key"`
Confirm string `json:"confirm"`
}
type CentralAgentVersion ¶ added in v1.1.3
CentralAgentVersion is the safe subset of the centrally owned Agent release record. PreVersion is the minimum compatible message-server version.
type CentralAgentVersionSource ¶ added in v1.1.3
type CentralAgentVersionSource interface {
CurrentAgentVersion(context.Context) (CentralAgentVersion, error)
}
CentralAgentVersionSource retrieves only the fixed appId=1/agents record.
func NewCentralAgentVersionSource ¶ added in v1.1.3
func NewCentralAgentVersionSource(config CentralVersionSourceConfig) CentralAgentVersionSource
NewCentralAgentVersionSource always targets the fixed Dirextalk Agent channel. Neither callers nor ProductCore parameters can change its URL.
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) (Status, 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 ReleaseComponent ¶ added in v1.1.3
type ReleaseComponent string
const ( ReleaseComponentServer ReleaseComponent = "server" ReleaseComponentAgent ReleaseComponent = "agent" )
type Status ¶ added in v1.1.3
type Status 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"`
Agent AgentStatus `json:"agent"`
}
Status is the small release.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.