pub struct FeedSource { /* private fields */ }Expand description
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.
Implementations§
Source§impl FeedSource
impl FeedSource
Sourcepub fn new(generation: u64, source: ReplicationSource) -> Self
pub fn new(generation: u64, source: ReplicationSource) -> Self
Wrap a backlog at an explicit generation (loaded from the feed sidecar at boot, or 1 for a fresh data dir).
Sourcepub fn generation(&self) -> u64
pub fn generation(&self) -> u64
Current generation.
Sourcepub fn source(&self) -> &ReplicationSource
pub fn source(&self) -> &ReplicationSource
Access the wrapped backlog (push side + replica streaming keep
their existing ReplicationSource API).
Sourcepub fn source_mut(&mut self) -> &mut ReplicationSource
pub fn source_mut(&mut self) -> &mut ReplicationSource
Mutable access for push_mutation / drop_up_to.
Sourcepub fn bump_generation(&mut self)
pub fn bump_generation(&mut self)
Break continuity: bump the generation and restart offsets at 0 (FLUSHALL / restore / unclean-boot policy). The backlog empties — frames from the old generation must never be served under the new one.
Sourcepub fn tail(&self) -> (u64, u64)
pub fn tail(&self) -> (u64, u64)
The tail cursor: (generation, next_offset) — where a consumer
resuming after a rebuild starts.
Sourcepub fn read(
&self,
cursor_gen: u64,
offset: u64,
max: usize,
) -> Result<Vec<FeedFrame<'_>>, FeedRead>
pub fn read( &self, cursor_gen: u64, offset: u64, max: usize, ) -> Result<Vec<FeedFrame<'_>>, FeedRead>
Serve up to max frames at cursor (generation, offset).
- Stale generation →
Resync(any pre-bump cursor is unservable — uniqueness of(gen, offset)forbids re-serving). - Generation from the future →
Future(caller confusion). - Evicted offset →
Resyncwith the current tail.