Expand description
The loop every “claim rows, send one batch, write one answer per row” flow shares: the claim’s transaction, splitting a batch the study registry refused as malformed, the halves held back and released when a shutdown or an error stops the split, the refusals, one row’s failed write not costing the rest theirs, the moved-on rows and the batch summary. What goes on the wire, request ids, the limiter and the breakers are the registry adapter’s.
Structs§
- Batch
Flow 🔒Context - What a
RegistryBatchFlowmay touch. - Pending
Batch 🔒 - One request’s rows, still to be sent.
- Prepared 🔒
- What a batch flow’s claim settled before anything is sent: the rows to send, each with what it
asks, and the rows it already wrote a decision for. Private, so the batch and the preflight’s
counts only change together through
Self::sendand therecord_methods. - Sent
Tally 🔒 - What the iteration put on the wire, for the batch summary.
Traits§
- Registry
Batch 🔒Flow - A flow whose iteration is “claim rows, decide in one transaction what may be asked, send one
batch, write one answer per row”:
import,resolve-enrolments, and each ofverify’s two flows.run_registry_batch_flowis the loop they share. Implementations hold no state.
Functions§
- may_
resend 🔒 - Before a resent half:
falseonce a shutdown is under way, since each half can take the whole request timeout and sending the rest would outlast the termination grace period. Otherwise keepsnextand every row stillwaitingin flight. - record_
row_ 🔒write - Counts one row’s write. A row whose write failed is reported and counted as failed while the batch’s other answers are still written: dropping them would leave rows Sisu already answered for to be recovered as uncertain. Only a lost database connection stops the batch.
- release_
unsent 🔒 - run_
registry_ 🔒batch_ flow - Runs one
RegistryBatchFlowthrough the iteration’s registry, and logs the batch summary. - send_
batches 🔒 - Sends
batchesone after another, splitting the ones refused as malformed, and writes each row’s answer. Stops early on shutdown or on an error, leaving what is still unsent inbatches.