Skip to main content

Module inflight

Module inflight 

Source
Expand description

Single-flight bookkeeping for one in-flight fetch.

Key is the dedup key the worker’s in-flight map is keyed on; Inflight is the worker-owned entry every coalesced caller subscribes to; SharedResult is the broadcast outcome and Subscription the caller’s handle, whose liveness token cancels the fetch on drop.

Structs§

Inflight 🔒
One in-flight fetch, owned by the worker. The worker is the sole mutator, so no lock guards it; coalesced callers reach it only through their channels.
Key 🔒
Single-flight dedup key. MissingEvents keys on a content hash of its request window instead of a single event_id, so two callers asking for the same window coalesce regardless of event order; see window_hash.

Functions§

window_hash 🔒
Order-independent content hash of an Op::MissingEvents window: the sorted latest_events and earliest_events sets plus the batch limit. Sorting before hashing folds request-order permutations onto one key; the two sets hash as distinct sequences so swapping them does not collide.

Type Aliases§

SharedResult 🔒
Outcome shared by every caller coalesced onto one fetch. Cheap to clone so the worker can broadcast it down each subscriber’s channel.
Subscription 🔒
Reply handed to a caller: the channel it awaits the outcome on, plus the sole strong liveness token whose drop cancels the in-flight fetch.
WindowRefs 🔒
Borrowed window ids gathered for sorting before hashing; inline-sized for the common single-prev case.