Expand description
The machine id file: where the daemon’s MachineId lives on disk, how the
daemon mints it once, and how an operator replaces it.
The file is <data home>/cortexkit/machine-id, one line of 32 lowercase hex
characters. The daemon reads it at startup, before it accepts a connection,
and mints it only when it is absent. It never rewrites a present file: a file
that does not parse stops the daemon with MachineIdFileError::Corrupt,
because silently replacing a corrupt identity would hand every module a new
name for the same machine. Only ck machine adopt replaces the value, and it
takes effect at the next daemon start.
See MachineId for the rule every holder of the value must follow: it is a
name, never an authority.
Structs§
- Machine
Id - This machine’s name, minted once by the daemon and served to every module
that registers with it (on
HELLO_ACKandserver.describe).
Enums§
- Machine
IdError - Why a string is not a machine id.
- Machine
IdFile Error - Why the daemon could not establish its machine id.
Constants§
- MACHINE_
ID_ FILE_ NAME - File name of the machine id under
<data home>/cortexkit/.
Functions§
- default_
machine_ id_ path - Resolve
<data home>/cortexkit/machine-idfrom the same data home the daemon uses for storage. - load_
or_ mint - Read the machine id at
path, minting and writing a fresh one when the file is absent. A present file is only ever read, never rewritten. - read
- Read and validate the machine id at
path.Ok(None)means the file does not exist; any other read failure, or content that is not exactly 32 lowercase hex characters (one trailing newline allowed), is an error. - write
- Write
idtopaththrough a temporary file in the same directory and a rename, so a reader sees either the old file or the complete new one.