Skip to main content

durable_execution_sdk_testing/checkpoint_server/
mod.rs

1//! Checkpoint server module for local testing (Node.js SDK parity).
2//!
3//! This module implements a checkpoint server that runs in a separate thread,
4//! matching the architecture of the Node.js SDK's `CheckpointWorkerManager`.
5//! It provides full execution state management for realistic local testing.
6//!
7//! # Architecture
8//!
9//! The checkpoint server consists of several components:
10//!
11//! - **CheckpointWorkerManager**: Manages the lifecycle of the checkpoint server thread
12//! - **ExecutionManager**: Manages the state of all executions
13//! - **CheckpointManager**: Manages checkpoints for a single execution
14//! - **CallbackManager**: Manages callback lifecycle including timeouts and heartbeats
15//! - **EventProcessor**: Generates history events for execution tracking
16//!
17//! # Communication
18//!
19//! The main thread communicates with the checkpoint server thread via channels:
20//! - Requests are sent via `mpsc::Sender<WorkerRequest>`
21//! - Responses are received via `mpsc::Receiver<WorkerResponse>`
22
23pub mod callback_manager;
24pub mod checkpoint_manager;
25pub mod checkpoint_token;
26pub mod event_processor;
27pub mod execution_manager;
28pub mod nodejs_event_types;
29pub mod orchestrator;
30pub mod scheduler;
31pub mod types;
32pub mod worker_manager;
33
34// Re-export main types for convenience
35pub use callback_manager::{CallbackManager, CallbackState, CompleteCallbackStatus};
36pub use checkpoint_manager::{
37    CheckpointManager, CheckpointOperation, InvocationTimestamps, OperationEvents,
38};
39pub use checkpoint_token::{decode_checkpoint_token, encode_checkpoint_token, CheckpointTokenData};
40pub use event_processor::{EventProcessor, EventType, HistoryEvent};
41pub use execution_manager::{ExecutionManager, InvocationResult};
42pub use nodejs_event_types::{
43    CallbackFailedDetails, CallbackFailedDetailsWrapper, CallbackStartedDetails,
44    CallbackStartedDetailsWrapper, CallbackSucceededDetails, CallbackSucceededDetailsWrapper,
45    ContextFailedDetails, ContextFailedDetailsWrapper, ContextStartedDetails,
46    ContextStartedDetailsWrapper, ContextSucceededDetails, ContextSucceededDetailsWrapper,
47    EmptyDetails, ErrorWrapper, ExecutionFailedDetails, ExecutionFailedDetailsWrapper,
48    ExecutionStartedDetails, ExecutionStartedDetailsWrapper, ExecutionSucceededDetails,
49    ExecutionSucceededDetailsWrapper, InvocationCompletedDetails,
50    InvocationCompletedDetailsWrapper, NodeJsEventDetails, NodeJsEventType, NodeJsHistoryEvent,
51    PayloadWrapper, RetryDetails, StepFailedDetails, StepFailedDetailsWrapper, StepStartedDetails,
52    StepStartedDetailsWrapper, StepSucceededDetails, StepSucceededDetailsWrapper,
53    WaitStartedDetails, WaitStartedDetailsWrapper, WaitSucceededDetails,
54    WaitSucceededDetailsWrapper,
55};
56pub use orchestrator::{
57    BoxedHandler, InvokeHandlerResult, OperationProcessResult, OperationStorage,
58    ProcessOperationsResult, SkipTimeConfig, TestExecutionOrchestrator, TestExecutionResult,
59};
60pub use scheduler::{
61    BoxedAsyncFn, CheckpointUpdateFn, ErrorHandler, QueueScheduler, ScheduledFunction, Scheduler,
62    TimerScheduler,
63};
64pub use types::{
65    ApiType, CheckpointWorkerParams, StartDurableExecutionRequest, WorkerApiRequest,
66    WorkerApiResponse, WorkerCommand, WorkerCommandType, WorkerResponse, WorkerResponseType,
67};
68pub use worker_manager::CheckpointWorkerManager;