Documentation
¶
Index ¶
- Constants
- Variables
- func AbandonPause(ctx context.Context, intended, adopted map[string]any) error
- func AdoptPauseOrphans(ctx context.Context) (map[string]any, []string, error)
- func AdoptTerminalReceipt(ctx context.Context, data any)
- func AmendTerminalFollowup(ctx context.Context, updateID, step, reason string) error
- func ArmHostObligation(ctx context.Context, marker, expectedSHA string, runtimes []any, ...) (bool, error)
- func BeginUpdateReceipt(ctx context.Context, previous *jsonutil.Object, correlationID string)
- func BindChildToUpdateTree(pid int) error
- func BuildVersion() string
- func CheckoutHeld() bool
- func CheckoutLockFiles(installRoot string) ([]*os.File, error)
- func CheckoutLockHeld(ctx context.Context, installRoot string) (bool, error)
- func CheckoutLockPath(installRoot string) (string, error)
- func ClaimPause(ctx context.Context, src string) (string, map[string]any, bool, error)
- func ClearCurrentReceipt(ctx context.Context)
- func ClearHostObligation()
- func CollapseUnitsToHostProcesses(units []string, mainPID func(string) (int, error)) ([]string, map[string]string)
- func CommittedSuccess(ctx context.Context) bool
- func CurrentCorrelationID(ctx context.Context) *string
- func CustodySpawnFiles() []*os.File
- func DeathSignalAttr() *syscall.SysProcAttr
- func DescribeHolder(holder *UpdateHolder) string
- func DischargePause(ctx context.Context, token map[string]any, path string) error
- func DropNeverStopped(token map[string]any) (map[string]any, error)
- func FinalizeInterruptedUpdateReceipt(ctx context.Context, stopReason string, exitCode int) string
- func FinalizePendingUpdateReceipt(ctx context.Context, exitCode *int, stopReason string) string
- func FinalizeUpdateReceipt(ctx context.Context, outcome string, fleet []any, stopReason string) string
- func FinalizedReceipt(updateID string) *jsonutil.Object
- func FinishPause(ctx context.Context, token, intended, adopted map[string]any) (map[string]any, error)
- func GatewayExitCodePath(h string) string
- func GetCodeIdentity(refresh bool) (*jsonutil.Object, error)
- func GitArgv(gitCmd, args []string) []string
- func GitCommonDir(root string) (string, error)
- func GitErrorStopClass(err error) *string
- func GitExecutable(ctx context.Context) string
- func GitOutputStopClass(output string, argv []string, returncode *int) *string
- func GitSubcommand(args []string) string
- func HeadSHA(ctx context.Context, root string) string
- func HoldsCheckoutLock(installRoot string) (bool, error)
- func HostObligationPath() string
- func HostObligationPresent() bool
- func HostRestartAlreadyCompleted(sha string) bool
- func HostStateDir() string
- func IdentityLine(pid int) string
- func IncarnationLive(pid int, recordedCT any) *bool
- func IsLocalMutator(args []string) bool
- func IsPauseRecordError(err error, kind string) bool
- func JudgeMarker(raw []byte, w *World) (string, *int, *string)
- func LatestReceiptObject(ctx context.Context) *jsonutil.Object
- func LoadReceiptFile(path string) (any, error)
- func MarkCustodyRan()
- func MarkHostRestartCompleted(ctx context.Context, sha string)
- func MarkMove(ctx context.Context, token map[string]any, target string) error
- func MarkStopAccepted(path string, marker *jsonutil.Object) error
- func MarkStopConsumed(path string, marker *jsonutil.Object, ...) error
- func MarkStopRequested(ctx context.Context, token map[string]any, pids []int, markers map[int]string) error
- func MarkStopSent(ctx context.Context, token map[string]any, pid int) error
- func MarkerMutex(ctx context.Context, path string, wait time.Duration) (context.Context, func(), error)
- func MarkerMutexPath(path string) string
- func MergePauseInto(token, adopted map[string]any) (map[string]any, error)
- func ObligationFields() map[string]string
- func OweFollowup(ctx context.Context, updateID *string, step, reason, retry string) error
- func OwnerAlive(record *jsonutil.Object) bool
- func OwnerWatch(pid int) func()
- func PauseAcceptedPath(markerPath string) string
- func PauseIdentity(pid int) map[string]any
- func PauseIdentityIsLive(ident map[string]any) bool
- func PauseInstallRoot() string
- func PauseMutex(ctx context.Context, wait time.Duration) (context.Context, func(), error)
- func PauseRecordPath() string
- func PauseUnowned() map[string]any
- func PersistRunningReceipt(ctx context.Context)
- func ProcessCreateTime(pid int) *float64
- func PsutilParent(pid int) (int, bool, error)
- func ReadCheckoutSHA() (*string, error)
- func ReadHostObligation() *jsonutil.Object
- func ReadLatestReceipt(ctx context.Context) map[string]any
- func ReadPauseRecord(path string) (map[string]any, error)
- func ReadRunRecord(ctx context.Context, updateID string) (string, *jsonutil.Object, bool)
- func ReceiptDir(ctx context.Context) string
- func ReceiptDirs(ctx context.Context) []string
- func ReceiptPayload(data any, indent bool) ([]byte, error)
- func ReconcileInterruptedRuns(ctx context.Context) []map[string]any
- func RecordBuildStage(ctx context.Context, followups [][2]string)
- func RecordFact(ctx context.Context, key string, value any)
- func RecordFollowup(ctx context.Context, step, reason, retry string)
- func RecordGatewayRestart(ctx context.Context, g GatewayRestart)
- func RecordPause(ctx context.Context, token, adopted map[string]any, claims []string) (map[string]any, error)
- func RecordSkip(ctx context.Context, name, reason string)
- func RecordStage(ctx context.Context, name, outcome string, facts *jsonutil.Object)
- func RecordStep(ctx context.Context, name string, ok bool, detail string)
- func RecordStopReason(ctx context.Context, reason string)
- func RecordUserAction(ctx context.Context, step, reason string)
- func RecoverPauses(ctx context.Context, argv []string) error
- func RefusalNotice(command string) *string
- func ReleaseCheckout()
- func ReleaseHostObligation(ctx context.Context, owner string) error
- func ReleasePauseClaims(ctx context.Context, claims []string) error
- func ReplaceBytes(path string, data []byte) error
- func ResetCurrentReceipt(ctx context.Context)
- func ResetCustodyRun() func()
- func ResetVersionInfoCache()
- func ResumeReceipt(ctx context.Context, data *jsonutil.Object)
- func ResumeRunRecord(ctx context.Context) string
- func ResumeSuspendedChild(process *os.Process) error
- func RetirePauseRedundant(ctx context.Context, path string) error
- func RowIsExternal(row any) bool
- func RunFile(directory string, data *jsonutil.Object) string
- func SetBuildVersion(version string)
- func SetObligationStderr(w io.Writer) func()
- func SetPauseGatewayResumer(resume func(ctx context.Context, token map[string]any, stdout io.Writer) error)
- func SetPlannedStopProbe(probe PlannedStopProbe)
- func SetRuntimeHostMatcher(match func([]string) bool)
- func SplitDraining(token map[string]any) (map[string]any, error)
- func StampTree(ctx context.Context, token map[string]any, root string) (map[string]any, error)
- func SyncPause(ctx context.Context, token map[string]any) error
- func TornByMove(ctx context.Context, root string, found map[string]any, changes []string, ...) ([]string, bool, error)
- func TrackedChanges(ctx context.Context, root string) ([]string, bool)
- func TreeIsWhole(ctx context.Context, token map[string]any, root string) (bool, string, error)
- func TreeState(ctx context.Context, root string) map[string]any
- func UpdateInProgress(ctx context.Context, installRoot string) (bool, error)
- func UpdateMarkerPath() string
- func UpdateReceiptScope(ctx context.Context) context.Context
- func UserAgent(product string) (string, error)
- func WriteGatewayUpdateExitCode(ctx context.Context, ok bool)
- func WriteHostObligation(ctx context.Context, expectedSHA string, runtimes []any, profile, owner string) bool
- func WriteLatest(ctx context.Context, payload []byte) error
- func WritePause(ctx context.Context, token, owner map[string]any, path string) error
- type CustodyRefused
- type GatewayRestart
- type GitResult
- type GitTimeout
- type KeyErrorText
- type MarkerBusy
- type PauseFile
- type PauseRecordError
- type PlannedStopProbe
- type ProfileHome
- type StampError
- type UpdateHolder
- type UpdateLock
- type UpdateReceipt
- func (r *UpdateReceipt) Fact(key string, value any) error
- func (r *UpdateReceipt) Finalize(outcome string)
- func (r *UpdateReceipt) Followup(step, reason string) error
- func (r *UpdateReceipt) GatewayRestartResult(g GatewayRestart) error
- func (r *UpdateReceipt) Skip(name, reason string) error
- func (r *UpdateReceipt) Stage(name, outcome string, facts *jsonutil.Object) error
- func (r *UpdateReceipt) Step(name string, ok bool, detail string) error
- type VersionInfo
- type World
Constants ¶
const ( UpdateMarkerMaxAgeSeconds = 20 * 60 CreateTimeToleranceSeconds = 2.0 EmptyMarkerGraceSeconds = 5.0 MarkerName = ".icebath-update-in-progress" CheckoutLockName = ".icebath-update.lock" GitCheckoutLockName = "icebath-update.lock" HandoffPIDEnv = "ICEBATH_UPDATE_HANDOFF_PID" UpdateExitConcurrent = 2 )
const ( OwnPIDTmpStaleSeconds = 60.0 MutexSuffix = ".lock" MutexWaitSeconds = 10.0 CheckoutContentionWaitSeconds = 3.0 CreateSuspended = 0x00000004 )
const ( HostObligationName = "host-update-restart.json" ProfileMarkerName = "fleet_restart_pending" )
const ( PauseRecordStem = ".icebath-update-paused-gateways" PauseMutexName = PauseRecordStem + ".lock" PauseMutexWaitSeconds = 10.0 )
const ( CommandBoundaryStopReason = "completed at command boundary" ExternalState = "external" RestartPendingState = "restart_pending" FollowupRetryDefault = "the next launch or `icebath update` retries it" )
const UpdateAvailableNoCount = -1
Behind count of a source check that knows an update exists but not how many commits it is
Variables ¶
var ( // Follow-up steps whose failure leaves the source update tail owed TailFollowups = map[string]bool{"dependencies": true, "launchers": true, "feature_dependencies": true, "maintenance": true, "profile_sync": true, "config_migration": true, "completion": true} // Follow-ups meaning the build stage did not succeed BuildFollowups = map[string]bool{"launchers": true, "feature_dependencies": true, "completion": true} )
var StableTagRE = regexp.MustCompile(`^v(?:0|[1-9]\p{Nd}{0,2})\.(?:0|[1-9]\p{Nd}*)\.(?:0|[1-9]\p{Nd}*)$`)
Stable release tag shape, a three digit major cap keeping CalVer tags out
Functions ¶
func AbandonPause ¶
Puts only an adopted orphan set back on disk unowned after this run rolled its own stops back
func AdoptPauseOrphans ¶
Claims every orphaned pause for the update command and merges their sets
func AdoptTerminalReceipt ¶
A completion child finalized this command's run so its terminal outcome becomes this scope's
func AmendTerminalFollowup ¶
Appends a follow-up that failed after finalize to the run's closed receipt
func ArmHostObligation ¶
func ArmHostObligation(ctx context.Context, marker, expectedSHA string, runtimes []any, profile, owner string) (bool, error)
Arms the host record else the per home marker, false when the debt is hidden, an error for an unserializable inventory
func BeginUpdateReceipt ¶
Starts a durably running receipt, restoring any enclosing one when it finalizes
func BindChildToUpdateTree ¶
Binds an update tree child to the kill on close job, POSIX children inherit the lock descriptor instead
func BuildVersion ¶
func BuildVersion() string
Release tag or git describe text the build stamped, empty for an unstamped build
func CheckoutHeld ¶
func CheckoutHeld() bool
Reports whether this process holds or joined the checkout lock
func CheckoutLockFiles ¶
Descriptors an update tree child inherits so the checkout stays locked while it runs, POSIX only
func CheckoutLockHeld ¶
Reports whether any process holds the checkout kernel lock, by a shared try that never blocks a holder
func CheckoutLockPath ¶
Checkout lock of an install, inside its common git dir for a checkout, the running install when empty
func ClaimPause ¶
Takes an orphaned record or a dead claimer's claim for this process, false when another launch won it
func ClearCurrentReceipt ¶
Forgets the open receipt of the context's scope the way the tests reset current
func ClearHostObligation ¶
func ClearHostObligation()
Discharges the record this install's readers judged, never failing
func CollapseUnitsToHostProcesses ¶
func CollapseUnitsToHostProcesses(units []string, mainPID func(string) (int, error)) ([]string, map[string]string)
Splits units into restarts and legacy units covered by another unit sharing their live main pid
func CommittedSuccess ¶
True when this command's run is closed and its receipt says success
func CurrentCorrelationID ¶
Update correlation id of the open receipt in this context, nil when none is open
func CustodySpawnFiles ¶
Extra files that keep a checkout mutator child in the update tree's custody, none without a held lock
func DeathSignalAttr ¶
func DeathSignalAttr() *syscall.SysProcAttr
Process attributes that kill a child with its owner thread, nil where the platform has no such signal
func DescribeHolder ¶
func DescribeHolder(holder *UpdateHolder) string
User facing explanation of who holds the update lock or why it could not be taken
func DischargePause ¶
Removes the record only while it still names this pause, decided under the mutex
func DropNeverStopped ¶
Drops entries still served by the same live incarnation that this update never asked to stop
func FinalizeInterruptedUpdateReceipt ¶
Closes a run interrupted after the commit point as interrupted
func FinalizePendingUpdateReceipt ¶
Command boundary safety net that persists a still open receipt with the exit's outcome
func FinalizeUpdateReceipt ¶
func FinalizeUpdateReceipt(ctx context.Context, outcome string, fleet []any, stopReason string) string
Finalizes and persists the open receipt exactly once, returning its archive path or empty
func FinalizedReceipt ¶
Deep copy of the terminal record this process finalized for an update id, nil when none
func FinishPause ¶
func FinishPause(ctx context.Context, token, intended, adopted map[string]any) (map[string]any, error)
Carries the recorded pause identity onto the final token and mirrors it to disk
func GatewayExitCodePath ¶
File the gateway update watcher polls for the finished update's exit status
func GetCodeIdentity ¶
Flat sha, short sha, version, source and commit date identity, re-resolved when refresh is set
func GitArgv ¶
Joins the git command and args with the custody config inserted before the subcommand
func GitCommonDir ¶
Common git dir of the checkout at root read from disk, empty when root is no checkout
func GitErrorStopClass ¶
Closed stop token for a failed git command about to end the run, nil for anything else
func GitExecutable ¶
Git the updater runs, PATH's first and then the one pm recorded or staged
func GitOutputStopClass ¶
Stop token for a git call that returned instead of raising
func GitSubcommand ¶
First non option argument after the git executable, skipping global options and their values
func HoldsCheckoutLock ¶
Reports whether this process holds or joined the checkout lock of installRoot
func HostObligationPath ¶
func HostObligationPath() string
This install's host obligation record, keyed by the normcased install root
func HostObligationPresent ¶
func HostObligationPresent() bool
True when the record file exists, parseable or not
func HostRestartAlreadyCompleted ¶
True when this host obligation already restarted onto sha
func HostStateDir ¶
func HostStateDir() string
Host state dir the gateway rendezvous resolves, computed here without importing the gateway
func IdentityLine ¶
Marker line three for pid, empty when its creation time is unreadable
func IncarnationLive ¶
Whether the process identity pid and recordedCT runs now, nil when alive but unprovable
func IsLocalMutator ¶
Reports whether args run a git subcommand that writes this machine's worktree, index or refs
func IsPauseRecordError ¶
Whether err is the pause record failure of the given kind (RecordConflict, RecordBusy, RetiredUnknown, RecordUnknown)
func JudgeMarker ¶
Verdict malformed, dead, ours or live of marker bytes with the live owner and the first run id
func LatestReceiptObject ¶
Exported readLatestReceipt keeping the ordered object
func MarkCustodyRan ¶
func MarkCustodyRan()
Records that an update child already ran in custody, so a later refusal says steps had run
func MarkHostRestartCompleted ¶
Records that the host process restarted onto sha, never failing
func MarkMove ¶
Persists this pause's move target before git writes the tree, an error meaning the move must not run
func MarkStopAccepted ¶
Receipt that this incarnation accepted the stop, beside the marker or stamped into it in place
func MarkStopConsumed ¶
func MarkStopConsumed(path string, marker *jsonutil.Object, sameHome func(left, right string) (bool, error)) error
Checkpoints a validated gateway stop consume into every matching record before its marker disappears
func MarkStopRequested ¶
func MarkStopRequested(ctx context.Context, token map[string]any, pids []int, markers map[int]string) error
Persists the intended stops and each mapped gateway's marker path before the first stop request
func MarkStopSent ¶
Persists that pid's stop request was issued, an unwritable record warning instead of failing
func MarkerMutex ¶
func MarkerMutex(ctx context.Context, path string, wait time.Duration) (context.Context, func(), error)
Holds the marker sidecar lock, reentrant along ctx, MarkerBusy after wait
func MarkerMutexPath ¶
Sidecar every marker mutation holds a kernel lock on, never deleted
func MergePauseInto ¶
Folds an orphaned pause into this update's token so one resume brings both sets back
func ObligationFields ¶
Obligation in the legacy key value field shape, nil when unarmed
func OweFollowup ¶
Records a failed post commit step on the open run, else amends the run's closed receipt
func OwnerWatch ¶
func OwnerWatch(pid int) func()
Starts the owner death watcher for a child leading its own session, nil when it cannot start
func PauseAcceptedPath ¶
Accepted receipt written beside a planned stop marker
func PauseIdentity ¶
Pid and ct line identity of a process, this process when pid is zero
func PauseIdentityIsLive ¶
Update marker incarnation rule for a recorded identity, unprovable counting as live
func PauseInstallRoot ¶
func PauseInstallRoot() string
func PauseMutex ¶
Exclusive kernel lock on the record sidecar, reentrant along ctx, RecordBusy after wait
func PauseRecordPath ¶
func PauseRecordPath() string
Paused gateway record of this install in the profile tree root home
func PersistRunningReceipt ¶
Re-asserts the open running run on disk
func ProcessCreateTime ¶
Creation time of pid in unix seconds on the clock psutil reports, the stdlib probe when that fails
func PsutilParent ¶
PsutilParent exposes the psutil parent of pid to the gateway orphan reaper
func ReadCheckoutSHA ¶
Commit of the running install re-read now, the stamp's first and the build revision second
func ReadHostObligation ¶
Published obligation record, nil when absent, corrupt or another version
func ReadLatestReceipt ¶
Most recent update receipt across the stores of this home, nil when none parses
func ReadPauseRecord ¶
Saved pause body, nil only when absent, RecordUnknown when it cannot be read or parsed
func ReadRunRecord ¶
The run's own archive path and record in the root store in key order, never latest.json
func ReceiptPayload ¶
Exported receiptPayload
func ReconcileInterruptedRuns ¶
Marks running records whose processes are gone as interrupted and returns them
func RecordBuildStage ¶
Marks the build stage failed only when a build follow-up is owed
func RecordFact ¶
Sets one top level receipt field
func RecordFollowup ¶
Prints the owed follow-up protocol line and records it on the open run
func RecordGatewayRestart ¶
func RecordGatewayRestart(ctx context.Context, g GatewayRestart)
Records the gateway restart phase outcome
func RecordPause ¶
func RecordPause(ctx context.Context, token, adopted map[string]any, claims []string) (map[string]any, error)
Merges the adopted set, stamps the tree and persists under this process before the first stop
func RecordSkip ¶
Records a skipped step with the reason it was skipped
func RecordStage ¶
Marks the end of a pipeline stage and refreshes the durable running record
func RecordStep ¶
Records one update step outcome
func RecordStopReason ¶
Names the closed stop token of the exit about to stop this run
func RecordUserAction ¶
Records a committed run's owed user action so it finalizes partial
func RecoverPauses ¶
Start of run recovery resuming every orphaned pause, the update command and a booting gateway excepted
func RefusalNotice ¶
Text the failure path prints for this run's refused update child, nil when none was refused
func ReleaseHostObligation ¶
Hands back owner's stake, restoring what the first owner found once no other run owes through it
func ReleasePauseClaims ¶
Deletes the claims a merged record now carries, a busy mutex leaving them for the redundancy sweep
func ReplaceBytes ¶
Writes data as one durable record through a fresh 0600 temp file renamed over path
func ResetCurrentReceipt ¶
Restores the receipt that was open before the current one began, the reset of its begin token
func ResetCustodyRun ¶
func ResetCustodyRun() func()
Clears the run's refused child and ran flag and returns the call that restores them
func ResetVersionInfoCache ¶
func ResetVersionInfoCache()
ResetVersionInfoCache exports resetVersionInfoCache
func ResumeReceipt ¶
Opens an existing run from its persisted data under its own identity, restoring the enclosing receipt when it finalizes
func ResumeRunRecord ¶
Carries the open run forward from its archive, returning the archive when the run is already closed
func ResumeSuspendedChild ¶
Resumes a suspended update child, POSIX children never start suspended
func RetirePauseRedundant ¶
Deletes copies of obligations another file already carries, a busy mutex skipping the sweep
func RowIsExternal ¶
Whether a fleet row serves an install this update did not touch
func SetBuildVersion ¶
func SetBuildVersion(version string)
Records the release tag or git describe text the build stamped into main.version
func SetObligationStderr ¶
Points the obligation warnings at w and returns the call that restores the previous writer
func SetPauseGatewayResumer ¶
func SetPauseGatewayResumer(resume func(ctx context.Context, token map[string]any, stdout io.Writer) error)
Installs the Windows gateway resume a recovering launch runs, called by the update command package
func SetPlannedStopProbe ¶
func SetPlannedStopProbe(probe PlannedStopProbe)
Installs the gateway planned stop marker rules, called by the gateway package
func SetRuntimeHostMatcher ¶
Installs the command line test naming a long lived icebath host, called by pkg/selfupdate
func SplitDraining ¶
Removes and returns the profiles, unmapped and supervised entries whose process is still draining
func StampTree ¶
Adds this pause's tree baseline once per pause id beside the baselines of absorbed pauses
func SyncPause ¶
Mirrors the token after a resume attempt, deleting a finished record and rewriting an owed one
func TornByMove ¶
func TornByMove(ctx context.Context, root string, found map[string]any, changes []string, changesKnown bool) ([]string, bool, error)
Paths a move from found's HEAD wrote that lack the current commit's bytes, false when git cannot say
func TrackedChanges ¶
Sorted tracked paths differing from HEAD in index or worktree, false when git cannot say
func TreeIsWhole ¶
Whether paused gateways may start on this checkout now, with the reason when not
func TreeState ¶
HEAD, the tracked changes and their digests now, nil when root is not a git checkout
func UpdateInProgress ¶
Reports whether an update owns the install, by a live marker or a held checkout lock
func UpdateMarkerPath ¶
func UpdateMarkerPath() string
Shared update marker in the profile tree root home every update owner watches
func UpdateReceiptScope ¶
Context with no open receipt and a fresh terminal cell, keeping the command guard off an enclosing update
func WriteGatewayUpdateExitCode ¶
Publishes 0 or 1 atomically for the gateway watcher, a run already committed as success never reads failed
Types ¶
type CustodyRefused ¶
type CustodyRefused struct{ Reason string }
Windows refused to bind an update child to the update job so the child never ran
func RefuseCustodyChild ¶
func RefuseCustodyChild(ctx context.Context, argv []string, cause any, receipted bool) *CustodyRefused
Refusal for argv, logged and receipted unless the caller already did, kept as this run's first refusal
func (*CustodyRefused) Error ¶
func (e *CustodyRefused) Error() string
type GatewayRestart ¶
type GatewayRestart struct {
RestartedServices []string
RelaunchedProfiles []string
ExternallySupervisedProfiles []string
KilledPIDs []int
FailedUnits []string
Incomplete bool
PhaseError string
FreshRecovery map[string]any
}
Gateway restart phase outcome, FreshRecovery nil when the fresh recovery pass did not run
type GitTimeout ¶
Git child that outlived its timeout and was killed with its tree
func (*GitTimeout) Error ¶
func (e *GitTimeout) Error() string
type KeyErrorText ¶
type KeyErrorText struct{ Key string }
Failure naming a missing mapping key
func (*KeyErrorText) Error ¶
func (e *KeyErrorText) Error() string
type MarkerBusy ¶
type MarkerBusy struct{ Path string }
func (*MarkerBusy) Error ¶
func (e *MarkerBusy) Error() string
type PauseRecordError ¶
Pause record failure that callers treat as Python's OSError family
func (*PauseRecordError) Error ¶
func (e *PauseRecordError) Error() string
func (*PauseRecordError) OSError ¶
func (e *PauseRecordError) OSError() bool
Marks the error as an OSError subclass for callers that catch that family
type PlannedStopProbe ¶
type PlannedStopProbe struct {
TTL int
IsStale func(writtenAt any, ttl int) bool
StartTime func(pid int) any
}
PlannedStopProbe carries the gateway status rules a stop request is judged by
type ProfileHome ¶
ProfileHome pairs a profile name with its home directory
func ProfileHomes ¶
func ProfileHomes() ([]ProfileHome, error)
Default home plus every valid named profile dir in name order, an error when the profiles root is unreadable
type StampError ¶
type StampError struct{ Msg string }
RuntimeError a malformed install stamp raises
func (*StampError) Error ¶
func (e *StampError) Error() string
type UpdateHolder ¶
func AcquireCheckout ¶
func AcquireCheckout(installRoot string) (*UpdateHolder, error)
AcquireCheckout exports acquireCheckout
func LegacyProfileClaims ¶
func LegacyProfileClaims(root string) []UpdateHolder
Live claims in pre root marker files under root/profiles, read only and in directory order
func ReadLiveUpdate ¶
func ReadLiveUpdate(ctx context.Context, path, installRoot string) (holder *UpdateHolder)
Live update holding the marker, a held holder while the checkout lock outlives a dead claim, nil when clear
type UpdateLock ¶
type UpdateLock struct {
Path string
InstallRoot string
CheckoutFirst bool
Acquired bool
Holder *UpdateHolder
// contains filtered or unexported fields
}
func NewUpdateLock ¶
func NewUpdateLock(path, installRoot string, checkoutFirst bool) *UpdateLock
Update lock over the shared marker, path empty for the root marker, installRoot empty for this install
func (*UpdateLock) Acquire ¶
func (l *UpdateLock) Acquire(ctx context.Context) (bool, error)
Takes the checkout lock when asked, then claims or adopts the marker, false with Holder set when refused
func (*UpdateLock) AcquireCheckout ¶
func (l *UpdateLock) AcquireCheckout(installRoot string) (bool, error)
Takes or joins the checkout lock a caller mutates the install under
func (*UpdateLock) Release ¶
func (l *UpdateLock) Release(ctx context.Context)
Gives back this incarnation's part of the claim under the marker mutex, only the outermost claim releasing
type UpdateReceipt ¶
type UpdateReceipt struct {
Data *jsonutil.Object
CorrelationID string
// contains filtered or unexported fields
}
Observable facts of one icebath update run
func CurrentReceipt ¶
func CurrentReceipt(ctx context.Context) *UpdateReceipt
Open receipt of the context's scope, nil when none has begun
func NewUpdateReceipt ¶
func NewUpdateReceipt() *UpdateReceipt
Fresh running receipt carrying argv, pid, pre update identity and a new correlation id
func (*UpdateReceipt) Fact ¶
func (r *UpdateReceipt) Fact(key string, value any) error
Sets one top level field
func (*UpdateReceipt) Finalize ¶
func (r *UpdateReceipt) Finalize(outcome string)
Closes the receipt, partial when a committed run still owes a user action
func (*UpdateReceipt) Followup ¶
func (r *UpdateReceipt) Followup(step, reason string) error
Records a post commit step the run still owes
func (*UpdateReceipt) GatewayRestartResult ¶
func (r *UpdateReceipt) GatewayRestartResult(g GatewayRestart) error
Records the gateway restart phase with the conservative fresh recovery buckets
func (*UpdateReceipt) Skip ¶
func (r *UpdateReceipt) Skip(name, reason string) error
Records a skipped step with its reason
type VersionInfo ¶
type VersionInfo struct {
BaseVersion string
DerivedVersion string
Distance *int64
Commit *string
Branch *string
Source string
Dirty bool
CommitDate *int64
Distribution *string
}
func GetVersionInfo ¶
func GetVersionInfo() (VersionInfo, error)
Cached provenance from the install stamp, then the build identity, then unknown
func GitVersionInfo ¶
func GitVersionInfo(repoDir string, includeUntracked bool) VersionInfo
Identity of a checkout read from git itself, a status over three seconds reading as clean
Source Files
¶
- custody_run.go
- custody_run_export.go
- custody_run_linux.go
- custody_run_unix.go
- exit_code.go
- lock.go
- lock_claim.go
- lock_claim_unix.go
- lock_probe_unix.go
- lock_ticks_linux.go
- log.go
- obligation.go
- obligation_stderr_export.go
- pause.go
- pause_record.go
- pause_tree.go
- profile_homes.go
- receipt.go
- receipt_reset.go
- receipt_resume.go
- update_status.go
- version.go
- version_git.go