Skip to main content

write_snapshot

Function write_snapshot 

Source
pub fn write_snapshot(
    dir: &Path,
    manifest: &SnapshotManifest,
    saved_state_bytes: &[u8],
    memory_file_path: &Path,
) -> Result<()>
Expand description

Write a snapshot to the given directory.

The directory must not exist; it is created by this call, along with any missing parent directories. The snapshot consists of:

  • manifest.bin — protobuf-encoded SnapshotManifest
  • state.bin — raw device saved-state bytes
  • memory.bin — hard link to the memory backing file

state.bin and memory.bin are written first and manifest.bin last, each flushed to disk, so the presence of manifest.bin indicates that the snapshot was written completely. On failure, the directory and the files created by this call are removed.