Skip to main content

Module persist

Module persist 

Source
Expand description

Shared atomic-write primitives.

Several modules (config, app/sys/task manifests, ssh transfer, workspace env files, self-install) each hand-rolled their own “write to a temp file, then rename over the destination” sequence. This module is the single place that logic lives.

Functions§

atomic_write
Durably writes contents to path.
finalize_temp
Renames temp over dest, for callers that already wrote/streamed their own temp file (e.g. large-file copies) and only need the finalize step.
load_toml_or_default
Loads and parses a TOML file at path, or returns T::default() if it doesn’t exist yet. what is a human-readable label used in error messages (e.g. "app manifest").
save_toml_atomic
Serializes value as pretty TOML and atomically writes it to path. what is a human-readable label used in error messages.