pub trait ReferenceTableSource: Send {
// Required methods
fn poll_snapshot<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<RecordBatch>, ConnectorError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_snapshot_complete(&self) -> bool;
fn poll_changes<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<RecordBatch>, ConnectorError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn checkpoint(&self) -> SourceCheckpoint;
fn restore<'life0, 'life1, 'async_trait>(
&'life0 mut self,
checkpoint: &'life1 SourceCheckpoint,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectorError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectorError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
A source that populates a reference/dimension table.
The lifecycle is:
- Call
poll_snapshotrepeatedly until it returnsOk(None)(snapshot complete). - Optionally call
poll_changesin a loop to receive incremental updates (CDC mode). - Call
closewhen the table is no longer needed.
Checkpoint/restore support allows resuming from a saved position across restarts.
Required Methods§
Sourcefn poll_snapshot<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<RecordBatch>, ConnectorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn poll_snapshot<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<RecordBatch>, ConnectorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Polls for the next batch of snapshot data.
Returns Ok(Some(batch)) while snapshot data is available.
Returns Ok(None) when the snapshot is complete.
§Errors
Returns ConnectorError on read failure.
Sourcefn is_snapshot_complete(&self) -> bool
fn is_snapshot_complete(&self) -> bool
Returns true once all snapshot batches have been delivered.
Sourcefn poll_changes<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<RecordBatch>, ConnectorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn poll_changes<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<RecordBatch>, ConnectorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Polls for the next batch of incremental changes (CDC).
Returns Ok(Some(batch)) when change data is available,
Ok(None) when no changes are pending.
§Errors
Returns ConnectorError on read failure.
Sourcefn checkpoint(&self) -> SourceCheckpoint
fn checkpoint(&self) -> SourceCheckpoint
Creates a checkpoint of the current source position.
Sourcefn restore<'life0, 'life1, 'async_trait>(
&'life0 mut self,
checkpoint: &'life1 SourceCheckpoint,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn restore<'life0, 'life1, 'async_trait>(
&'life0 mut self,
checkpoint: &'life1 SourceCheckpoint,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectorError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Restores the source position from a checkpoint.
§Errors
Returns ConnectorError if the checkpoint is invalid or restore fails.