Expand description
Coalesced, failover federation fetch of raw event bytes.
Service::fetch is the entry point; behind it a single worker task owns
every in-flight fetch and the dedup map, so no lock guards them. The
per-fetch work splits across the submodules: candidate selection, the
federation transport, and response validation.
ModulesΒ§
- error π
- Internal failure type for a fetch.
- inflight π
- Single-flight bookkeeping for one in-flight fetch.
- opts π
- Caller contract and result types for a fetch:
Optsin,Outcomeout. - select π
- Candidate server selection for a fetch.
- transport π
- Federation transport: an
Opand target server in, raw response bytes out. - validate π
- Two-tier response validation: a cheap conformance check, then an opt-in deep
PDU pass (event id, content hashes, signatures) that runs only for event ops
with those checks enabled. The per-check toggles live on
Opts. - worker π
- The fetch worker loop: one task owning every in-flight fetch, lock-free.
StructsΒ§
- Msg π
- Request to the worker. The worker replies with a subscription to the coalesced result, deferring the reply under backpressure until a slot frees.
- Opts
- Caller contract.
event_idis the sought datum forOp::Event/Op::AuthEvent/Op::AuthChain/Op::StateIdsand a reference point for the others. - Outcome
- Raw response body plus the server that answered.
bytesis ref-counted so concurrent callers coalesced onto one fetch share a single buffer. - Service
EnumsΒ§
- Fanout
Growth - Per-round width schedule for staged fan-out: how many candidate servers a
fetch races concurrently in each escalation round, before the workerβs
per-round ceiling and remaining-budget clamps.
Fixed(1)(theOpts::newdefault) reproduces strictly-sequential attempts. - Op
- Federation endpoint a fetch targets. The dedup key folds this in, so two callers asking for the same event over different endpoints do not coalesce.
ConstantsΒ§
- REQUESTS_
MAX π - Upper bound on concurrent in-flight fetches across all keys.
FunctionsΒ§
- await_
result π
Type AliasesΒ§
- Event
Window - Event-id window for the batch ops, inline-sized for the common single-prev case and spilling to the heap past that.