Module subscription
Expand description
Bounded, replayable subscription sources for RPC streams.
A SubscriptionHub holds one ring per Source. Producers append to a
ring and never wait for a subscriber; each subscriber is only a cursor (the
next sequence number it wants). Every ring is bounded by a frame count and a
byte cap, and all rings share one process-wide byte budget: when it is
exceeded, the oldest frame across all rings is evicted.
Nothing is dropped silently. A cursor that points into a gap, whether the
frames were evicted or never reached the hub, reads Read::Lagged with
the first missing sequence and the first one still available, and the
subscriber resumes from there.
Sequence numbers start at 1 per source and are never reused within a hub.
Each hub has a random SubscriptionHub::epoch; a new hub (a daemon
restart or reload) starts numbering again, so a client resumes with the
epoch and since_seq it last saw, and a different epoch is reported as a
break in continuity rather than matched by number.
Structs§
- Ring
Limits - Per-ring caps.
- Subscription
Hub - The process’s subscription sources. Cheap to share behind an
Arc.
Enums§
Constants§
- DEFAULT_
BYTE_ BUDGET - Default process-wide byte budget across every ring.
- DEFAULT_
RING_ LIMITS - Default per-source ring caps.
- READ_
BATCH - Frames a subscriber reads per wakeup before yielding.