Skip to main content

Adapter

Trait Adapter 

Source
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§

Source

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.

Source

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§

Source

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".

Implementors§