Skip to main content

Module store

Module store 

Source
Expand description

The device store: one JSON file, written atomically and only when a device record changes, batched so a burst of changes is one write.

Structs§

Dirty
Wakes the writer when devices change.

Enums§

StoreError
Store errors.

Constants§

STORE_VERSION
The store file’s format version.
WRITE_DELAY
How long changes are gathered before one write.

Functions§

load
Load devices from path; a missing file is an empty store.
serialize
Serialize devices for the store file.
write_atomic
Write contents to path atomically: a temporary file in the same directory, synced, then renamed over the old one. On Unix the file is readable by its owner only, since backups hold the network key.