Skip to content

domain/updates/boot-guard

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.

new BootGuard(store, maxAttempts?): BootGuard

Defined in: app/src/domain/updates/boot-guard.ts:47

BootStateStore

Where the state lives.

number = 2

Failed starts before a rollback.

BootGuard

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.

string

The running version.

BootDecision

blockedVersions(): readonly string[]

Defined in: app/src/domain/updates/boot-guard.ts:96

Versions that failed to start and must not be installed again.

readonly string[]

markHealthy(version): void

Defined in: app/src/domain/updates/boot-guard.ts:88

Marks the running version as healthy, which ends the trial.

string

The running version.

void

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.

string

The running version.

string

The version being installed.

void

Defined in: app/src/domain/updates/boot-guard.ts:4

What the boot guard remembers between starts, in boot-state.json.

readonly blocked: readonly string[]

Defined in: app/src/domain/updates/boot-guard.ts:13

Versions that failed to start; they are never installed again.

readonly optional pending?: object

Defined in: app/src/domain/updates/boot-guard.ts:6

An installed update that has not proven itself yet.

readonly attempts: number

Starts of the new version so far.

readonly previous: string

readonly version: string


Defined in: app/src/domain/updates/boot-guard.ts:17

Reads and writes the boot state.

read(): BootState

Defined in: app/src/domain/updates/boot-guard.ts:19

Returns the stored state, or an empty state when none is stored.

BootState

write(state): void

Defined in: app/src/domain/updates/boot-guard.ts:24

Replaces the stored state.

BootState

The new state.

void

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.

const BootGuardToken: Token<BootGuard>

Defined in: app/src/domain/updates/boot-guard.ts:102

Token for the BootGuard.