physical.readStatefunctionno test imports itfunction readState(file: string): Promise<BootState>The state in a file (the empty state where there is no file or it is not readable as state).
The state of the boot server kept in a file, so that an arming survives the server and a person can arm a host while the server runs. A write is a new file moved over the old one, so that a reader never sees half of it.
import { readState } from "./state.ts";
// (await readState("/var/lib/netboot/state.json")).armedphysical.readStatefunctionno test imports itfunction readState(file: string): Promise<BootState>The state in a file (the empty state where there is no file or it is not readable as state).
physical.writeStatefunctionno test imports itfunction writeState(file: string, state: BootState): Promise<void>Writes the state, replacing the file whole.
physical.updateStatefunctionno test imports itfunction updateState<T>(file: string, f: (s: BootState) => { readonly state: BootState; readonly value: T; }): Promise<T>Reads the state, changes it with f and writes it back, one change at a time.
readStatefunctionfunction readState(file: string): Promise<BootState>The state in a file (the empty state where there is no file or it is not readable as state).
writeStatefunctionno test imports itfunction writeState(file: string, state: BootState): Promise<void>Writes the state, replacing the file whole.
updateStatefunctionfunction updateState<T>(file: string, f: (s: BootState) => { readonly state: BootState; readonly value: T; }): Promise<T>Reads the state, changes it with f and writes it back, one change at a time.