Skip to main content

CheckpointConfig

Struct CheckpointConfig 

Source
pub struct CheckpointConfig<S: WorkflowState> {
    pub trigger: TriggerPolicy,
    pub retention: RetentionPolicy,
    /* private fields */
}
Expand description

Checkpoint 保存配置 — 三层策略。

CheckpointConfig
  ├── trigger:    何时保存(EveryNode / BarrierOnly / Manual / OnMutation)
  ├── retention:  保留多少个(KeepAll / KeepLatest(N) / TimeBased)
  ├── save_fn:    保存回调
  └── store:      存储后端引用(用于 prune)

Fields§

§trigger: TriggerPolicy

触发策略

§retention: RetentionPolicy

保留策略

Implementations§

Source§

impl<S: WorkflowState> CheckpointConfig<S>

Source

pub fn new( save_fn: impl Fn(Checkpoint<S>, TraceId) -> Pin<Box<dyn Future<Output = Result<(), CheckpointStoreError>> + Send>> + Send + Sync + 'static, graph_hash: u64, ) -> Self

创建 CheckpointConfig。

save_fn 接收 (Checkpoint<S>, TraceId) 并异步保存。 通常由调用方组合 TypedCheckpointStore + SerdeCheckpointCodec 构造。

Source

pub fn with_trigger(self, trigger: TriggerPolicy) -> Self

设置触发策略。

Source

pub fn with_retention(self, retention: RetentionPolicy) -> Self

设置保留策略。

Source

pub fn with_store(self, store: Arc<dyn BlobCheckpointStore>) -> Self

设置存储后端引用(用于 prune)。

Source

pub fn with_policy(self, policy: CheckpointPolicy) -> Self

向后兼容 — 设置旧的 CheckpointPolicy(自动转换为 TriggerPolicy)。

Source

pub fn should_save(&self, has_mutations: bool, is_barrier: bool) -> bool

根据策略判断是否应该保存。

Source

pub async fn apply_retention( &self, trace_id: &TraceId, ) -> Result<(), CheckpointStoreError>

执行保留策略(prune)。

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more