pub struct Checkpoint<S: WorkflowState = State> {
pub checkpoint_id: CheckpointId,
pub current_node: NodeId,
pub state: S::Checkpoint,
pub graph_hash: u64,
pub created_at: SystemTime,
}Expand description
执行检查点 — 物化快照 + 执行游标。
Checkpoint 的唯一职责:恢复(Restore)。
给我一个 Checkpoint,我就能从 current_node 开始,用 state 继续执行。
§P0-1: Checkpoint Projection
state 字段使用 S::Checkpoint(关联类型),不是 S(Runtime State)。
这保证:
- Runtime State 可以包含不可序列化字段(
Arc<dyn ...>,Sender,Cache) - Checkpoint 只序列化必要字段
- 编译期保证可序列化
§Graph Compatibility
graph_hash 记录创建 Checkpoint 时的图结构指纹。
恢复时必须校验:graph_hash 不匹配 → 拒绝恢复(不允许 silent mismatch)。
Fields§
§checkpoint_id: CheckpointId唯一标识
current_node: NodeId下一个要执行的节点
state: S::Checkpoint物化状态快照(P0-1: 使用 Checkpoint 关联类型,不是 raw State)
graph_hash: u64图结构指纹 — 恢复时校验兼容性
created_at: SystemTime创建时间
Implementations§
Source§impl<S: WorkflowState> Checkpoint<S>
impl<S: WorkflowState> Checkpoint<S>
Trait Implementations§
Source§impl<S: Clone + WorkflowState> Clone for Checkpoint<S>where
S::Checkpoint: Clone,
impl<S: Clone + WorkflowState> Clone for Checkpoint<S>where
S::Checkpoint: Clone,
Source§fn clone(&self) -> Checkpoint<S>
fn clone(&self) -> Checkpoint<S>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S: Debug + WorkflowState> Debug for Checkpoint<S>where
S::Checkpoint: Debug,
impl<S: Debug + WorkflowState> Debug for Checkpoint<S>where
S::Checkpoint: Debug,
Source§impl<'de, S: WorkflowState> Deserialize<'de> for Checkpoint<S>where
S::Checkpoint: Deserialize<'de>,
impl<'de, S: WorkflowState> Deserialize<'de> for Checkpoint<S>where
S::Checkpoint: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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<S: WorkflowState> Serialize for Checkpoint<S>where
S::Checkpoint: Serialize,
impl<S: WorkflowState> Serialize for Checkpoint<S>where
S::Checkpoint: Serialize,
Auto Trait Implementations§
impl<S> Freeze for Checkpoint<S>
impl<S> RefUnwindSafe for Checkpoint<S>
impl<S> Send for Checkpoint<S>
impl<S> Sync for Checkpoint<S>
impl<S> Unpin for Checkpoint<S>
impl<S> UnsafeUnpin for Checkpoint<S>
impl<S> UnwindSafe for Checkpoint<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more