Skip to main content

durable_execution_sdk/state/
mod.rs

1//! Execution state management for the AWS Durable Execution SDK.
2//!
3//! This module provides the core state management types for durable executions,
4//! including checkpoint tracking, replay logic, and operation state management.
5//!
6//! ## Module Structure
7//!
8//! - `checkpoint_result` - Result types for checkpoint queries
9//! - `replay_status` - Replay state tracking
10//! - `batcher` - Checkpoint batching for efficient API calls
11//! - `execution_state` - Main execution state management
12//!
13//! ## Checkpoint Token Management
14//!
15//! The SDK uses checkpoint tokens to ensure exactly-once checkpoint semantics:
16//!
17//! 1. **Initial Token**: The first checkpoint uses the `CheckpointToken` from the
18//!    `DurableExecutionInvocationInput` provided by Lambda.
19//!
20//! 2. **Token Updates**: Each successful checkpoint returns a new token that MUST
21//!    be used for the next checkpoint. The SDK automatically updates the token
22//!    after each successful checkpoint.
23//!
24//! 3. **Token Consumption**: Once a token is used for a checkpoint, it is consumed
25//!    and cannot be reused. Attempting to reuse a consumed token results in an
26//!    `InvalidParameterValueException` error.
27//!
28//! 4. **Error Handling**: If a checkpoint fails with "Invalid checkpoint token",
29//!    the error is marked as retriable so Lambda can retry with a fresh token.
30//!
31//! ## Requirements
32//!
33//! - 2.9: THE Checkpointing_System SHALL use the CheckpointToken from invocation input for the first checkpoint
34//! - 2.10: THE Checkpointing_System SHALL use the returned CheckpointToken from each checkpoint response for subsequent checkpoints
35//! - 2.11: THE Checkpointing_System SHALL handle InvalidParameterValueException for invalid tokens by allowing propagation for retry
36
37mod batcher;
38mod checkpoint_result;
39mod execution_state;
40mod replay_status;
41
42pub use batcher::{
43    create_checkpoint_queue, BatchResult, CheckpointBatcher, CheckpointBatcherConfig,
44    CheckpointRequest, CheckpointSender,
45};
46pub use checkpoint_result::CheckpointedResult;
47pub use execution_state::ExecutionState;
48pub use replay_status::ReplayStatus;