Skip to main content
Use one mutation for a bounded group that needs one atomic result. For a change larger than one transaction, keep the selection and progress in a fact and process one chunk per task.

Apply a bounded group

remediate is a mutation that takes one order’s key and a reason. One enclosing mutation calls it once per order. The calls join the transaction and see the writes of the calls before them; a refusal in any call refuses the whole group.
bijection/groups.ts
The app chooses 16 as its bound. Choose one that fits what each call reads, writes and submits within the transaction limits. Tasks submitted by an accepted group commit with its writes and are performed separately.

Call it and read your write

once makes a retry of the same group answer the original result. Pass a committed result’s version as seen so the next read observes it.

Process a large selection in chunks

Keep a fact per batch. Each chunk is one mutation that reads a bounded selection, applies it and submits itself for the next chunk until nothing is left:
bijection/chunks.ts
Each chunk commits on its own, and its once names exactly one next chunk. orders declares index: [["state"]] to serve the selection. To walk a selection the chunks do not change, use ctx.page(selection, { size, cursor }) and keep next in the batch fact.