Skip to main content

map_handler

Function map_handler 

Source
pub async fn map_handler<T, U, F, Fut>(
    items: Vec<T>,
    func: F,
    state: &Arc<ExecutionState>,
    op_id: &OperationIdentifier,
    parent_ctx: &DurableContext,
    config: &MapConfig,
    logger: &Arc<dyn Logger>,
) -> Result<BatchResult<U>, DurableError>
where T: Serialize + DeserializeOwned + Send + Sync + Clone + 'static, U: Serialize + DeserializeOwned + Send + 'static, F: Fn(DurableContext, T, usize) -> Fut + Send + Sync + Clone + 'static, Fut: Future<Output = Result<U, DurableError>> + Send + 'static,
Expand description

Executes a map operation over a collection with parallel processing.

This handler implements the map semantics:

  • Creates a child context for each item
  • Uses ConcurrentExecutor for parallel execution
  • Supports ItemBatcher for batching
  • Returns BatchResult with results for all items

§Arguments

  • items - The collection of items to process
  • func - The function to apply to each item
  • state - The execution state for checkpointing
  • op_id - The operation identifier for the map operation
  • parent_ctx - The parent DurableContext
  • config - Map configuration
  • logger - Logger for structured logging

§Returns

A BatchResult containing results for all items.