ParallelInstructionPlan

type ParallelInstructionPlan = Readonly<{
  kind: "parallel";
  plans: 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

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

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