Adds a new run. A run id that exists is an error, and so is an idempotency key the owner already used: that insert
stores nothing and rejects with DuplicateIdempotencyKeyError, so of two sends racing with one key only one run
is made, and the other finds it with findByIdempotencyKey.
The run, or undefined when there is none.
Atomically re-reads the row, checks expectState and applies the patch; undefined on a mismatch. Postgres holds the shared run anchor and sets the content fence for a purge in the same transaction. In-memory comparison and update have no await between them.
Optional expectState: MeetingRunState | readonly MeetingRunState[]Decides the patch on a copy of the stored row and applies it with no await between them, so no other write lands in
between. A patch that would change the run's persisted funding is refused, as update refuses it, and nothing is written.
Rewrites the whole row (the content-free form at the end of a purge).
The runs the filter selects, requestedAt descending, then runId ascending. Default limit 500; states: [] applies no state filter.
The run an owner sent with this idempotency key, if there is one (there is at most one: see insert).
At most limit (1 to 64) runs whose funding cleanup is unfinished, after afterRunId, ordered by run id.
Optional afterRunId: string
Runs in memory, for tests and single-process hosts. Rows are copied in and out, so a caller never holds the stored row.