Skip to main content

register_in

Function register_in 

Source
pub fn register_in(
    cache_dir: &Path,
    project_root: &Path,
    phase: PhaseId,
) -> Result<(), RegistryError>
Expand description

Register (project_root, phase) into the machine-global registry under cache_dir. Pure with respect to env. Creates the cache directory and the roots directory if absent (both private, mode 0o700 — T-23-33) and writes only this registration’s own file, atomically — there is no load step, no merge step, and no rewrite of any other entry. Re-registering the same pair simply overwrites its own file with a fresh registered_at.

Atomicity here protects against a torn READ of one entry (two concurrent registrations of the SAME pair both complete and load_roots_in sees exactly one, valid file). It is not the mitigation for a lost update — the per-file shape has no read-modify-write step to lose one in, so two concurrent registrations of DIFFERENT pairs both survive by construction, not by locking.