pub struct PendingSnapshot<'a> { /* private fields */ }Expand description
A snapshot being written, not yet part of the catalog.
Firecracker writes into Self::dir, a staging directory that is
deliberately outside the catalog’s namespace, and Self::commit writes
meta.json there and renames the whole directory into place. That single
atomic publish is what lets every reader assume a catalogued directory has
a readable record: a snapshot is either complete or not there at all.
Dropping without committing removes the staging directory, so a failed
checkpoint leaves neither a record-less entry nor a partial vmstate/mem
behind. A crash leaves the staging directory, which
SnapshotCatalog::sweep_incomplete reclaims on the next start.
Implementations§
Source§impl PendingSnapshot<'_>
impl PendingSnapshot<'_>
Sourcepub fn commit(self, draft: SnapshotDraft) -> Result<SnapshotMeta, SnapshotError>
pub fn commit(self, draft: SnapshotDraft) -> Result<SnapshotMeta, SnapshotError>
Publish the snapshot: write the record, then rename it into the catalog.
The mem file is recorded when the staging directory actually holds one
(diff snapshots and jailer moves may not produce it).