Skip to main content

run_plan_parallel

Function run_plan_parallel 

Source
pub fn run_plan_parallel<F>(
    plan: Option<&ExecutionPlanSpec>,
    ops: &[OpSpec],
    exec: F,
) -> Result<RunResult, PlanFailure>
where F: Fn(&OpSpec, Option<&Value>) -> ExecOutcome + Sync,
Expand description

Bounded parallel variant of run_plan (bc#23).

Deterministic commit protocol (execution-plan.md §4.1), per stage:

  1. preflight (ascending index): policy validation, skip decision, and bindField binding are derived from the settled prior-stage states (stage members are mutually independent — §1).
  2. dispatch (ascending index, bounded): exec of runnable members runs on scoped worker threads, at most plan.concurrency in flight.
  3. commit (ascending index): outcomes are interpreted in declaration order, so the failure identity (code + message) matches run_plan exactly.

The only observable difference from run_plan is speculative dispatch: when a member’s interpretation fails, later members of the same stage may already have been executed (same allowance as graphddb’s historical thread-overlap).

A consumer shipping a plan with concurrency > 1 declares that exec may be invoked from that many threads concurrently (ship concurrency: 1 otherwise — that, single-member stages, and intra-stage parent/child dependencies all fall back to sequential dispatch with unchanged results).