Skip to main content

DurableBackend

Trait DurableBackend 

Source
pub trait DurableBackend: Send + Sync {
    // Required methods
    fn checkpoint<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        arn: &'life1 str,
        checkpoint_token: &'life2 str,
        updates: Vec<OperationUpdate>,
        client_token: Option<&'life3 str>,
    ) -> Pin<Box<dyn Future<Output = Result<CheckpointDurableExecutionOutput, DurableError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn get_execution_state<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        arn: &'life1 str,
        checkpoint_token: &'life2 str,
        next_marker: &'life3 str,
        max_items: i32,
    ) -> Pin<Box<dyn Future<Output = Result<GetDurableExecutionStateOutput, DurableError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;

    // Provided method
    fn batch_checkpoint<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        arn: &'life1 str,
        checkpoint_token: &'life2 str,
        updates: Vec<OperationUpdate>,
        client_token: Option<&'life3 str>,
    ) -> Pin<Box<dyn Future<Output = Result<CheckpointDurableExecutionOutput, DurableError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}
Expand description

Define the I/O boundary between the replay engine and the durable execution backend.

This trait abstracts the 2 AWS Lambda durable execution API operations that the SDK uses internally. Implement this trait for real AWS calls (RealBackend) or for testing ([MockBackend] in durable-lambda-testing).

§Object Safety

This trait is object-safe and designed to be used as Arc<dyn DurableBackend + Send + Sync>.

§Examples

use durable_lambda_core::backend::{DurableBackend, RealBackend};

// RealBackend implements DurableBackend.
fn accepts_backend(_b: &dyn DurableBackend) {}

Required Methods§

Source

fn checkpoint<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, arn: &'life1 str, checkpoint_token: &'life2 str, updates: Vec<OperationUpdate>, client_token: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<CheckpointDurableExecutionOutput, DurableError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Persist checkpoint updates for a durable execution.

Wraps the checkpoint_durable_execution AWS API. Sends a batch of OperationUpdate items and receives a new checkpoint token plus any updated execution state.

§Errors

Returns DurableError if the AWS API call fails after retries.

Source

fn get_execution_state<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, arn: &'life1 str, checkpoint_token: &'life2 str, next_marker: &'life3 str, max_items: i32, ) -> Pin<Box<dyn Future<Output = Result<GetDurableExecutionStateOutput, DurableError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Get the current operation state of a durable execution (paginated).

Wraps the get_durable_execution_state AWS API. Returns a page of Operation items and an optional next_marker for pagination.

§Errors

Returns DurableError if the AWS API call fails after retries.

Provided Methods§

Source

fn batch_checkpoint<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, arn: &'life1 str, checkpoint_token: &'life2 str, updates: Vec<OperationUpdate>, client_token: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<CheckpointDurableExecutionOutput, DurableError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Persist multiple checkpoint updates in a single AWS API call.

Default implementation delegates to checkpoint, making it backward-compatible for existing implementors. Override in test mocks to track batch-specific call counts.

§Errors

Returns DurableError if the underlying AWS API call fails.

Implementors§