Expand description
Per-topic ring buffer for captured events.
Each TopicRing is bounded in capacity. When a push would exceed
capacity, the oldest event is evicted (FIFO). Cursors are server-
assigned and strictly increasing for the life of the ring — a WS
reconnect bumps the ring’s reset_epoch but never rewinds its cursors.
A ring’s first cursor is its base. The connector derives the base from
the boot time (see connector::cursor_base), so a restarted process
hands out cursors ABOVE anything the previous process did and a client
holding an old cursor is never told “caught up” by a ring whose cursors
restarted at 1 below it. When that cannot be guaranteed (a clock that
went backwards), a cursor from the future is answered with
ReadResult::CursorExpired rather than silence.
The ring is read by cursor: read_since(cursor, limit) returns events
whose cursor is strictly greater than cursor, up to limit. If the
caller’s cursor is older than the buffer’s current head (the smallest
cursor still buffered), the read returns ReadResult::CursorExpired
so the client can resync to head and emit a synthetic gap event.
Structs§
- Topic
Ring - FIFO ring of
ObservedEventkeyed by cursor. Single owner; notSend + Syncon its own — wrap inArc<RwLock<…>>for cross-task access.
Enums§
- Read
Result - Outcome of
TopicRing::read_since.