Skip to main content

IndexedCheckpoint

Struct IndexedCheckpoint 

Source
#[non_exhaustive]
pub struct IndexedCheckpoint { pub schema_version: SchemaVersion, 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 the crate::index::Plan the checkpoint was produced against, computed via crate::index::Plan::crc32. crate::index::IndexApplier::resume_execute re-computes the CRC at resume time and warns-and-restarts on mismatch (same precedent as the sequential resume’s patch_name / patch_size check).
  • 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 within next_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_donetrue once every crate::index::FilesystemOp in crate::index::Plan::fs_ops has been applied. A resume that sees this true skips the fs_ops pass; otherwise it re-runs every op (each op is idempotent w.r.t. the install state the prior partial run would have left behind).

#[non_exhaustive]: schema already bumped once (added plan_crc32 / fs_ops_done); further resume-protocol fields are expected.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§schema_version: SchemaVersion

Layout version of this checkpoint struct. See Self::CURRENT_SCHEMA_VERSION.

§plan_crc32: u32

CRC32 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: bool

true once every crate::index::FilesystemOp in crate::index::Plan::fs_ops has been applied.

§next_target_idx: u64

Index of the next target to apply. Equal to the number of targets fully written at this checkpoint.

§next_region_idx: u64

Index of the next region within next_target_idx’s timeline.

§bytes_written: u64

Cumulative bytes written across all targets and regions completed.

Implementations§

Source§

impl IndexedCheckpoint

Source

pub const CURRENT_SCHEMA_VERSION: SchemaVersion

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.

Source

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

Source§

fn clone(&self) -> IndexedCheckpoint

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IndexedCheckpoint

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for IndexedCheckpoint

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for IndexedCheckpoint

Source§

fn eq(&self, other: &IndexedCheckpoint) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for IndexedCheckpoint

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for IndexedCheckpoint

Source§

impl StructuralPartialEq for IndexedCheckpoint

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,