Skip to main content

Module storage

Module storage 

Source
Expand description

Validated, atomic JSON persistence serialized by one application state.

Structs§

Storage
Reads and writes settings.json and accounts.json in the data folder.

Enums§

StorageError
Why local data couldn’t be read or written.

Statics§

TEMP_SEQUENCE 🔒
Distinguishes temporary files written concurrently by this process.

Functions§

read_json 🔒
Parses a JSON file.
replace_file 🔒
Replaces to with from in one step, flushing the move to disk.
sync_directory 🔒
Does nothing; this platform doesn’t need directory flushes.
validate_accounts 🔒
Validates each account and rejects duplicate IDs.
write_json_atomic 🔒
Writes JSON to a temporary file, flushes it, and moves it over path, so a crash leaves either the old or the new file. On Unix the file is readable only by its owner.