Skip to main content

Module feed

Module feed 

Source
Expand description

CDC feed layer over crate::source::ReplicationSource — the (generation, offset) cursor semantics the public FEED.* / changes_since surfaces speak.

Cursor contract:

  • generation identifies one unbroken offset history. A given (gen, offset) pair refers to the same stream prefix forever. The value is an OPAQUE random identity, not a counter: two nodes counting in lockstep (a startup election on one, a failover promotion on the other) land on the same number for different histories, and a stale cursor then slips through the fence into offset aliasing (the availgate failover wedge). Randomness is what makes cross-node fencing sound; there is no ordering.
  • Clean shutdown + restart preserves both (continuity); FLUSHALL, restore-from-snapshot, or an unclean shutdown draws a fresh gen and resets offset to 0.
  • A cursor from any OTHER generation, or one whose offsets were evicted, answers FeedRead::Resync carrying the current tail — the consumer rebuilds (SCAN) and resumes from there.

Structs§

FeedFrame
One decoded feed entry: the offset plus the frame’s wire bytes (envelope + offset + RESP argv — same encoding replicas consume; [crate::replica_decode] parses it).
FeedSource
Generation-aware wrapper: owns the generation number alongside the backlog. The runtime persists generation via kevy-persist’s feed sidecars; this type only holds the in-memory value.

Enums§

FeedRead
Why a feed read could not be served from the backlog.