Skip to main content

Module persistence

Module persistence 

Source
Expand description

On-disk JSON store substrate: atomic writes and corruption quarantine.

Every persisted store in the kernel routes through these helpers so the two invariants hold everywhere: writes are atomic for readers (a crash mid-write cannot leave a half-written file), and an unreadable file is quarantined rather than silently reset or skipped.

Enums§

StoreError
Errors raised by the JSON-on-disk store helpers.

Functions§

quarantine
Rename a corrupt file to a sibling <name>.corrupt-<pid>-<epoch-millis>-<n> and return the new path. The low-level primitive beneath read_json; it returns a bare io::Result and leaves the original path free for a fresh default to take.
read_json
Read and decode JSON from path.
write_atomic
Write bytes to path atomically.
write_json_atomic
Serialize value as pretty-printed JSON and write it atomically to path.