Skip to main content

DataSourceProvider

Trait DataSourceProvider 

Source
pub trait DataSourceProvider: Send + Sync {
    // Required method
    fn fetch<'life0, 'async_trait>(
        &'life0 self,
        request: FetchRequest,
    ) -> Pin<Box<dyn Future<Output = Result<FetchResult, FetchError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

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

Provider dispatch + fetch trait. Host apps implement this for their custom data sources (BigQuery, Snowflake, internal REST APIs, …) and register them via ChartML::register_provider(kind, provider).

?Send on WASM matches TransformMiddleware so single-threaded browser environments can hold non-Send state inside provider impls.

Required Methods§

Source

fn fetch<'life0, 'async_trait>( &'life0 self, request: FetchRequest, ) -> Pin<Box<dyn Future<Output = Result<FetchResult, FetchError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetch one source. The resolver handles caching + dedup + parallelism; providers only see this single call per actual upstream invocation.

Provided Methods§

Source

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

Optional graceful shutdown hook. Called by ChartML::shutdown() on SSR request end / tab close. Default no-op so providers that hold no pooled resources don’t have to implement it.

Implementors§