pe_graph/checkpoint_data.rs
1//! Checkpoint serialization wrapper.
2//!
3//! Captures everything needed to resume graph execution from a checkpoint:
4//! the full state, which nodes run next, which superstep we're at, and
5//! any interrupt/phase metadata needed for durable resume.
6
7use pe_core::phase_store::PhaseStateStore;
8use pe_core::state::State;
9use serde::{Deserialize, Serialize};
10
11/// Internal wrapper for checkpoint serialization.
12///
13/// Bincode-serialized into the opaque bytes stored by [`Checkpointer`](crate::checkpointer::Checkpointer).
14/// The checkpointer sees bytes; this struct gives them meaning.
15#[derive(Serialize, Deserialize)]
16#[serde(bound = "")]
17pub struct CheckpointData<S: State> {
18 /// Full state at the checkpoint.
19 pub state: S,
20 /// Which nodes are scheduled to run next.
21 pub next_nodes: Vec<String>,
22 /// Which superstep this checkpoint was taken at.
23 pub step: u32,
24 /// Which node was interrupted (if this checkpoint is from an interrupt).
25 /// Used by `resume()` to validate the resume target.
26 #[serde(default)]
27 pub interrupted_node: Option<String>,
28 /// Serialized phase state for nodes using the interrupt/phase system.
29 /// Survives checkpoint serialization so phases resume correctly.
30 #[serde(default)]
31 pub phase_state: PhaseStateStore,
32 /// The checkpoint ID this data was loaded from (for parent lineage).
33 /// Not serialized — set by the loading code.
34 #[serde(skip)]
35 pub checkpoint_id: Option<String>,
36}