DataSource

Trait DataSource 

Source
pub trait DataSource: Send + Sync {
    // Required methods
    fn source_id(&self) -> &str;
    fn fetch_batch<'life0, 'async_trait>(
        &'life0 self,
        cursor: Option<String>,
        batch_size: usize,
    ) -> Pin<Box<dyn Future<Output = Result<(Vec<DataRecord>, Option<String>)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn total_count<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<u64>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for data sources that can be ingested

Required Methods§

Source

fn source_id(&self) -> &str

Source identifier

Source

fn fetch_batch<'life0, 'async_trait>( &'life0 self, cursor: Option<String>, batch_size: usize, ) -> Pin<Box<dyn Future<Output = Result<(Vec<DataRecord>, Option<String>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetch a batch of records starting from cursor

Source

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

Get total record count (if known)

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if source is available

Implementors§