Expand description
Atomic write helpers (create-tempfile-then-rename) for projection files.
Functions§
- open_
events_ append - Open
events.jsonlforO_APPENDwrites (creating it if absent). - write_
atomic - Write
bytestopathatomically: tempfile in the same directory, then rename, then a parent-directoryfsync. The tempfile isfsynced before the rename. Creates the parent directory if absent. - write_
atomic_ no_ create - Like
write_atomicbut does NOT create the parent directory: if the parent is absent the write fails with the underlyingNotFounderror instead of resurrecting it. Used for writes that must never recreate a directory deleted out from under the writer — e.g. the supervisor’s per-tick state save once its run dir has vanished (otherwise thecreate_dir_allwould rebuild the run dir ghost-file by ghost-file). - write_
json_ atomic - JSON-pretty-serialize
valueand atomically write topath. - write_
json_ atomic_ no_ create - Like
write_json_atomicbut does NOT create the parent directory. Seewrite_atomic_no_create.