Skip to main content

Module ring

Module ring 

Source
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 monotonically within (topic, reset_epoch) — they never collide as long as reset_epoch is unique per process run, and they never reset within a single run (so client cursor comparisons stay cheap).

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§

TopicRing
FIFO ring of ObservedEvent keyed by cursor. Single owner; not Send + Sync on its own — wrap in Arc<RwLock<…>> for cross-task access.

Enums§

ReadResult
Outcome of TopicRing::read_since.