Skip to main content

parallel_handler

Function parallel_handler 

Source
pub async fn parallel_handler<T, F, Fut>(
    branches: Vec<F>,
    state: &Arc<ExecutionState>,
    op_id: &OperationIdentifier,
    parent_ctx: &DurableContext,
    config: &ParallelConfig,
    logger: &Arc<dyn Logger>,
) -> Result<BatchResult<T>, DurableError>
where T: Serialize + DeserializeOwned + Send + 'static, F: FnOnce(DurableContext) -> Fut + Send + 'static, Fut: Future<Output = Result<T, DurableError>> + Send + 'static,
Expand description

Executes multiple operations in parallel.

This handler implements the parallel semantics:

  • Creates a child context for each branch
  • Uses ConcurrentExecutor for parallel execution
  • Returns BatchResult with results for all branches

§Arguments

  • branches - The list of functions to execute in parallel
  • state - The execution state for checkpointing
  • op_id - The operation identifier for the parallel operation
  • parent_ctx - The parent DurableContext
  • config - Parallel configuration
  • logger - Logger for structured logging

§Returns

A BatchResult containing results for all branches.