Skip to main content

SyncSource

Trait SyncSource 

Source
pub trait SyncSource: Send + Sync {
    // Required methods
    fn id(&self) -> &str;
    fn pull<'life0, 'async_trait>(
        &'life0 self,
        cursor: Option<String>,
    ) -> Pin<Box<dyn Future<Output = Result<PullResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn subscribe<'life0, 'async_trait>(
        &'life0 self,
        cursor: Option<String>,
    ) -> Pin<Box<dyn Future<Output = Result<DeltaStream>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Anything that can emit deltas into the local mirror.

Generated oxide-gen clients implement this by translating their API’s list / change-feed endpoints into delta batches.

Required Methods§

Source

fn id(&self) -> &str

Stable id of the source (matches Provenance::source).

Source

fn pull<'life0, 'async_trait>( &'life0 self, cursor: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<PullResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Pull the next batch of deltas. cursor is the value the source returned from the previous call, or None for the first pull.

Provided Methods§

Source

fn subscribe<'life0, 'async_trait>( &'life0 self, cursor: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<DeltaStream>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to a live stream of deltas starting from cursor.

The default implementation does a single pull call and wraps the resulting batch as a finite stream. Override this method for sources that support real push (WebSocket, SSE, change-feeds, etc.).

Implementors§