Skip to main content

SequentialCheckpoint

Struct SequentialCheckpoint 

Source
#[non_exhaustive]
pub struct SequentialCheckpoint { pub schema_version: SchemaVersion, pub next_chunk_index: u64, pub bytes_read: u64, pub patch_name: Option<String>, pub patch_size: Option<u64>, pub in_flight: Option<InFlightAddFile>, }
Expand description

Sequential-apply checkpoint payload.

Captures “how far into the patch stream the driver has gotten” using two independent measures so a resume can pick the right one:

  • next_chunk_index — the zero-based index of the next chunk the driver is about to apply. Equal to the count of chunks that have been fully applied.
  • bytes_read — the cumulative byte offset within the patch stream the driver has read up to. Equivalent to the crate::ChunkEvent::bytes_read field at the same emission point.

in_flight is Some only between DEFLATE block boundaries inside an SqpkFile::AddFile; per-chunk emissions carry None. Resuming a sequential apply that crashed mid-AddFile picks up at in_flight.block_idx, seeking to in_flight.bytes_into_target within the target file before resuming the chunk’s block loop.

#[non_exhaustive]: the resume protocol has already grown one field (patch_size) post-1.0; expect more (e.g. elapsed_ms, chunk_crc32).

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.

§next_chunk_index: u64

Index of the next chunk to apply. Equal to the number of chunks that have been fully applied as of this checkpoint.

§bytes_read: u64

Cumulative byte offset within the patch stream the driver has read.

Informational metadata. Resume is positional on next_chunk_index, not on this counter: the fast-forward re-parses next_chunk_index chunks and surfaces a warn! (but does not error) if the resulting bytes_read differs from the value recorded here.

§patch_name: Option<String>

Identifier the driver was told to associate with the patch source — typically the patch filename. None when no identifier was supplied via crate::ZiPatchReader::with_patch_name. Used at resume time to detect a checkpoint that was persisted for a different patch.

§patch_size: Option<u64>

Total byte length of the patch stream, when the driver could measure it (i.e. the underlying reader is std::io::Seek). None for the sequential apply_patch path which only requires std::io::Read; populated by resume_apply_patch. Used together with patch_name to detect a checkpoint persisted for a patch that has since been replaced.

None means the recording driver did not know the size (e.g. checkpoints captured via crate::ApplyConfig::apply_patch with a Read-only source); the resume path will not use it for stale detection in that case — the patch_name check alone governs. Stale-detection mismatch only fires when both the checkpoint and the resume side carry a Some and the two values disagree.

§in_flight: Option<InFlightAddFile>

Mid-chunk state for an in-flight [crate::chunk::sqpk::SqpkFile] AddFile. Present only at per-block emissions; None at per-chunk emissions.

Implementations§

Source§

impl SequentialCheckpoint

Source

pub const CURRENT_SCHEMA_VERSION: SchemaVersion

Current schema-version constant for SequentialCheckpoint.

Source

pub fn new( next_chunk_index: u64, bytes_read: u64, patch_name: Option<String>, patch_size: Option<u64>, in_flight: Option<InFlightAddFile>, ) -> Self

Construct a SequentialCheckpoint 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

The constructor is intentionally permissive: it accepts any combination of fields, including pairings the apply driver itself would never emit. Resume re-validates against the patch stream and the on-disk state before honouring a checkpoint, so contradictory inputs are detected at resume time and either trigger a warn-and-restart (stale-detection paths) or surface as a typed error — never silent corruption.

Source

pub fn with_in_flight(self, in_flight: Option<InFlightAddFile>) -> Self

Return a clone of self with in_flight overwritten.

Convenience for resume tests / persistence-layer code that needs to splice an in-flight payload into an otherwise-untouched chunk-boundary checkpoint without re-naming every field.

§Notes

Like Self::new, this is permissive — any InFlightAddFile payload is accepted regardless of whether it pairs sensibly with the chunk index or byte offset on self. Resume re-validates before acting on the in-flight state, so a mismatch surfaces as a warn-and-restart rather than silent corruption.

Trait Implementations§

Source§

impl Clone for SequentialCheckpoint

Source§

fn clone(&self) -> SequentialCheckpoint

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 SequentialCheckpoint

Source§

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

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

impl<'de> Deserialize<'de> for SequentialCheckpoint

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 SequentialCheckpoint

Source§

fn eq(&self, other: &SequentialCheckpoint) -> 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 SequentialCheckpoint

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 SequentialCheckpoint

Source§

impl StructuralPartialEq for SequentialCheckpoint

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>,