Skip to main content

save

Function save 

Source
pub fn save(path: &Path, checkpoint: &Checkpoint) -> Result<()>
Expand description

Writes a checkpoint durably.

The JSON is written to a temporary file that is fsynced, renamed over the checkpoint and followed by an fsync of the directory, so after a power cut the file holds either the old or the new checkpoint, never an empty one.

ยงErrors

Returns an error if the directory cannot be created or any write, sync or rename fails.