pub struct FanPattern {
pub name: String,
pub tasks: Vec<FanTask>,
pub fan_out: FanOut,
pub strategy: AggregationStrategy,
pub default_timeout: Option<Duration>,
pub fail_fast: bool,
}Expand description
Combined fan-out + fan-in pattern.
Describes what to run (tasks + context) and how to aggregate the results.
Execution is delegated to FanExecutor::execute.
Fields§
§name: StringHuman-readable name for this pattern (used in logs and error messages).
tasks: Vec<FanTask>The tasks to execute in parallel.
fan_out: FanOutShared context pushed to all tasks via fan-out.
strategy: AggregationStrategyStrategy used to aggregate results in the fan-in phase.
default_timeout: Option<Duration>Default per-task timeout applied when a task has no explicit timeout.
fail_fast: boolWhen true, the executor stops dispatching further tasks as soon as
one task fails (only meaningful for CollectAll strategy).
Implementations§
Source§impl FanPattern
impl FanPattern
Sourcepub fn new(name: impl Into<String>, tasks: Vec<FanTask>) -> Self
pub fn new(name: impl Into<String>, tasks: Vec<FanTask>) -> Self
Create a new pattern with the given name and task list.
Defaults: CollectAll strategy, no timeout, fail_fast = false.
Sourcepub fn with_strategy(self, strategy: AggregationStrategy) -> Self
pub fn with_strategy(self, strategy: AggregationStrategy) -> Self
Set the aggregation strategy.
Sourcepub fn with_default_timeout(self, timeout: Duration) -> Self
pub fn with_default_timeout(self, timeout: Duration) -> Self
Set a default per-task timeout.
Sourcepub fn with_fail_fast(self, fail_fast: bool) -> Self
pub fn with_fail_fast(self, fail_fast: bool) -> Self
Enable fail-fast mode.
Sourcepub fn with_context(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_context( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add a key-value pair to the shared context.
Sourcepub fn task_count(&self) -> usize
pub fn task_count(&self) -> usize
Returns the number of tasks in this pattern.