pub trait BackfillSource: Send + Sync {
// Required methods
fn has_history(&self, oid: &str) -> bool;
fn replay<'a>(
&'a self,
oid: &'a str,
tx: &'a Sender<(String, Vec<u8>)>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>;
}Expand description
A source of historical publication events for firehose-backfill late-join (#393).
Implementations typically wrap the atproto firehose (sh.tangled.git.refUpdate)
or a registry snapshot. All methods are fallible and best-effort: returning an
error or empty iterator from any of them causes BackfillMode to gracefully
degrade to live-only MoQ (no backfill), never to fail the subscription.
This is a trait object interface so the transport-agnostic hyprstream-rpc
crate can express the backfill contract without depending on the atproto /
firehose wiring (which lives in the hyprstream app crate).
Required Methods§
Sourcefn has_history(&self, oid: &str) -> bool
fn has_history(&self, oid: &str) -> bool
True if this source can serve history for oid right now.
Returning false (e.g. firehose offline, registry unreachable) makes the
subscriber skip backfill and start live-only.
Sourcefn replay<'a>(
&'a self,
oid: &'a str,
tx: &'a Sender<(String, Vec<u8>)>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>
fn replay<'a>( &'a self, oid: &'a str, tx: &'a Sender<(String, Vec<u8>)>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>
Replay historical publication events for oid to tx, oldest-first.
Each item is the same (topic, payload) pair a live MoQ subscriber would
yield. Implementations should bound the replay (event count / wall time)
and return once the backlog is drained; the caller then switches to live.
Errors are logged and treated as “no history available”.