Skip to main content

write_atomic

Function write_atomic 

Source
pub fn write_atomic(path: &Path, bytes: &[u8]) -> Result<(), Error>
Expand description

Write bytes to path so that a reader, or a crash, sees either the old file or the new one, never a part: write a temporary file (.<name>.<pid>.<random>.tmp) in the same folder, flush it to disk, rename it over path, then flush the folder (Unix; a folder that can’t be flushed, such as some network mounts, is logged at debug and ignored). For DRE’s durable state (run_results.json, the drift snapshot, the manifest, dre.lock, sessions), not report outputs.