Documentation
¶
Index ¶
- Constants
- Variables
- func AcceptValidationHandshake(lease ValidationLease, expected ValidationHandshake, nonce []byte) error
- func CheckDaemonInstallJournal(journal InstallJournal) error
- func CheckUninstallFiles(ctx context.Context, targets []UninstallTarget) error
- func ClassifyUnixLocalError(err error) error
- func CleanupCurrentBinaryUpdates(ctx context.Context) error
- func ConfigureUnixValidation(ctx context.Context, x *InstallTransaction) error
- func EncodeInstallRequest(request InstallRequest) ([]byte, error)
- func EncodeInstallResult(result InstallResult) ([]byte, error)
- func EncodeInstallationState(state InstallationState) ([]byte, error)
- func EncodeJournal(journal InstallJournal) ([]byte, error)
- func FormatStartupError(err error) string
- func InspectUnixActivation(ctx context.Context, layout platform.ResolvedLayout) (phase string, present bool, err error)
- func InspectUnixServiceActivation(ctx context.Context, layout platform.ResolvedLayout) (phase string, present bool, err error)
- func InstallPending(journal InstallJournal) bool
- func MatchJournalObject(recorded, actual JournalObject) error
- func MatchValidationReady(journal InstallJournal, ready ValidationReady) error
- func MigrationSourceNested(source, target string) bool
- func NewDegradedStore(version string, err error) *state.Store
- func PrepareUnixMigration(ctx context.Context, source, target, staging string, req InstallRequest) (err error)
- func ProbeUnixMigrationRoot(ctx context.Context, path string, owner uint32) error
- func RunInheritedValidation(ctx context.Context, id string, ...) (resultErr error)
- func RunUnixForeground(ctx context.Context, layout platform.ResolvedLayout, ...) error
- func RunUnixStartup(ctx context.Context, layout platform.ResolvedLayout, ...) (err error)
- func RunUnixSystemService(ctx context.Context, layout platform.ResolvedLayout, ...) (err error)
- func RunValidationDaemon(ctx context.Context, options ValidationDaemonOptions) (resultErr error)
- func SameProcessStart(recorded, live ProcessStartIdentity) bool
- func VerifyInstallationPlan(plan InstallationPlan) error
- type ActionProgress
- type DaemonVersionClient
- type DataEndpointLease
- type ForegroundBootstrap
- type InstallArtifacts
- type InstallEffects
- type InstallJournal
- type InstallJournalStore
- func (s *InstallJournalStore) CreateTransactionMarker(ctx context.Context, id string) (JournalObject, error)
- func (s *InstallJournalStore) Load(ctx context.Context) (InstallJournal, error)
- func (s *InstallJournalStore) RecordAction(ctx context.Context, journal *InstallJournal, action JournalAction) (JournalDurability, error)
- func (s *InstallJournalStore) ResolveObject(ctx context.Context, name string, recorded JournalObject) (JournalObject, error)
- func (s *InstallJournalStore) Save(ctx context.Context, journal InstallJournal) (JournalDurability, error)
- type InstallLease
- type InstallRequest
- type InstallResult
- type InstallTransaction
- func (x *InstallTransaction) Apply(ctx context.Context, req InstallRequest) (InstallResult, error)
- func (x *InstallTransaction) ApplyLocked(ctx context.Context, lease InstallLease, req InstallRequest) (InstallResult, error)
- func (x *InstallTransaction) RecoverLocked(ctx context.Context, lease InstallLease) error
- func (x *InstallTransaction) StartLocked(ctx context.Context, lease InstallLease) error
- type InstallationBackend
- type InstallationBinary
- type InstallationDataParentIdentity
- type InstallationDataSession
- type InstallationEntry
- type InstallationExecuteRequest
- type InstallationExecutionSession
- type InstallationIdentity
- type InstallationLockedPreparation
- type InstallationManager
- func (m *InstallationManager) Execute(ctx context.Context, request InstallationExecuteRequest) (outcome InstallationOutcome, returnErr error)
- func (m *InstallationManager) Inspect(ctx context.Context) (InstallationStatus, error)
- func (m *InstallationManager) Plan(ctx context.Context, request InstallationPlanRequest) (InstallationPlan, error)
- type InstallationManagerOptions
- type InstallationManifest
- type InstallationObserver
- type InstallationOutcome
- type InstallationOwner
- type InstallationPlan
- type InstallationPlanInstance
- type InstallationPlanRequest
- type InstallationPrepared
- type InstallationPublication
- type InstallationQuiesced
- type InstallationResourceObservation
- type InstallationServiceObservation
- type InstallationSnapshot
- type InstallationSourceScope
- type InstallationStartupStore
- type InstallationState
- type InstallationStateRef
- type InstallationStatus
- type InstalledServiceUpdater
- type JournalAction
- type JournalDurability
- type JournalObject
- type ManagedPortConflict
- type PortRecovery
- type ProcessStartIdentity
- type RuntimeAssembly
- func BuildRuntime(paths platform.Paths, settings config.Settings, daemonVersion string, ...) (*RuntimeAssembly, error)
- func BuildRuntimeWithOptions(paths platform.Paths, settings config.Settings, daemonVersion string, ...) (*RuntimeAssembly, error)
- func BuildValidationRuntime(ctx context.Context, paths platform.Paths, settings config.Settings, ...) (*RuntimeAssembly, error)
- type RuntimeBuildOptions
- type SelfUpdateServiceCompletion
- func (c *SelfUpdateServiceCompletion) AfterPreparedReplace(ctx context.Context, p update.PreparedUpdate) error
- func (c *SelfUpdateServiceCompletion) AfterReplace(ctx context.Context, version string) error
- func (c *SelfUpdateServiceCompletion) ObserveReplacement(ctx context.Context, binary string) (update.ReplacementSnapshot, error)
- type ServiceBackup
- type StartupResources
- type UninstallFileError
- type UninstallService
- type UninstallTarget
- type Uninstaller
- type UninstallerOptions
- type UnixInstallationObserverOptions
- type UnixInstallationReadyProbe
- type UnixInstallationServiceObserver
- type UnixInstaller
- func (i *UnixInstaller) Apply(ctx context.Context, req InstallRequest) (InstallResult, error)
- func (i *UnixInstaller) ApplyPrepared(ctx context.Context, prepared update.PreparedUpdate) (update.Result, error)
- func (i *UnixInstaller) ApplyWithConsent(ctx context.Context, req InstallRequest, consent update.ReplacementConsent) (InstallResult, error)
- func (i *UnixInstaller) Channel(ctx context.Context) (channel string, err error)
- func (i *UnixInstaller) Check(ctx context.Context, current, channel string) (update.CheckResult, error)
- func (i *UnixInstaller) Install() error
- func (i *UnixInstaller) InstalledSourcePresent(ctx context.Context) (bool, error)
- func (i *UnixInstaller) ObserveReplacement(ctx context.Context, binary string) (update.ReplacementSnapshot, error)
- func (i *UnixInstaller) Prepare(ctx context.Context, binary, current, channel string) (update.PreparedUpdate, error)
- func (i *UnixInstaller) QueryChannel(ctx context.Context) (channel string, err error)
- func (i *UnixInstaller) Reinstall() error
- func (i *UnixInstaller) Restart() error
- func (i *UnixInstaller) RunService(ctx context.Context, operation string) (err error)
- func (i *UnixInstaller) SetChannel(ctx context.Context, value string) (err error)
- func (i *UnixInstaller) Start() error
- func (i *UnixInstaller) Status() (status service.StatusKind, err error)
- func (i *UnixInstaller) Stop() error
- func (i *UnixInstaller) Uninstall() error
- func (i *UnixInstaller) Update(ctx context.Context, binary, current, channel string) (result update.Result, err error)
- type ValidationChild
- type ValidationDaemonOptions
- type ValidationHandshake
- type ValidationLease
- type ValidationReady
- type ValidationRecovery
- type ValidationSession
- type ValidationStart
- type VerifiedInstallationPlanInput
Constants ¶
const ( InstallJournalSchema = "mihari.install-transaction/v1" MaxInstallJournalBytes = 1 << 20 InstallPhasePrepared = "prepared" InstallPhaseStopped = "stopped" InstallPhaseDataCommitted = "data_committed" InstallPhaseBinariesCommitted = "binaries_committed" InstallPhaseDefinitionCommitted = "definition_committed" InstallPhaseActivationCommitted = "activation_committed" InstallPhaseComplete = "complete" InstallDataCreate = "create" InstallDataRetain = "retain" InstallAuthoritySource = "source" InstallAuthorityTarget = "target" JournalActionIntent = "intent" JournalActionDone = "done" JournalActionMask = "mask" JournalActionUnmask = "unmask" JournalActionDisable = "disable" JournalActionEnable = "enable" JournalActionStop = "stop" JournalActionStart = "start" JournalActionDataPublish = "data_publish" JournalActionDataIsolate = "data_isolate" JournalActionManagedBinary = "managed_binary" JournalActionPathBinary = "path_binary" JournalActionChannel = "channel" JournalActionDefinition = "definition" JournalActionDropin = "dropin" JournalActionDisabled = "disabled" JournalActionReload = "reload" JournalActionValidationStart = "validation_start" JournalActionValidationStop = "validation_stop" JournalActionActivation = "activation" JournalActionRestoreMask = "restore_mask" JournalActionRestoreUnmask = "restore_unmask" JournalActionRestoreDisable = "restore_disable" JournalActionRestoreEnable = "restore_enable" JournalActionRestoreStop = "restore_stop" JournalActionRestoreStart = "restore_start" JournalActionRestoreData = "restore_data" JournalActionRestoreManagedBinary = "restore_managed_binary" JournalActionRestorePathBinary = "restore_path_binary" JournalActionRestoreChannel = "restore_channel" JournalActionRestoreDefinition = "restore_definition" JournalActionRestoreDropin = "restore_dropin" JournalActionRestoreDisabled = "restore_disabled" JournalActionRestoreReload = "restore_reload" JournalActionRestoreValidation = "restore_validation" JournalRoleSource = "source" JournalRoleTarget = "target" JournalRoleData = "data" JournalRoleInstall = "install" JournalRoleEndpoint = "endpoint" JournalRoleCredential = "credential" JournalRoleChannel = "channel" JournalRoleManagedBinary = "managed_binary" JournalRolePathBinary = "path_binary" JournalRoleDefinition = "definition" JournalRoleDropin = "dropin" JournalRoleValidation = "validation" JournalRoleActivation = "activation" )
const ( InstallRequestSchema = "mihari.install-request/v1" InstallResultSchema = "mihari.install-result/v1" MaxInstallRequestBytes = 64 << 10 InstallOperationInstall = "install" InstallOperationReinstall = "reinstall" InstallOperationUpdate = "update" InstallOperationRecover = "recover" InstallChannelMain = "main" InstallChannelDev = "dev" InstallLayoutSystem = "system" InstallLayoutPrivate = "private" InstallServiceRunning = "running" InstallServiceStopped = "stopped" InstallServiceNotInstalled = "not_installed" )
const ( ValidationOK = "ok" ValidationFailed = "failed" )
const ( InstallationStateSchema = "mihari.install-state/v1" InstallationStatusSchema = "mihari.install-status/v1" InstallationPlanSchema = "mihari.install-plan/v1" InstallationOutcomeSchema = "mihari.install-outcome/v1" MaxInstallationStateBytes = 64 << 10 MaxInstallationPlanBytes = 64 << 10 InstallationKindNotInstalled = "not_installed" InstallationKindInProgress = "in_progress" InstallationKindInterrupted = "interrupted" InstallationKindInstalled = "installed" InstallationKindUnknown = "unknown" InstallationKindPermissionRequired = "permission_required" InstallationStateApplying = "applying" InstallationStateComplete = "complete" InstallationModeRepair = "repair" InstallationModeFresh = "fresh" InstallServiceUnknown = "unknown" InstallationOperationInstall = "install" InstallationOperationUpdate = "update" InstallationOperationRepair = "repair" InstallationOperationFresh = "fresh" InstallationOperationUninstall = "uninstall" InstallationOperationMigrate = "migrate" InstallationDataRetain = "retain" InstallationDataReset = "reset" InstallationReasonInstalling = "installing" InstallationReasonOperationInterrupted = "operation_interrupted" InstallationReasonRecordInvalid = "record_invalid" InstallationReasonResourceMismatch = "resource_mismatch" InstallationReasonPermissionRequired = "permission_required" InstallationReasonServicePolicyMismatch = "service_policy_mismatch" InstallationReasonServiceStartFailed = "service_start_failed" InstallationReasonServiceNotReady = "service_not_ready" InstallationReasonLegacyRecordAbsent = "legacy_record_absent" InstallationReasonMigrationIncomplete = "migration_incomplete" InstallationReasonProcessTreeUnproven = "process_tree_unproven" InstallationCategoryConfig = "config" InstallationCategorySubscriptions = "subscriptions" InstallationCategoryPreferences = "preferences" InstallationCategoryLogs = "logs" InstallationCategoryRuntime = "runtime" InstallationCategoryBinaries = "binaries" InstallationCategoryAssets = "assets" InstallationCategoryWeb = "web" InstallationCategoryStaging = "staging" InstallationCategoryCredential = "credential" InstallationCategoryUnknown = "unknown" )
Variables ¶
var ( ErrInstallationPermissionRequired = errors.New("installation permission required") ErrInstallationObservationUnknown = errors.New("installation observation unknown") )
Functions ¶
func AcceptValidationHandshake ¶ added in v0.9.3
func AcceptValidationHandshake(lease ValidationLease, expected ValidationHandshake, nonce []byte) error
AcceptValidationHandshake verifies the inherited pipe and handshake against the journal intent. There is no environment-variable bypass.
func CheckDaemonInstallJournal ¶ added in v0.9.3
func CheckDaemonInstallJournal(journal InstallJournal) error
CheckDaemonInstallJournal is the ordinary-daemon journal gate. It never acquires the install lock and returns immediately.
func CheckUninstallFiles ¶ added in v0.9.3
func CheckUninstallFiles(ctx context.Context, targets []UninstallTarget) error
CheckUninstallFiles verifies that every existing entry below each target has a recognized Mihari-generated name. It never changes the filesystem.
func ClassifyUnixLocalError ¶ added in v0.9.3
ClassifyUnixLocalError translates native local-operation failures at the app and process boundary. Already classified errors and cancellation keep their semantics; filesystem paths and credentials never become public messages.
func CleanupCurrentBinaryUpdates ¶ added in v0.9.6
CleanupCurrentBinaryUpdates retries cleanup beside this process's executable. It never accesses daemon business files or discovers other installations.
func ConfigureUnixValidation ¶ added in v0.9.3
func ConfigureUnixValidation(ctx context.Context, x *InstallTransaction) error
ConfigureUnixValidation selects the real anonymous-pipe child and captures the installer identity. It does not select a layout or install a service.
func EncodeInstallRequest ¶ added in v0.9.3
func EncodeInstallRequest(request InstallRequest) ([]byte, error)
EncodeInstallRequest validates and marshals a request.
func EncodeInstallResult ¶ added in v0.9.3
func EncodeInstallResult(result InstallResult) ([]byte, error)
EncodeInstallResult validates and marshals a success result.
func EncodeInstallationState ¶ added in v0.9.3
func EncodeInstallationState(state InstallationState) ([]byte, error)
EncodeInstallationState validates and encodes a state document.
func EncodeJournal ¶ added in v0.9.3
func EncodeJournal(journal InstallJournal) ([]byte, error)
EncodeJournal validates and marshals a journal. Env values are never encoded.
func FormatStartupError ¶ added in v0.7.3
FormatStartupError returns a control-plane last_error that never includes secrets, tokens, or raw unknown error text.
func InspectUnixActivation ¶ added in v0.9.3
func InspectUnixActivation(ctx context.Context, layout platform.ResolvedLayout) (phase string, present bool, err error)
InspectUnixActivation reads the ordinary startup gate without taking an install lock or creating B/D. Installer-started activated children can run while their parent still owns the install transaction.
func InspectUnixServiceActivation ¶ added in v0.9.3
func InspectUnixServiceActivation(ctx context.Context, layout platform.ResolvedLayout) (phase string, present bool, err error)
InspectUnixServiceActivation requires root and the selected instance's target authority in the fixed system journal. The marker itself grants no authority.
func InstallPending ¶ added in v0.9.3
func InstallPending(journal InstallJournal) bool
InstallPending is true for prepared through definition_committed. Ordinary daemons must not take the install lock when this is true.
func MatchJournalObject ¶ added in v0.9.3
func MatchJournalObject(recorded, actual JournalObject) error
MatchJournalObject re-checks hash and private marker. Same-boot compares dev/ino/mount; cross-boot does not require mount ID equality.
func MatchValidationReady ¶ added in v0.9.3
func MatchValidationReady(journal InstallJournal, ready ValidationReady) error
MatchValidationReady authorizes activation only from a matching ready.json.
func MigrationSourceNested ¶ added in v0.9.3
MigrationSourceNested reports whether source and target are the same or nested.
func NewDegradedStore ¶ added in v0.7.3
NewDegradedStore returns an in-memory store with health=degraded and a sanitized last_error derived from a daemon assembly failure.
func PrepareUnixMigration ¶ added in v0.9.3
func PrepareUnixMigration(ctx context.Context, source, target, staging string, req InstallRequest) (err error)
PrepareUnixMigration opens no-follow roots and runs preserve-function prepare.
func ProbeUnixMigrationRoot ¶ added in v0.9.3
ProbeUnixMigrationRoot opens and closes a no-follow TrustedRoot at path.
func RunInheritedValidation ¶ added in v0.9.3
func RunInheritedValidation(ctx context.Context, id string, run func(context.Context, platform.ResolvedLayout, *platform.OwnedDaemonLease, func(bool) error) error) (resultErr error)
RunInheritedValidation is the root-only child entry. Journal routing comes from its inherited anonymous pipe; authentication completes before data IO. The callback borrows the daemon lease and must close its own runtime resources before returning. This entry releases the daemon lease after that return.
func RunUnixForeground ¶ added in v0.9.3
func RunUnixForeground(ctx context.Context, layout platform.ResolvedLayout, discover func(context.Context) (bool, error), run func(context.Context, string) error) error
RunUnixForeground is the callable production root/bootstrap lifecycle. The caller supplies source/service discovery and the ordinary daemon assembly; default layout dispatch is a separate entrypoint decision.
func RunUnixStartup ¶ added in v0.9.3
func RunUnixStartup(ctx context.Context, layout platform.ResolvedLayout, discover func(context.Context) (bool, error), run func(context.Context, string) error) (err error)
RunUnixStartup selects an already activated daemon or the greenfield validation/bootstrap lifecycle. Ordinary startup never reacquires install.
func RunUnixSystemService ¶ added in v0.9.3
func RunUnixSystemService(ctx context.Context, layout platform.ResolvedLayout, run func(context.Context, string) error) (err error)
RunUnixSystemService starts only an activated installed target. It never acquires an install lease or falls back to private foreground bootstrap.
func RunValidationDaemon ¶ added in v0.9.3
func RunValidationDaemon(ctx context.Context, options ValidationDaemonOptions) (resultErr error)
RunValidationDaemon consumes Lease, authenticates before daemon data IO, and closes the pipe exactly once after joining its workers on every return path.
func SameProcessStart ¶ added in v0.9.3
func SameProcessStart(recorded, live ProcessStartIdentity) bool
SameProcessStart reports whether recorded still names the live process. Cross-boot identities never match, so a reused PID is not reaped.
func VerifyInstallationPlan ¶ added in v0.9.3
func VerifyInstallationPlan(plan InstallationPlan) error
VerifyInstallationPlan verifies a plan's fields and digest.
Types ¶
type ActionProgress ¶ added in v0.9.3
type ActionProgress int
ActionProgress is derived from recorded actions and observed state, never phase.
const ( ActionNotStarted ActionProgress = iota ActionStarted )
func ClassifyObservedAction ¶ added in v0.9.3
func ClassifyObservedAction(action JournalAction, actualState string) (ActionProgress, error)
ClassifyObservedAction compares actual state to the action's old/new values.
type DaemonVersionClient ¶ added in v0.7.0
DaemonVersionClient reads the daemon version through the local control API.
type DataEndpointLease ¶ added in v0.9.3
type DataEndpointLease interface {
Held() bool
Release(context.Context) error
WaitReleased(context.Context) error
}
DataEndpointLease is the installer's borrowed data/endpoint lock, released before the validation child starts.
type ForegroundBootstrap ¶ added in v0.9.3
type ForegroundBootstrap struct {
Root bool
Transaction *InstallTransaction
// DiscoverSource must inspect legacy service/source state before CreateData.
DiscoverSource func(context.Context) (bool, error)
CreateData func(context.Context) error
// InitializeJournal prepares only immutable recovery metadata. Staging must
// wait for PrepareJournal, after this metadata has a durable journal.
InitializeJournal func(context.Context, string) error
PrepareJournal func(context.Context, string) error
Run func(context.Context, string) error
}
ForegroundBootstrap owns the root foreground install lease through validation and durable activation. Non-root portable instances use their ordinary run.
type InstallArtifacts ¶ added in v0.9.3
type InstallArtifacts struct {
DataAction string
Source, Target, Install, Endpoint string
Credential, DataRoot string
CandidateHash, BackupHash string
OldRunning, OldEnabled bool
TargetRunning, TargetEnabled bool
SourceBytes, DataOld, DataNew []byte
ManagedOld, ManagedNew []byte
PathOld, PathNew []byte
ChannelOld, ChannelNew []byte
DefinitionOld, DefinitionNew []byte
BootID string
}
InstallArtifacts is the prepared candidate/backup set consumed by ApplyLocked. T15 owns real migration; T14 tests inject reconstructable bytes.
type InstallEffects ¶ added in v0.9.3
type InstallEffects interface {
Observe(ctx context.Context, action JournalAction) (string, error)
Apply(ctx context.Context, action JournalAction) error
SourcePresent() bool
Object(role string) []byte
}
InstallEffects applies and observes data, binary, channel and service tokens. Adapters must not call public service entrypoints from here.
type InstallJournal ¶ added in v0.9.3
type InstallJournal struct {
Schema string `json:"schema"`
TransactionID string `json:"transaction_id"`
Operation string `json:"operation"`
Phase string `json:"phase"`
Mode string `json:"mode"`
SourcePath string `json:"source_path"`
TargetPath string `json:"target_path"`
InstallPath string `json:"install_path"`
EndpointPath string `json:"endpoint_path"`
CredentialPath string `json:"credential_path"`
DataRoot string `json:"data_root"`
BootID string `json:"boot_id"`
SourceIdentity JournalObject `json:"source_identity"`
TargetIdentity JournalObject `json:"target_identity"`
InstallIdentity JournalObject `json:"install_identity"`
EndpointIdentity JournalObject `json:"endpoint_identity"`
CredentialIdentity JournalObject `json:"credential_identity"`
CandidateHash string `json:"candidate_hash"`
BackupHash string `json:"backup_hash"`
DataAction string `json:"data_action"`
ServiceBackup ServiceBackup `json:"service_backup"`
OldRunning bool `json:"old_running"`
OldEnabled bool `json:"old_enabled"`
RecoveryAuthority string `json:"recovery_authority"`
CreatedAt time.Time `json:"created_at"`
TransactionMarker JournalObject `json:"transaction_marker"`
Actions []JournalAction `json:"actions"`
}
InstallJournal is the R4 §10 write-ahead transaction document.
func DecodeJournal ¶ added in v0.9.3
func DecodeJournal(reader io.Reader) (InstallJournal, error)
DecodeJournal strictly decodes a bounded install journal.
type InstallJournalStore ¶ added in v0.9.3
type InstallJournalStore struct {
// contains filtered or unexported fields
}
InstallJournalStore persists the install WAL through a trusted publisher.
func NewInstallJournalStore ¶ added in v0.9.3
func NewInstallJournalStore(ctx context.Context, root *platform.TrustedRoot) (*InstallJournalStore, error)
NewInstallJournalStore borrows a trusted base-dir capability. The caller retains root ownership; the store never exposes raw descriptors.
func NewMemoryInstallJournalForTest ¶ added in v0.9.3
func NewMemoryInstallJournalForTest() *InstallJournalStore
NewMemoryInstallJournalForTest supplies only volatile journal storage for cross-package lifecycle tests. It cannot touch a filesystem or a service. Production callers must use NewInstallJournalStore with a trusted root.
func (*InstallJournalStore) CreateTransactionMarker ¶ added in v0.9.3
func (s *InstallJournalStore) CreateTransactionMarker(ctx context.Context, id string) (JournalObject, error)
CreateTransactionMarker publishes transactions/<id>/transaction-id before the first recoverable Load. The marker bytes are the transaction id.
func (*InstallJournalStore) Load ¶ added in v0.9.3
func (s *InstallJournalStore) Load(ctx context.Context) (InstallJournal, error)
Load reads the published journal without using caller-supplied paths as authority.
func (*InstallJournalStore) RecordAction ¶ added in v0.9.3
func (s *InstallJournalStore) RecordAction(ctx context.Context, journal *InstallJournal, action JournalAction) (JournalDurability, error)
RecordAction appends or completes one action and attempts a durable save.
func (*InstallJournalStore) ResolveObject ¶ added in v0.9.3
func (s *InstallJournalStore) ResolveObject(ctx context.Context, name string, recorded JournalObject) (JournalObject, error)
ResolveObject re-opens a trusted object and matches it against a recording.
func (*InstallJournalStore) Save ¶ added in v0.9.3
func (s *InstallJournalStore) Save(ctx context.Context, journal InstallJournal) (JournalDurability, error)
Save publishes a validated journal. Callers must inspect JournalDurability when the error is non-nil; publication may already have occurred.
type InstallLease ¶ added in v0.9.3
InstallLease is a borrowed install lock. RecoverLocked, ApplyLocked and StartLocked never acquire or release it. Unix production passes a wrapper around *platform.OwnedInstallLease; tests use an in-memory fake so the scheduler can run on every GOOS.
type InstallRequest ¶ added in v0.9.3
type InstallRequest struct {
Schema string `json:"schema"`
Operation string `json:"operation"`
Binary string `json:"binary,omitempty"`
Bundle string `json:"bundle,omitempty"`
Source string `json:"source,omitempty"`
Channel string `json:"channel,omitempty"`
Layout string `json:"layout,omitempty"`
Data string `json:"data,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
Credential string `json:"credential,omitempty"`
InstallRoot string `json:"install_root,omitempty"`
PathBinary string `json:"path_binary,omitempty"`
ReleaseTag string `json:"release_tag,omitempty"`
ArtifactSHA256 string `json:"artifact_sha256,omitempty"`
BundleSHA256 string `json:"bundle_sha256,omitempty"`
}
InstallRequest is the R4 §9 apply JSON contract.
func DecodeInstallRequest ¶ added in v0.9.3
func DecodeInstallRequest(reader io.Reader) (InstallRequest, error)
DecodeInstallRequest strictly decodes a bounded install request.
func ReadInstallRequestFile ¶ added in v0.9.3
func ReadInstallRequestFile(ctx context.Context, path string) (InstallRequest, error)
ReadInstallRequestFile reads a bounded, regular, no-follow request on Unix. The returned values are untrusted inputs; authorization is the caller's euid.
type InstallResult ¶ added in v0.9.3
type InstallResult struct {
protocol.WarningOutcome
Schema string `json:"schema"`
Changed bool `json:"changed"`
ServiceStatus string `json:"service_status"`
TransactionID string `json:"transaction_id"`
SourceRetained bool `json:"source_retained"`
}
InstallResult is the R4 §9 success JSON contract.
func DecodeInstallResult ¶ added in v0.9.3
func DecodeInstallResult(reader io.Reader) (InstallResult, error)
DecodeInstallResult strictly decodes a success result document.
type InstallTransaction ¶ added in v0.9.3
type InstallTransaction struct {
Store *InstallJournalStore
Service service.DefinitionAdapter
Effects InstallEffects
Acquire func(context.Context) (InstallLease, error)
Now func() time.Time
NewID func() string
Artifacts InstallArtifacts
Private bool
// StartAfterInstall is the shell apply install policy; CLI install leaves false.
StartAfterInstall bool
Validation ValidationChild
DataLease DataEndpointLease
AfterDataCommitted func(context.Context) error
BeforeRollback func(context.Context) error
EUID uint32
ParentIdentity ProcessStartIdentity
NewPipe func() (parent, child ValidationLease)
// contains filtered or unexported fields
}
InstallTransaction is the R4 §9/§10 install/recover scheduler.
func (*InstallTransaction) Apply ¶ added in v0.9.3
func (x *InstallTransaction) Apply(ctx context.Context, req InstallRequest) (InstallResult, error)
Apply acquires the install lock once, recovers, then applies or returns the recovered result.
func (*InstallTransaction) ApplyLocked ¶ added in v0.9.3
func (x *InstallTransaction) ApplyLocked(ctx context.Context, lease InstallLease, req InstallRequest) (InstallResult, error)
ApplyLocked runs the install under a borrowed lease. It does not flock or Close the lease.
func (*InstallTransaction) RecoverLocked ¶ added in v0.9.3
func (x *InstallTransaction) RecoverLocked(ctx context.Context, lease InstallLease) error
RecoverLocked restores a durable journal under a borrowed install lease.
func (*InstallTransaction) StartLocked ¶ added in v0.9.3
func (x *InstallTransaction) StartLocked(ctx context.Context, lease InstallLease) error
StartLocked recovers under the borrowed lease and starts the target service when allowed.
type InstallationBackend ¶ added in v0.9.3
type InstallationBackend interface {
Prepare(context.Context, InstallationPlanRequest) (InstallationPrepared, error)
}
InstallationBackend prepares a verified candidate without taking the installation operation lock. Prepare must use retained native filesystem capabilities to reject aliased source/target overlap and credential/reset overlap before enumeration or staging. The manager's later DTO checks cannot establish filesystem ancestry.
type InstallationBinary ¶ added in v0.9.3
type InstallationBinary struct {
Path string `json:"path"`
SHA256 string `json:"sha256"`
Version string `json:"version"`
}
InstallationBinary identifies the managed executable.
type InstallationDataParentIdentity ¶ added in v0.9.3
type InstallationDataParentIdentity struct {
Path string `json:"path"`
Identity InstallationIdentity `json:"identity"`
Relative string `json:"relative"`
}
InstallationDataParentIdentity binds a not-yet-created data root to a trusted parent.
type InstallationDataSession ¶ added in v0.9.3
type InstallationDataSession interface {
BindRoot(context.Context) (InstallationManifest, error)
Apply(context.Context) (InstallationManifest, error)
Close() error
}
InstallationDataSession owns the data and endpoint capabilities used by the native deployment implementation.
type InstallationEntry ¶ added in v0.9.3
InstallationEntry is one preserved or reset-managed path.
type InstallationExecuteRequest ¶ added in v0.9.3
type InstallationExecuteRequest struct {
Plan InstallationPlan
ResetConfirmed bool
}
InstallationExecuteRequest submits a previously bound plan.
type InstallationExecutionSession ¶ added in v0.9.3
type InstallationExecutionSession interface {
// Revalidate repeats native scope and ancestry checks under the held lock.
Revalidate(context.Context) (InstallationLockedPreparation, error)
ArchiveState(context.Context, string) error
PublishState(context.Context, string, []byte) (InstallationPublication, error)
Quiesce(context.Context) (InstallationQuiesced, error)
StartAndCheck(context.Context, InstallationManifest) (string, error)
Close() error
}
InstallationExecutionSession owns the installation operation lock.
type InstallationIdentity ¶ added in v0.9.3
type InstallationIdentity struct {
BootID string `json:"boot_id"`
Key string `json:"key"`
Marker string `json:"marker"`
}
InstallationIdentity identifies a protected installation resource.
type InstallationLockedPreparation ¶ added in v0.9.3
type InstallationLockedPreparation struct {
Input VerifiedInstallationPlanInput
Target InstallationManifest
RawState []byte
StateSHA256 string
Legacy *InstallationManifest
Owner InstallationOwner
}
InstallationLockedPreparation is a fresh observation made while holding the installation operation lock.
type InstallationManager ¶ added in v0.9.3
type InstallationManager struct {
// contains filtered or unexported fields
}
InstallationManager owns installation status and repair use cases.
func NewInstallationManager ¶ added in v0.9.3
func NewInstallationManager(options InstallationManagerOptions) *InstallationManager
NewInstallationManager creates an installation manager.
func (*InstallationManager) Execute ¶ added in v0.9.3
func (m *InstallationManager) Execute(ctx context.Context, request InstallationExecuteRequest) (outcome InstallationOutcome, returnErr error)
Execute consumes a plan previously produced by this manager.
func (*InstallationManager) Inspect ¶ added in v0.9.3
func (m *InstallationManager) Inspect(ctx context.Context) (InstallationStatus, error)
Inspect returns a redacted read-only installation status.
func (*InstallationManager) Plan ¶ added in v0.9.3
func (m *InstallationManager) Plan(ctx context.Context, request InstallationPlanRequest) (InstallationPlan, error)
Plan prepares and records a read-only installation authorization.
type InstallationManagerOptions ¶ added in v0.9.3
type InstallationManagerOptions struct {
Observer InstallationObserver
Backend InstallationBackend
Random io.Reader
}
InstallationManagerOptions configures installation use cases.
type InstallationManifest ¶ added in v0.9.3
type InstallationManifest struct {
Installed bool `json:"installed"`
DataRoot string `json:"data_root"`
InstallRoot string `json:"install_root"`
Endpoint string `json:"endpoint"`
Credential string `json:"credential"`
DataIdentity *InstallationIdentity `json:"data_identity"`
DataParentIdentity *InstallationDataParentIdentity `json:"data_parent_identity"`
Binary *InstallationBinary `json:"binary"`
DefinitionSHA256 string `json:"definition_sha256"`
Enabled bool `json:"enabled"`
RunAfterInstall bool `json:"run_after_install"`
}
InstallationManifest describes one complete installation target.
func ConfirmInstallationStartup ¶ added in v0.9.3
func ConfirmInstallationStartup(ctx context.Context, store InstallationStartupStore, verify func(context.Context, InstallationManifest) error) (InstallationManifest, error)
ConfirmInstallationStartup proves a complete installation before business owners start. The caller holds the platform startup gate and supplies a verifier that binds the current executable and selected data/endpoint scope to the manifest.
type InstallationObserver ¶ added in v0.9.3
type InstallationObserver interface {
Snapshot(context.Context) (InstallationSnapshot, error)
VerifyManifest(context.Context, InstallationManifest) (InstallationResourceObservation, error)
ObserveService(context.Context) (InstallationServiceObservation, error)
}
InstallationObserver exposes only read-only installation observations.
func NewUnixInstallationObserver ¶ added in v0.9.3
func NewUnixInstallationObserver(options UnixInstallationObserverOptions) InstallationObserver
NewUnixInstallationObserver constructs a fixed-global-K read-only observer.
type InstallationOutcome ¶ added in v0.9.3
type InstallationOutcome struct {
Schema string `json:"schema"`
InstallationComplete bool `json:"installation_complete"`
ServiceState string `json:"service_state"`
StartFailed bool `json:"start_failed"`
ID string `json:"id"`
}
InstallationOutcome is emitted only after a successful installation command.
type InstallationOwner ¶ added in v0.9.3
type InstallationOwner struct {
BootID string `json:"boot_id"`
PID int64 `json:"pid"`
Start string `json:"start"`
}
InstallationOwner identifies the process publishing an applying state.
type InstallationPlan ¶ added in v0.9.3
type InstallationPlan struct {
Schema string `json:"schema"`
Mode string `json:"mode"`
Instance InstallationPlanInstance `json:"instance"`
CandidateSHA256 string `json:"candidate_sha256"`
Preserve []InstallationEntry `json:"preserve"`
Delete []InstallationEntry `json:"delete"`
PlanSHA256 string `json:"plan_sha256"`
}
InstallationPlan is the stable preview and confirmation contract.
func BindInstallationPlan ¶ added in v0.9.3
func BindInstallationPlan(input VerifiedInstallationPlanInput) (InstallationPlan, error)
BindInstallationPlan binds verified plan facts to a deterministic digest.
type InstallationPlanInstance ¶ added in v0.9.3
type InstallationPlanInstance struct {
RecordID string `json:"record_id"`
RecordSHA256 string `json:"record_sha256"`
DataRoot string `json:"data_root"`
DataIdentity *InstallationIdentity `json:"data_identity"`
DataParentIdentity *InstallationDataParentIdentity `json:"data_parent_identity"`
SourceScope *InstallationSourceScope `json:"source_scope"`
Enabled bool `json:"enabled"`
RunAfterInstall bool `json:"run_after_install"`
}
InstallationPlanInstance is the verified instance scope bound by a plan digest.
type InstallationPlanRequest ¶ added in v0.9.3
InstallationPlanRequest selects a repair or fresh installation preview.
type InstallationPrepared ¶ added in v0.9.3
type InstallationPrepared interface {
Describe(context.Context) (VerifiedInstallationPlanInput, InstallationManifest, error)
Begin(context.Context) (InstallationExecutionSession, error)
Close() error
}
InstallationPrepared retains native candidate capabilities between preparation and an execution session.
type InstallationPublication ¶ added in v0.9.3
type InstallationPublication = platform.InstallPublication
InstallationPublication reports whether a state publication became visible and whether its durability was proven.
type InstallationQuiesced ¶ added in v0.9.3
type InstallationQuiesced interface {
OpenData(context.Context) (InstallationDataSession, error)
Close() error
}
InstallationQuiesced owns the platform startup gate after the managed tree has been proven stopped.
type InstallationResourceObservation ¶ added in v0.9.3
type InstallationResourceObservation struct {
Matches bool
}
InstallationResourceObservation reports whether a manifest's resources still match.
type InstallationServiceObservation ¶ added in v0.9.3
InstallationServiceObservation reports current service state, policy, and health.
type InstallationSnapshot ¶ added in v0.9.3
type InstallationSnapshot struct {
Present bool
OperationLocked bool
State []byte
Legacy *InstallationManifest
}
InstallationSnapshot is one read-only observation of the control record and operation lock.
type InstallationSourceScope ¶ added in v0.9.3
type InstallationSourceScope struct {
DataRoot string `json:"data_root"`
DataIdentity InstallationIdentity `json:"data_identity"`
Selection string `json:"selection"`
EvidenceSHA256 string `json:"evidence_sha256"`
}
InstallationSourceScope records a protected migration source.
type InstallationStartupStore ¶ added in v0.9.3
type InstallationStartupStore interface {
ReadState(context.Context) ([]byte, string, error)
ConfirmState(context.Context, string) error
}
InstallationStartupStore exposes a read and durability confirmation, never installation mutation.
type InstallationState ¶ added in v0.9.3
type InstallationState struct {
Schema string `json:"schema"`
ID string `json:"id"`
State string `json:"state"`
Operation string `json:"operation"`
Owner *InstallationOwner `json:"owner"`
Base *InstallationManifest `json:"base"`
Target InstallationManifest `json:"target"`
DataPolicy string `json:"data_policy"`
ResetEntries []string `json:"reset_entries"`
Supersedes *InstallationStateRef `json:"supersedes"`
SourceScope *InstallationSourceScope `json:"source_scope"`
}
InstallationState is the private installation-control state document.
func DecodeInstallationState ¶ added in v0.9.3
func DecodeInstallationState(reader io.Reader) (InstallationState, error)
DecodeInstallationState strictly decodes a bounded state document.
type InstallationStateRef ¶ added in v0.9.3
InstallationStateRef binds a replacement state to its predecessor.
type InstallationStatus ¶ added in v0.9.3
type InstallationStatus struct {
Schema string `json:"schema"`
Kind string `json:"kind"`
ServiceState string `json:"service_state"`
StartFailed bool `json:"start_failed"`
Reason string `json:"reason"`
ID string `json:"id"`
}
InstallationStatus is the redacted read-only status contract.
type InstalledServiceUpdater ¶ added in v0.7.0
type InstalledServiceUpdater interface {
UpdateInstalledBinary() (bool, error)
UpdateInstalledBinaryChecked(context.Context, service.ServiceReplacementChecks) (bool, error)
ObserveReplacementService(context.Context) (service.ServiceReplacementView, error)
}
InstalledServiceUpdater synchronizes and restarts an installed Mihari OS service. The boolean result reports whether a service installation exists.
type JournalAction ¶ added in v0.9.3
type JournalAction struct {
Seq int `json:"seq"`
Kind string `json:"kind"`
TargetRole string `json:"target_role"`
OldState string `json:"old_state"`
BackupRef string `json:"backup_ref"`
NewState string `json:"new_state"`
CandidateRef string `json:"candidate_ref"`
Status string `json:"status"`
}
JournalAction is one external or reverse-recovery step with intent/done.
func IncompleteActions ¶ added in v0.9.3
func IncompleteActions(journal InstallJournal) []JournalAction
IncompleteActions returns actions that are not done. Phase is ignored.
type JournalDurability ¶ added in v0.9.3
type JournalDurability struct {
Published bool
Durable bool
Object JournalObject
}
JournalDurability reports whether a journal write became visible. Published means rename completed; Durable means parent fsync completed. A parent-sync error may still have Published=true.
type JournalObject ¶ added in v0.9.3
type JournalObject struct {
Present bool `json:"present"`
SHA256 string `json:"sha256"`
Dev string `json:"dev"`
Ino string `json:"ino"`
MountID string `json:"mount_id"`
BootID string `json:"boot_id"`
Marker string `json:"marker"`
Identity string `json:"identity"`
}
JournalObject is a trusted observation, not authority to skip re-resolution.
type ManagedPortConflict ¶ added in v0.9.4
type ManagedPortConflict struct {
// contains filtered or unexported fields
}
ManagedPortConflict identifies the narrow, recoverable startup failure while retaining the existing safe API error and JSON contract.
func (*ManagedPortConflict) Error ¶ added in v0.9.4
func (e *ManagedPortConflict) Error() string
Error returns the existing safe managed-port failure message.
func (*ManagedPortConflict) PortConflict ¶ added in v0.9.4
func (e *ManagedPortConflict) PortConflict() bool
PortConflict marks only confirmed address-in-use errors.
func (*ManagedPortConflict) Unwrap ¶ added in v0.9.4
func (e *ManagedPortConflict) Unwrap() error
Unwrap preserves typed access to the underlying public API error.
type PortRecovery ¶ added in v0.9.4
type PortRecovery struct {
// contains filtered or unexported fields
}
PortRecovery exposes only onboarding reads and endpoint updates. Its Manager is never installed as the full control runtime or started as a business owner.
func NewPortRecovery ¶ added in v0.9.4
func NewPortRecovery(paths platform.Paths, store *state.Store, cause error, reporter diagnostics.Reporter) (*PortRecovery, error)
NewPortRecovery builds the daemon-owned recovery surface after a confirmed port conflict, using the existing settings transaction and onboarding format.
func (*PortRecovery) OnboardingStatus ¶ added in v0.9.4
func (r *PortRecovery) OnboardingStatus(ctx context.Context) (onboarding.Snapshot, error)
OnboardingStatus reads saved endpoint values without claiming recovery is complete.
func (*PortRecovery) UpdateOnboarding ¶ added in v0.9.4
func (r *PortRecovery) UpdateOnboarding(ctx context.Context, op runtimeapi.Operation, update onboarding.Update) (onboarding.Snapshot, error)
UpdateOnboarding only permits endpoint changes; completion requires a normal runtime.
type ProcessStartIdentity ¶ added in v0.9.3
type ProcessStartIdentity struct {
PID int `json:"pid"`
BootID string `json:"boot_id"`
StartUnix int64 `json:"start_unix"`
StartUsec uint32 `json:"start_usec,omitempty"`
}
ProcessStartIdentity identifies a parent or validation daemon across PID reuse.
type RuntimeAssembly ¶
type RuntimeAssembly struct {
StartupCleanup func(context.Context) error
SetupRequired bool
Manager *runtimeapi.Manager
Store *state.Store
Web *web.Server
// contains filtered or unexported fields
}
func BuildRuntime ¶
func BuildRuntimeWithOptions ¶
func BuildRuntimeWithOptions(paths platform.Paths, settings config.Settings, daemonVersion string, stdout, stderr io.Writer, options RuntimeBuildOptions) (*RuntimeAssembly, error)
func BuildValidationRuntime ¶ added in v0.9.3
func BuildValidationRuntime(ctx context.Context, paths platform.Paths, settings config.Settings, daemonVersion string, options RuntimeBuildOptions) (*RuntimeAssembly, error)
BuildValidationRuntime reads existing business objects without initializing after historical recovery, propagating private child lifetime cancellation.
type RuntimeBuildOptions ¶
type RuntimeBuildOptions struct {
TrustedCore *core.TrustedExecution
Resources StartupResources
// PortProbeListen opens temporary TCP listeners only for the managed-port probe.
// Nil uses net.Listen; it does not replace controller or gateway listeners.
PortProbeListen func(network, address string) (net.Listener, error)
InitialSetupRequired bool
SettingsPath string
ServiceStatus func() (string, error)
InstallationInspect func(context.Context) (InstallationStatus, error)
Logging runtimeapi.LoggingRuntime
DiagnosticReporter diagnostics.Reporter
RefreshLogSecrets func(catalogURLs []string)
MihomoStdout io.Writer
MihomoStderr io.Writer
SaveOnboardingState func(string, onboarding.State) (config.CommitResult, error)
OnBackgroundError func(component string, err error)
ValidationMode bool
ValidationCore core.ProvenanceStore
ActivationPhase string
ShareProcessGroup bool
}
type SelfUpdateServiceCompletion ¶ added in v0.7.0
type SelfUpdateServiceCompletion struct {
// contains filtered or unexported fields
}
SelfUpdateServiceCompletion coordinates the post-replacement service update and verifies that the restarted daemon reports the new Mihari version.
func NewSelfUpdateServiceCompletion ¶ added in v0.7.0
func NewSelfUpdateServiceCompletion(service InstalledServiceUpdater, client DaemonVersionClient) *SelfUpdateServiceCompletion
NewSelfUpdateServiceCompletion returns a post-replacement service coordinator.
func (*SelfUpdateServiceCompletion) AfterPreparedReplace ¶ added in v0.9.3
func (c *SelfUpdateServiceCompletion) AfterPreparedReplace(ctx context.Context, p update.PreparedUpdate) error
AfterPreparedReplace consumes the service portion of the confirmed preview.
func (*SelfUpdateServiceCompletion) AfterReplace ¶ added in v0.7.0
func (c *SelfUpdateServiceCompletion) AfterReplace(ctx context.Context, version string) error
AfterReplace updates an installed service and waits until its daemon reports version. A missing service is a successful no-op.
func (*SelfUpdateServiceCompletion) ObserveReplacement ¶ added in v0.9.3
func (c *SelfUpdateServiceCompletion) ObserveReplacement(ctx context.Context, binary string) (update.ReplacementSnapshot, error)
ObserveReplacement discovers the executable and the actual service staging destination.
type ServiceBackup ¶ added in v0.9.3
type ServiceBackup struct {
Ref string `json:"ref"`
SHA256 string `json:"sha256"`
Identity string `json:"identity"`
}
ServiceBackup records original service definition bytes by hash and private ref.
type StartupResources ¶ added in v0.9.3
StartupResources settles historical resource journals before business stores load.
type UninstallFileError ¶ added in v0.9.3
UninstallFileError reports an entry that cannot be safely recognized.
func (*UninstallFileError) Error ¶ added in v0.9.3
func (e *UninstallFileError) Error() string
type UninstallService ¶ added in v0.9.3
type UninstallService interface {
Uninstall() error
Status() (service.StatusKind, error)
}
UninstallService performs the existing operating-system service actions.
type UninstallTarget ¶ added in v0.9.3
UninstallTarget is one resolved root whose generated entries may be removed.
type Uninstaller ¶ added in v0.9.3
type Uninstaller struct {
// contains filtered or unexported fields
}
Uninstaller removes an existing Mihari service and its recognized files.
func NewUninstaller ¶ added in v0.9.3
func NewUninstaller(layout platform.ResolvedLayout, opts UninstallerOptions) *Uninstaller
NewUninstaller captures the resolved layout and uninstall dependencies.
func (*Uninstaller) Preview ¶ added in v0.9.3
func (u *Uninstaller) Preview(ctx context.Context) ([]UninstallTarget, error)
Preview returns the fixed roots selected for uninstall. It does not inspect folder contents; callers that must refuse unrecognized files use Run.
type UninstallerOptions ¶ added in v0.9.3
type UninstallerOptions struct {
Service UninstallService
Uninstall func(context.Context) error
Status func(context.Context) (service.StatusKind, error)
Elevated func() bool
ProbeDaemon func(context.Context) (bool, error)
Remove func(string) error
PollInterval time.Duration
}
UninstallerOptions supplies the narrow dependencies used by Uninstaller.
type UnixInstallationObserverOptions ¶ added in v0.9.3
type UnixInstallationObserverOptions struct {
Service UnixInstallationServiceObserver
Ready UnixInstallationReadyProbe
}
UnixInstallationObserverOptions supplies read-only OS service observations.
type UnixInstallationReadyProbe ¶ added in v0.9.3
type UnixInstallationReadyProbe func(ctx context.Context, endpoint, credentialPath string) (bool, error)
UnixInstallationReadyProbe checks the verified definition's local control endpoint and credential path. An unavailable daemon is a not-ready observation, never installation recovery.
type UnixInstallationServiceObserver ¶ added in v0.9.3
type UnixInstallationServiceObserver interface {
InspectDefinition(context.Context) (service.Definition, error)
}
UnixInstallationServiceObserver is the read-only part of a native Unix service adapter used by installation status inspection.
type UnixInstaller ¶ added in v0.9.3
type UnixInstaller struct {
// contains filtered or unexported fields
}
UnixInstaller is the callable Unix install and self-update use case. Constructing it performs no IO; platform entrypoint assembly chooses when to inject it. Every Apply/RunService owns and closes one outer install session. Prepare owns only an inert downloaded candidate, which the caller must Close after Apply.
func NewUnixInstaller ¶ added in v0.9.3
func NewUnixInstaller(layout platform.ResolvedLayout, binary, version string) (*UnixInstaller, error)
NewUnixInstaller wires real retained capabilities, WAL recovery, immutable release verification, validation child and the native system service adapter. It does not change the process's default layout selection.
func (*UnixInstaller) Apply ¶ added in v0.9.3
func (i *UnixInstaller) Apply(ctx context.Context, req InstallRequest) (InstallResult, error)
Apply is the shell/JSON service apply entrypoint; install requests start the service after validation. CLI install calls RunService and registers it stopped.
func (*UnixInstaller) ApplyPrepared ¶ added in v0.9.3
func (i *UnixInstaller) ApplyPrepared(ctx context.Context, prepared update.PreparedUpdate) (update.Result, error)
ApplyPrepared re-verifies candidate authority after the UI has closed workers, logging and filesystem owners; it never trusts PreparedUpdate.SHA256 alone.
func (*UnixInstaller) ApplyWithConsent ¶ added in v0.9.3
func (i *UnixInstaller) ApplyWithConsent(ctx context.Context, req InstallRequest, consent update.ReplacementConsent) (InstallResult, error)
ApplyWithConsent applies a replacement with explicit current-call risk consent.
func (*UnixInstaller) Channel ¶ added in v0.9.3
func (i *UnixInstaller) Channel(ctx context.Context) (channel string, err error)
Channel inspects the service before opening B. Standalone updates use the running binary's release channel and never access an installation sidecar.
func (*UnixInstaller) Check ¶ added in v0.9.3
func (i *UnixInstaller) Check(ctx context.Context, current, channel string) (update.CheckResult, error)
Check preserves the existing update-check contract without installation IO.
func (*UnixInstaller) Install ¶ added in v0.9.3
func (i *UnixInstaller) Install() error
func (*UnixInstaller) InstalledSourcePresent ¶ added in v0.9.3
func (i *UnixInstaller) InstalledSourcePresent(ctx context.Context) (bool, error)
InstalledSourcePresent performs authoritative native service inspection for greenfield discovery. Unknown manager state never becomes an absent source.
func (*UnixInstaller) ObserveReplacement ¶ added in v0.9.3
func (i *UnixInstaller) ObserveReplacement(ctx context.Context, binary string) (update.ReplacementSnapshot, error)
ObserveReplacement discovers only the files replaced by this installer's update. It inspects the service before accessing any installation root.
func (*UnixInstaller) Prepare ¶ added in v0.9.3
func (i *UnixInstaller) Prepare(ctx context.Context, binary, current, channel string) (update.PreparedUpdate, error)
Prepare downloads and verifies fixed-tag inert bytes without stopping a service.
func (*UnixInstaller) QueryChannel ¶ added in v0.9.3
func (i *UnixInstaller) QueryChannel(ctx context.Context) (channel string, err error)
QueryChannel reads the selected sidecar without service inspection or writes. Missing metadata retains the stable self-channel query default of main.
func (*UnixInstaller) Reinstall ¶ added in v0.9.3
func (i *UnixInstaller) Reinstall() error
func (*UnixInstaller) Restart ¶ added in v0.9.3
func (i *UnixInstaller) Restart() error
func (*UnixInstaller) RunService ¶ added in v0.9.3
func (i *UnixInstaller) RunService(ctx context.Context, operation string) (err error)
RunService funnels CLI lifecycle operations through the same recovery session.
func (*UnixInstaller) SetChannel ¶ added in v0.9.3
func (i *UnixInstaller) SetChannel(ctx context.Context, value string) (err error)
SetChannel owns one local metadata maintenance lease. It never acquires D/E, starts a service, or recovers an interrupted installation implicitly.
func (*UnixInstaller) Start ¶ added in v0.9.3
func (i *UnixInstaller) Start() error
func (*UnixInstaller) Status ¶ added in v0.9.3
func (i *UnixInstaller) Status() (status service.StatusKind, err error)
Status uses a bounded read-only service query for legacy controller consumers.
func (*UnixInstaller) Stop ¶ added in v0.9.3
func (i *UnixInstaller) Stop() error
func (*UnixInstaller) Uninstall ¶ added in v0.9.3
func (i *UnixInstaller) Uninstall() error
type ValidationChild ¶ added in v0.9.3
type ValidationChild interface {
Start(context.Context, ValidationStart) (ValidationSession, error)
}
ValidationChild starts one no-business validation daemon.
type ValidationDaemonOptions ¶ added in v0.9.3
type ValidationDaemonOptions struct {
Lease ValidationLease
Store *InstallJournalStore
TransactionID string
EUID uint32
ParentIdentity, SelfIdentity ProcessStartIdentity
BinaryHash, LayoutIdentity string
// Run owns and closes all data/endpoint/log/IPC resources before it returns.
// Ready is called only after all read-only validation and IPC initialization.
Run func(context.Context, InstallJournal, func(bool) error) error
}
ValidationDaemonOptions supplies process observations and a trusted journal. Native assembly captures identities from the kernel, never from CLI input.
type ValidationHandshake ¶ added in v0.9.3
type ValidationHandshake struct {
JournalRoot string
TransactionID string
NonceHash string
CandidateHash string
ParentIdentity ProcessStartIdentity
EUID uint32
LayoutIdentity string
}
ValidationHandshake is the private pipe contract. Transaction and hashes come from the trusted journal, not from a user request.
type ValidationLease ¶ added in v0.9.3
type ValidationLease interface {
Read([]byte) (int, error)
Write([]byte) (int, error)
Close() error
}
ValidationLease is a private anonymous bidirectional pipe end.
func InheritedValidationLease ¶ added in v0.9.3
func InheritedValidationLease() (ValidationLease, error)
InheritedValidationLease returns the anonymous pipe inherited as extra file 3.
type ValidationReady ¶ added in v0.9.3
type ValidationReady struct {
TransactionID string `json:"transaction_id"`
DaemonIdentity ProcessStartIdentity `json:"daemon_identity"`
BinaryHash string `json:"binary_hash"`
LayoutIdentity string `json:"layout_identity"`
Validation string `json:"validation"`
SetupRequired bool `json:"setup_required,omitempty"`
}
ValidationReady is B/transactions/<id>/ready.json. Ordinary /v1 status must not decode as this document.
func DecodeValidationReady ¶ added in v0.9.3
func DecodeValidationReady(raw []byte) (ValidationReady, error)
DecodeValidationReady strictly decodes ready.json. /v1 status documents are rejected.
type ValidationRecovery ¶ added in v0.9.3
type ValidationRecovery interface {
ReapValidation(context.Context, ProcessStartIdentity, InstallJournal) error
}
ValidationRecovery reaps only the recorded process and waits for its locks.
type ValidationSession ¶ added in v0.9.3
type ValidationSession interface {
Identity() ProcessStartIdentity
WaitReady(context.Context) error
Stop(context.Context) error
WaitLockRelease(context.Context) error
Close() error
}
ValidationSession is a started child until stop and lock release.
type ValidationStart ¶ added in v0.9.3
type ValidationStart struct {
Lease ValidationLease
Child ValidationLease
Handshake ValidationHandshake
Nonce []byte
Journal InstallJournal
Store *InstallJournalStore
DataLease DataEndpointLease
}
ValidationStart is the installer-owned launch request.
type VerifiedInstallationPlanInput ¶ added in v0.9.3
type VerifiedInstallationPlanInput struct {
Mode string
Instance InstallationPlanInstance
CandidateSHA256 string
Preserve []InstallationEntry
Delete []InstallationEntry
}
VerifiedInstallationPlanInput contains already-normalized, capability-verified plan facts.
Source Files
¶
- activation_test_support.go
- binary_stage.go
- binary_stage_unix.go
- binary_update_unix.go
- channel_maintenance.go
- channel_maintenance_unix.go
- degraded.go
- foreground_bootstrap.go
- foreground_bootstrap_unix.go
- foreground_constructor.go
- install_adapter_linux.go
- install_artifact.go
- install_bootstrap_source.go
- install_data_authority.go
- install_entrypoints.go
- install_hostfile_unix.go
- install_journal.go
- install_journal_linux.go
- install_journal_unix.go
- install_lifecycle.go
- install_migration.go
- install_migration_unix.go
- install_native_cleanup_unix.go
- install_native_data_unix.go
- install_native_effects_unix.go
- install_native_lifecycle_unix.go
- install_native_prepare_unix.go
- install_native_retained_unix.go
- install_native_service_unix.go
- install_native_session_unix.go
- install_recovery.go
- install_release_inputs_unix.go
- install_replacement.go
- install_replacement_offline_unix.go
- install_request.go
- install_select.go
- install_service_effects.go
- install_service_identity.go
- install_service_slots.go
- install_source_unix.go
- install_transaction.go
- install_trust.go
- install_trust_unix.go
- install_validation.go
- install_validation_unix.go
- installation_codec.go
- installation_inspect.go
- installation_manager.go
- installation_observer_unix.go
- installation_path_other.go
- installation_plan.go
- installation_protocol.go
- installation_reset.go
- installation_startup.go
- installation_state.go
- installer_unix.go
- launchd_runtime.go
- local_error_unix.go
- port_recovery.go
- ports.go
- replacement_targets.go
- replacement_targets_unix.go
- runtime.go
- self_update.go
- startup_binary_cleanup.go
- startup_binary_cleanup_unix.go
- startup_gate.go
- startup_gate_unix.go
- uninstall.go
- uninstall_files.go
- uninstall_link_unix.go
- validation_daemon.go
- validation_defaults_unix.go
- validation_entry_unix.go
- validation_exec_unix.go
- validation_launch.go
- validation_lease.go
- validation_process_linux.go
- validation_process_record.go
- validation_session.go
- windows_runtime.go