#[non_exhaustive]pub struct IndexedCheckpoint {
pub schema_version: u32,
pub plan_crc32: u32,
pub fs_ops_done: bool,
pub next_target_idx: u64,
pub next_region_idx: u64,
pub bytes_written: u64,
}Expand description
Indexed-apply checkpoint payload.
Emitted by the crate::index::IndexApplier::execute driver at the same
per-target / per-64-regions cadence as the existing cancellation poll.
plan_crc32— identity of thecrate::index::Planthe checkpoint was produced against, computed viacrate::index::Plan::crc32.crate::index::IndexApplier::resume_executere-computes the CRC at resume time and warns-and-restarts on mismatch (same precedent as the sequential resume’spatch_name/patch_sizecheck).next_target_idx— zero-based index of the next target the driver will write into. Equal to the count of fully-written targets.next_region_idx— zero-based index of the next region withinnext_target_idx’s timeline. Zero at the target boundary; advances by 64 for each mid-target poll.bytes_written— cumulative bytes written across all targets and regions completed so far. Mirrors the same counter the indexed driver carries internally.fs_ops_done—trueonce everycrate::index::FilesystemOpincrate::index::Plan::fs_opshas been applied. A resume that sees thistrueskips thefs_opspass; otherwise it re-runs every op (each op is idempotent w.r.t. the install state the prior partial run would have left behind).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.schema_version: u32Layout version of this checkpoint struct. See Self::CURRENT_SCHEMA_VERSION.
plan_crc32: u32CRC32 of the crate::index::Plan this checkpoint was produced
against. See crate::index::Plan::crc32.
0 is a legitimate CRC32 output — the hash space is uniform over
u32 and a real plan can hash to zero. Consumers must represent
“no checkpoint yet” via Option<IndexedCheckpoint> (i.e. pass
None to crate::index::IndexApplier::resume_execute); a
sentinel plan_crc32: 0 would collide with that legitimate output
and either trigger a spurious warn-and-restart against a plan that
happens to hash to zero, or silently accept a stale checkpoint
from a plan that does.
fs_ops_done: booltrue once every crate::index::FilesystemOp in
crate::index::Plan::fs_ops has been applied.
next_target_idx: u64Index of the next target to apply. Equal to the number of targets fully written at this checkpoint.
next_region_idx: u64Index of the next region within next_target_idx’s timeline.
bytes_written: u64Cumulative bytes written across all targets and regions completed.
Implementations§
Source§impl IndexedCheckpoint
impl IndexedCheckpoint
Sourcepub const CURRENT_SCHEMA_VERSION: u32 = 2
pub const CURRENT_SCHEMA_VERSION: u32 = 2
Current schema-version constant for IndexedCheckpoint.
Bumped to 2 alongside the addition of plan_crc32 and
fs_ops_done; a 1-vintage persisted checkpoint will fail
check_schema_version-style validation at resume time.
Sourcepub fn new(
plan_crc32: u32,
fs_ops_done: bool,
next_target_idx: u64,
next_region_idx: u64,
bytes_written: u64,
) -> Self
pub fn new( plan_crc32: u32, fs_ops_done: bool, next_target_idx: u64, next_region_idx: u64, bytes_written: u64, ) -> Self
Construct an IndexedCheckpoint with the given fields.
Exists because the struct is #[non_exhaustive], which forbids
external code from using the struct-literal syntax. Consumers
hand-rolling a synthetic checkpoint (typically in tests, or when
migrating a persisted checkpoint from an older schema) construct
one via this method instead.
§Notes
Permissive by design: any combination of fields is accepted,
including pairings the indexed driver would never emit (e.g.
fs_ops_done: false with next_target_idx > 0).
crate::index::IndexApplier::resume_execute re-validates the
checkpoint’s plan_crc32 against the plan it is handed, and
re-runs every step that has not been confirmed durable; a
contradictory checkpoint either matches a re-derivable resume
state or triggers the warn-and-restart path on CRC mismatch.
Trait Implementations§
Source§impl Clone for IndexedCheckpoint
impl Clone for IndexedCheckpoint
Source§fn clone(&self) -> IndexedCheckpoint
fn clone(&self) -> IndexedCheckpoint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IndexedCheckpoint
impl Debug for IndexedCheckpoint
Source§impl PartialEq for IndexedCheckpoint
impl PartialEq for IndexedCheckpoint
Source§fn eq(&self, other: &IndexedCheckpoint) -> bool
fn eq(&self, other: &IndexedCheckpoint) -> bool
self and other values to be equal, and is used by ==.