pe-graph 0.1.0

Graph execution engine for Potential Expectations — state graphs, Pregel model, ReAct topology, and builder DSL
Documentation
//! Checkpoint serialization wrapper.
//!
//! Captures everything needed to resume graph execution from a checkpoint:
//! the full state, which nodes run next, which superstep we're at, and
//! any interrupt/phase metadata needed for durable resume.

use pe_core::phase_store::PhaseStateStore;
use pe_core::state::State;
use serde::{Deserialize, Serialize};

/// Internal wrapper for checkpoint serialization.
///
/// Bincode-serialized into the opaque bytes stored by [`Checkpointer`](crate::checkpointer::Checkpointer).
/// The checkpointer sees bytes; this struct gives them meaning.
#[derive(Serialize, Deserialize)]
#[serde(bound = "")]
pub struct CheckpointData<S: State> {
    /// Full state at the checkpoint.
    pub state: S,
    /// Which nodes are scheduled to run next.
    pub next_nodes: Vec<String>,
    /// Which superstep this checkpoint was taken at.
    pub step: u32,
    /// Which node was interrupted (if this checkpoint is from an interrupt).
    /// Used by `resume()` to validate the resume target.
    #[serde(default)]
    pub interrupted_node: Option<String>,
    /// Serialized phase state for nodes using the interrupt/phase system.
    /// Survives checkpoint serialization so phases resume correctly.
    #[serde(default)]
    pub phase_state: PhaseStateStore,
    /// The checkpoint ID this data was loaded from (for parent lineage).
    /// Not serialized — set by the loading code.
    #[serde(skip)]
    pub checkpoint_id: Option<String>,
}