Skip to main content

feed_stream

Function feed_stream 

Source
pub(crate) fn feed_stream(
    source: FeedSource,
    provider: String,
    last_event_id: Option<String>,
    lease: FeedLease,
    timing: FeedTiming,
    probe: AgentProbe,
) -> impl Stream<Item = Result<Bytes, Infallible>> + Send + 'static
Expand description

One feed: retry, then a snapshot (or, for a reconnect whose Last-Event-ID still holds, the lines it missed as one append), then an append per published transcript append, reset + snapshot when the transcript is rewritten or the feed loses its place, and a heartbeat on a quiet stream. A status follows each snapshot and every change of the agent’s state (feed::status_step). Ends with reset when the device falls more than 1 MB behind or the agent is hidden, and silently when the device is revoked (its lease’s token) or goes away. The lease is held until the stream is dropped.

The feed follows the agent, not the block it opened on: every FOLLOW_POLL it asks the registry where the agent runs now and moves its subscription there, and reads lines of the agent’s shared transcript that no event brought (FeedSource::catch_up).