Skip to main content

Datasource

Trait Datasource 

Source
pub trait Datasource: Send + Sync {
    // Required methods
    fn consume<'life0, 'async_trait>(
        &'life0 self,
        id: DatasourceId,
        sender: Sender<(Update, DatasourceId)>,
        cancellation_token: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = CarbonResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_types(&self) -> Vec<UpdateType>;
}
Expand description

Async producer trait implemented by all upstream data sources.

Runs as a dedicated task and streams (Update, DatasourceId) into the pipeline. Implementations must respect the provided CancellationToken and exit on shutdown. update_types declares which Update variants may be emitted.

Required Methods§

Source

fn consume<'life0, 'async_trait>( &'life0 self, id: DatasourceId, sender: Sender<(Update, DatasourceId)>, cancellation_token: CancellationToken, ) -> Pin<Box<dyn Future<Output = CarbonResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn update_types(&self) -> Vec<UpdateType>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§