ParallelInstructionPlan

type ParallelInstructionPlan = Readonly<{
  kind: "parallel";
  plans: InstructionPlan[];
  planType: "instructionPlan";
}>;

A plan wrapping other plans that can be executed in parallel.

This means direct children of this plan can be executed in separate parallel transactions without consequence. However, the children themselves can define additional constraints for that specific branch of the tree — such as the SequentialInstructionPlan.

You may use the parallelInstructionPlan helper to create objects of this type.

Examples

Simple parallel plan with two instructions.

const plan = parallelInstructionPlan([instructionA, instructionB]);
plan satisfies ParallelInstructionPlan;

Parallel plan with nested sequential plans.

Here, instructions A and B must be executed sequentially and so must instructions C and D, but both pairs can be executed in parallel.

const plan = parallelInstructionPlan([
  sequentialInstructionPlan([instructionA, instructionB]),
  sequentialInstructionPlan([instructionC, instructionD]),
]);
plan satisfies ParallelInstructionPlan;

See

parallelInstructionPlan

On this page