pub trait Adapter: Send + Sync {
// Required methods
fn discover(&self) -> DiscoverFuture<'_>;
fn events_with<'a>(
&'a self,
oracle: &'a dyn SkipOracle,
) -> AdapterYieldStream<'a>;
// Provided method
fn events(&self) -> EventStream<'_> { ... }
}Expand description
Live, configured adapter instance. Holds whatever handle the source needs (an open directory root, an HTTP client + auth, a database connection) for the lifetime of its event stream.
Required Methods§
Sourcefn discover(&self) -> DiscoverFuture<'_>
fn discover(&self) -> DiscoverFuture<'_>
Count how many sessions Self::events will produce, used by the
CLI bar to set its length up front. A filesystem adapter walks its
root and counts .jsonl files; an API adapter calls its list
endpoint. Cheap and best-effort: errors here only mean we run with
an unknown total (the bar still ticks per session), so callers
fall back to a rolling counter rather than failing the sync.
Sourcefn events_with<'a>(
&'a self,
oracle: &'a dyn SkipOracle,
) -> AdapterYieldStream<'a>
fn events_with<'a>( &'a self, oracle: &'a dyn SkipOracle, ) -> AdapterYieldStream<'a>
Stream events with a SkipOracle the adapter MAY consult to
short-circuit per-session re-decoding (spec.md#adapter-integrity-event-ordering). Default impl
ignores the oracle.
Provided Methods§
Sourcefn events(&self) -> EventStream<'_>
fn events(&self) -> EventStream<'_>
Stream every canonical event for every session this adapter knows
about, in append-only order per session. The stream borrows self
so callers can pass &adapter or hold a Box<dyn Adapter> and
invoke this through as_ref().
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".