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, accounts.json, and theme.css 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_atomic ๐Ÿ”’
Writes 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.
write_json_atomic ๐Ÿ”’
Writes pretty-printed JSON with write_atomic.