pub struct SubmitGate { /* private fields */ }Expand description
What makes a deadline COOPERATIVE around a write (bsv-low #552, the lens
fold’s HIGH-1). Engine::submit is several storage writes (mark spent,
delete the stale coin, insert the outputs, notify, record applied), each
an await on D1, and a future dropped between two of them leaves a head
chain with NO head: the old one deleted, the new one never inserted, and
no applied row to say so.
The writer opens a WriteSection around ONE transaction’s submit and
asks SubmitGate::stop_if_due between two of them.
race_or_deadline_guarded does not drop its future while a section is
open: it notes the deadline as due and keeps polling until the section
closes, so the wait is bounded by the writes of one transaction. What the
deadline leaves is then a prefix of whole transactions, never part of one.
The race does not bound a write that never answers: the writer does
(bsv-low #559, Engine::set_finalize_submit_budget: the engine bounds
each storage call and hook inside the section, and a call that never
answers is that call’s fault; the submit itself is never dropped).
Implementations§
Source§impl SubmitGate
impl SubmitGate
Sourcepub fn write_section(&self) -> WriteSection<'_>
pub fn write_section(&self) -> WriteSection<'_>
Open a section no guarded race may drop. Closed when the returned value is dropped.
Sourcepub fn deadline_is_due(&self) -> bool
pub fn deadline_is_due(&self) -> bool
Whether a guarded race’s deadline fell due while a section was open: the race is waiting for the writer to stop.
Sourcepub async fn stop_if_due(&self)
pub async fn stop_if_due(&self)
The writer’s question at a transaction boundary, with NO section open. If a deadline is due this never returns: it hands the future back to the race, which drops it on this very poll (only a guarded race sets the flag, and it clears it when it ends).