pub struct Checkpoint<S> {
pub id: String,
pub state: S,
pub uuid: Uuid,
pub hash: Hash32,
pub entries_processed: usize,
pub context: FoldContext,
pub fold_version: usize,
pub created_at: DateTime<Utc>,
}Expand description
Generic checkpoint envelope wrapping an arbitrary fold state snapshot.
Carries metadata (ID, timestamp, hash, fold version) alongside the serializable state so consumers can verify and load the correct snapshot.
Fields§
§id: StringHuman-readable checkpoint identifier (e.g. "hnsw_idx:ckpt-1").
state: SThe snapshot state captured at this checkpoint.
uuid: UuidUnique identifier for this checkpoint instance.
hash: Hash32BLAKE3 content hash of the canonical JSON serialization of state.
Computed by CheckpointStore::save and verified by
CheckpointStore::load. A mismatch returns
FoldError::IntegrityMismatch.
entries_processed: usizeNumber of entries processed when this checkpoint was taken.
context: FoldContextFold context at checkpoint time.
fold_version: usizeMonotonically increasing fold schema version.
created_at: DateTime<Utc>Wall-clock time when this checkpoint was created.
Implementations§
Source§impl<S: Serialize> Checkpoint<S>
impl<S: Serialize> Checkpoint<S>
Sourcepub fn new(
id: impl Into<String>,
state: S,
uuid: Uuid,
entries_processed: usize,
context: FoldContext,
fold_version: usize,
) -> Result<Self, FoldError>
pub fn new( id: impl Into<String>, state: S, uuid: Uuid, entries_processed: usize, context: FoldContext, fold_version: usize, ) -> Result<Self, FoldError>
Create a new checkpoint, computing the BLAKE3 hash of the state.
Returns FoldError::Serialization if state cannot be serialized to JSON.
Sourcepub fn with_hash(
id: impl Into<String>,
state: S,
uuid: Uuid,
hash: Hash32,
entries_processed: usize,
context: FoldContext,
fold_version: usize,
) -> Self
pub fn with_hash( id: impl Into<String>, state: S, uuid: Uuid, hash: Hash32, entries_processed: usize, context: FoldContext, fold_version: usize, ) -> Self
Create a checkpoint with a pre-computed hash (for deserialization / testing).
Callers are responsible for ensuring hash is consistent with state.
Prefer Checkpoint::new for production use.
Trait Implementations§
Source§impl<S: Clone> Clone for Checkpoint<S>
impl<S: Clone> Clone for Checkpoint<S>
Source§fn clone(&self) -> Checkpoint<S>
fn clone(&self) -> Checkpoint<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more