Skip to main content

CheckpointSink

Trait CheckpointSink 

Source
pub trait CheckpointSink<S: WorkflowState>: Send + Sync {
    // Required method
    fn on_checkpoint(&mut self, state: &S, frame: &FrameInfo);
}
Expand description

Checkpoint Sink SPI — 执行引擎通知 Sink 到达了合法的恢复边界。

Engine 保证:

  • 每次调用时,State 已 commit(mutation 已 apply),状态是一致的。
  • 调用顺序:execute() → commit() → on_checkpoint() → route()

Sink 自行决定:

  • 是否记录(节流、过滤)
  • 是否 snapshot(借用 &S,Sink 决定是否 clone)
  • 序列化格式(serde、protobuf、binary)
  • 存储后端(内存、磁盘、网络)

§设计原则

Engine 不拥有 Checkpoint 生命周期,只借用 Sink。 这与 D6 原则一致——Engine 不知道 FrameStack。

Required Methods§

Source

fn on_checkpoint(&mut self, state: &S, frame: &FrameInfo)

节点完成,State 已 commit。

state 是借用——Sink 决定是否 snapshot/clone。 frame 描述当前执行位置。

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§