pub enum CheckpointingMode {
Eager,
Batched,
Optimistic,
}Expand description
Checkpointing mode that controls the trade-off between durability and performance.
The checkpointing mode determines when and how often the SDK persists operation state to the durable execution service. Different modes offer different trade-offs:
§Modes
§Eager Mode
- Checkpoints after every operation completes
- Maximum durability: minimal work is lost on failure
- More API calls: higher latency and cost
- Best for: Critical workflows where every operation must be durable
§Batched Mode (Default)
- Groups multiple operations into batches before checkpointing
- Balanced durability: some operations may be replayed on failure
- Fewer API calls: better performance and lower cost
- Best for: Most workflows with reasonable durability requirements
§Optimistic Mode
- Executes multiple operations before checkpointing
- Minimal durability: more work may be replayed on failure
- Best performance: fewest API calls
- Best for: Workflows where replay is cheap and performance is critical
§Example
use durable_execution_sdk::CheckpointingMode;
// Use eager mode for maximum durability
let eager = CheckpointingMode::Eager;
// Use batched mode for balanced performance (default)
let batched = CheckpointingMode::default();
// Use optimistic mode for best performance
let optimistic = CheckpointingMode::Optimistic;§Requirements
- 24.1: THE Performance_Configuration SHALL support eager checkpointing mode
- 24.2: THE Performance_Configuration SHALL support batched checkpointing mode
- 24.3: THE Performance_Configuration SHALL support optimistic execution mode
- 24.4: THE Performance_Configuration SHALL document the default behavior and trade-offs
Variants§
Eager
Checkpoint after every operation for maximum durability.
This mode provides the strongest durability guarantees but has the highest overhead due to frequent API calls.
§Characteristics
- Every operation is immediately checkpointed
- Minimal work lost on failure (at most one operation)
- Higher latency due to synchronous checkpointing
- More API calls and higher cost
§Use Cases
- Financial transactions
- Critical business workflows
- Operations with expensive side effects
§Requirements
- 24.1: THE Performance_Configuration SHALL support eager checkpointing mode
Batched
Batch multiple operations before checkpointing for balanced performance.
This is the default mode that provides a good balance between durability and performance. Operations are grouped into batches based on size, count, or time limits before being checkpointed together.
§Characteristics
- Operations are batched before checkpointing
- Some operations may be replayed on failure
- Better performance than eager mode
- Configurable batch size and timing
§Use Cases
- Most general-purpose workflows
- Workflows with moderate durability requirements
- Cost-sensitive applications
§Requirements
- 24.2: THE Performance_Configuration SHALL support batched checkpointing mode
Optimistic
Execute multiple operations before checkpointing for best performance.
This mode prioritizes performance over durability by executing multiple operations before creating a checkpoint. On failure, more work may need to be replayed.
§Characteristics
- Multiple operations execute before checkpointing
- More work may be replayed on failure
- Best performance and lowest cost
- Suitable for idempotent operations
§Use Cases
- High-throughput batch processing
- Workflows with cheap, idempotent operations
- Performance-critical applications
§Requirements
- 24.3: THE Performance_Configuration SHALL support optimistic execution mode
Implementations§
Source§impl CheckpointingMode
impl CheckpointingMode
Sourcepub fn is_batched(&self) -> bool
pub fn is_batched(&self) -> bool
Returns true if this mode batches operations before checkpointing.
Sourcepub fn is_optimistic(&self) -> bool
pub fn is_optimistic(&self) -> bool
Returns true if this mode executes multiple operations before checkpointing.
Sourcepub fn description(&self) -> &'static str
pub fn description(&self) -> &'static str
Returns a human-readable description of this mode.
Trait Implementations§
Source§impl Clone for CheckpointingMode
impl Clone for CheckpointingMode
Source§fn clone(&self) -> CheckpointingMode
fn clone(&self) -> CheckpointingMode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CheckpointingMode
impl Debug for CheckpointingMode
Source§impl Default for CheckpointingMode
impl Default for CheckpointingMode
Source§impl<'de> Deserialize<'de> for CheckpointingMode
impl<'de> Deserialize<'de> for CheckpointingMode
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>,
Source§impl PartialEq for CheckpointingMode
impl PartialEq for CheckpointingMode
Source§impl Serialize for CheckpointingMode
impl Serialize for CheckpointingMode
impl Copy for CheckpointingMode
impl Eq for CheckpointingMode
impl StructuralPartialEq for CheckpointingMode
Auto Trait Implementations§
impl Freeze for CheckpointingMode
impl RefUnwindSafe for CheckpointingMode
impl Send for CheckpointingMode
impl Sync for CheckpointingMode
impl Unpin for CheckpointingMode
impl UnsafeUnpin for CheckpointingMode
impl UnwindSafe for CheckpointingMode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more