Skip to main content

Module batch_flow

Module batch_flow 

Source
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§

BatchFlowContext 🔒
What a RegistryBatchFlow may touch.
PendingBatch 🔒
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::send and the record_ methods.
SentTally 🔒
What the iteration put on the wire, for the batch summary.

Traits§

RegistryBatchFlow 🔒
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 of verify’s two flows. run_registry_batch_flow is the loop they share. Implementations hold no state.

Functions§

may_resend 🔒
Before a resent half: false once 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 keeps next and every row still waiting in 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 RegistryBatchFlow through the iteration’s registry, and logs the batch summary.
send_batches 🔒
Sends batches one 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 in batches.