Documentation
¶
Overview ¶
Package startup owns local launch coordination and bounded, credential-free startup diagnostics. It does not depend on the datastore, HTTP API or motion.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrRunning = errors.New("MagicHandy is already starting or running for this data directory")
ErrRunning means another process holds this profile's operating-system lock.
Functions ¶
func SavePortHint ¶
SavePortHint never changes the configured preferred address.
Types ¶
type Attempt ¶
type Attempt struct {
Listener string `json:"listener"`
Port int `json:"port"`
ErrorCode string `json:"error_code,omitempty"`
NativeCode int `json:"native_code,omitempty"`
}
Attempt describes a bind without retaining an address, path, raw error or key.
type Existing ¶
type Existing struct {
PID int `json:"pid"`
ID string `json:"instance_id"`
URL string `json:"url"`
RemoteURL string `json:"remote_url,omitempty"`
PreferredURL string `json:"preferred_url,omitempty"`
PreferredRemoteURL string `json:"preferred_remote_url,omitempty"`
}
Existing is the public, verified part of a running instance record.
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance holds the profile lock until all application workers have stopped. The lock file is never unlinked: replacing it could allow two lock owners.
func (*Instance) Close ¶
func (i *Instance) Close()
Close removes readiness before releasing the profile lock. Call after teardown.
func (*Instance) Handler ¶
Handler proves the local process's identity without exposing the private token to a potentially unrelated service occupying a stale endpoint. The deliberately public response contains no account, settings or device state.
func (*Instance) Publish ¶
Publish exposes only prepared endpoints. A caller also has to complete a fresh challenge through the serving socket before accepting the record.
func (*Instance) PublishWithPreference ¶
func (i *Instance) PublishWithPreference(appURL, remoteURL, preferredURL, preferredRemoteURL string) error
PublishWithPreference records user intent separately from the bound endpoint.
type PortHint ¶
type PortHint struct {
Preference string `json:"preference"`
Main int `json:"main"`
Remote int `json:"remote"`
}
PortHint preserves a successful local origin when the preferred port was unavailable. Preference keys prevent a changed configuration inheriting it.
func ReadPortHint ¶
ReadPortHint treats missing or malformed hints as an ordinary first launch.
type Recorder ¶
type Recorder struct {
Report Report
// contains filtered or unexported fields
}
Recorder is used only by the startup goroutine. Readers use atomic disk files.
func NewRecorder ¶
NewRecorder does not open the datastore or require a writable data directory.
type Report ¶
type Report struct {
SchemaVersion int `json:"schema_version"`
AppVersion string `json:"app_version"`
Commit string `json:"commit"`
Platform string `json:"platform"`
StartedAt time.Time `json:"started_at"`
FinishedAt time.Time `json:"finished_at"`
Stage string `json:"stage"`
Outcome string `json:"outcome"`
Policy string `json:"port_policy,omitempty"`
ErrorCode string `json:"error_code,omitempty"`
NativeCode int `json:"native_code,omitempty"`
Attempts []Attempt `json:"attempts"`
}
Report is an allowlist of startup facts, safe to retain before the API exists.
type Reports ¶
type Reports struct {
Current *Report `json:"current"`
LastFailure *Report `json:"last_failure"`
LastRecovery *Report `json:"last_recovery"`
}
Reports keeps the latest failure and recovery across ordinary clean launches.
func ReadReports ¶
ReadReports excludes the instance record and its private identity token.