Expand description
User-facing re-exports for the trait-based approach.
Single import for everything needed to write a durable Lambda handler:
use durable_lambda_trait::prelude::*;§Complete Minimal Handler
use durable_lambda_trait::prelude::*;
struct MyHandler;
#[async_trait::async_trait]
impl DurableHandler for MyHandler {
async fn handle(
&self,
event: serde_json::Value,
mut ctx: TraitContext,
) -> Result<serde_json::Value, DurableError> {
let result: Result<String, String> = ctx.step("greet", || async {
Ok("Hello from durable Lambda!".to_string())
}).await?;
Ok(serde_json::json!({ "greeting": result.unwrap() }))
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
run(MyHandler).await
}This re-exports:
DurableHandler— the trait for defining durable handlersTraitContext— the context wrapper for durable operationsrun— the entry point for trait-based handlers- Core types:
DurableError,StepOptions,CallbackOptions,CallbackHandle,ExecutionMode,CheckpointResult
Re-exports§
pub use crate::context::TraitContext;pub use crate::handler::run;pub use crate::handler::DurableHandler;
Structs§
- Batch
Item - A single branch outcome within a
BatchResult. - Batch
Result - Result of a parallel or map operation containing all branch outcomes.
- Callback
Handle - Handle returned by [
DurableContext::create_callback] containing the server-generated callback ID. - Callback
Options - Configure callback timeout behavior.
- MapOptions
- Configure map operation behavior including batching.
- Parallel
Options - Configure parallel execution behavior.
- Step
Options - Configure retry behavior for step operations.
Enums§
- Batch
Item Status - Status of an individual branch in a parallel operation.
- Checkpoint
Result - Represent the checkpointed outcome of a durable step operation.
- Completion
Reason - Reason the parallel block completed.
- Durable
Error - Represent all errors that can occur within the durable-lambda SDK.
- Execution
Mode - Signal whether the replay engine is replaying from history or executing new operations.
Traits§
- Durable
Context Ops - Shared interface for all durable context types.