domain/updates/boot-guard
Classes
Section titled “Classes”BootGuard
Section titled “BootGuard”Defined in: app/src/domain/updates/boot-guard.ts:39
Rolls back an update that keeps failing to start. The working version records the update before it installs it; the new version counts its starts from its first lines and clears the record once it is healthy. When the new version has failed its allowed starts, the guard asks for the previous version and blocks the failed one.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BootGuard(
store,maxAttempts?):BootGuard
Defined in: app/src/domain/updates/boot-guard.ts:47
Parameters
Section titled “Parameters”Where the state lives.
maxAttempts?
Section titled “maxAttempts?”number = 2
Failed starts before a rollback.
Returns
Section titled “Returns”Methods
Section titled “Methods”beginBoot()
Section titled “beginBoot()”beginBoot(
version):BootDecision
Defined in: app/src/domain/updates/boot-guard.ts:66
Decides how this start proceeds. Called first thing in the main process.
Parameters
Section titled “Parameters”version
Section titled “version”string
The running version.
Returns
Section titled “Returns”blockedVersions()
Section titled “blockedVersions()”blockedVersions(): readonly
string[]
Defined in: app/src/domain/updates/boot-guard.ts:96
Versions that failed to start and must not be installed again.
Returns
Section titled “Returns”readonly string[]
markHealthy()
Section titled “markHealthy()”markHealthy(
version):void
Defined in: app/src/domain/updates/boot-guard.ts:88
Marks the running version as healthy, which ends the trial.
Parameters
Section titled “Parameters”version
Section titled “version”string
The running version.
Returns
Section titled “Returns”void
prepareUpdate()
Section titled “prepareUpdate()”prepareUpdate(
from,to):void
Defined in: app/src/domain/updates/boot-guard.ts:57
Records an update that is about to be installed. Called by the working version.
Parameters
Section titled “Parameters”string
The running version.
string
The version being installed.
Returns
Section titled “Returns”void
Interfaces
Section titled “Interfaces”BootState
Section titled “BootState”Defined in: app/src/domain/updates/boot-guard.ts:4
What the boot guard remembers between starts, in boot-state.json.
Properties
Section titled “Properties”blocked
Section titled “blocked”
readonlyblocked: readonlystring[]
Defined in: app/src/domain/updates/boot-guard.ts:13
Versions that failed to start; they are never installed again.
pending?
Section titled “pending?”
readonlyoptionalpending?:object
Defined in: app/src/domain/updates/boot-guard.ts:6
An installed update that has not proven itself yet.
attempts
Section titled “attempts”
readonlyattempts:number
Starts of the new version so far.
previous
Section titled “previous”
readonlyprevious:string
version
Section titled “version”
readonlyversion:string
BootStateStore
Section titled “BootStateStore”Defined in: app/src/domain/updates/boot-guard.ts:17
Reads and writes the boot state.
Methods
Section titled “Methods”read()
Section titled “read()”read():
BootState
Defined in: app/src/domain/updates/boot-guard.ts:19
Returns the stored state, or an empty state when none is stored.
Returns
Section titled “Returns”write()
Section titled “write()”write(
state):void
Defined in: app/src/domain/updates/boot-guard.ts:24
Replaces the stored state.
Parameters
Section titled “Parameters”The new state.
Returns
Section titled “Returns”void
Type Aliases
Section titled “Type Aliases”BootDecision
Section titled “BootDecision”BootDecision = {
kind:"normal"; } | {attempt:number;kind:"trial"; } | {failed:string;kind:"rollback";previous:string; }
Defined in: app/src/domain/updates/boot-guard.ts:28
What the browser does at this start.
Variables
Section titled “Variables”BootGuardToken
Section titled “BootGuardToken”Defined in: app/src/domain/updates/boot-guard.ts:102
Token for the BootGuard.