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.
MissingEventskeys 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; seewindow_hash.
Functions§
- window_
hash 🔒 - Order-independent content hash of an
Op::MissingEventswindow: the sortedlatest_eventsandearliest_eventssets 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§
- Shared
Result 🔒 - 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.
- Window
Refs 🔒 - Borrowed window ids gathered for sorting before hashing; inline-sized for the common single-prev case.