Skip to main content

SchemaProvider

Trait SchemaProvider 

Source
pub trait SchemaProvider: Send + Sync {
    // Required method
    fn provide_schema<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = SchemaResult<SchemaRef>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn is_authoritative(&self) -> bool { ... }
    fn field_metadata<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = SchemaResult<HashMap<String, FieldMeta>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

A connector that can provide its schema from the source system.

Examples: PostgreSQL CDC reading information_schema, a Kafka topic with an embedded Avro schema, or a file source with a header row.

Required Methods§

Source

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

Fetches the schema from the source system.

§Errors

Returns a schema error if the schema cannot be retrieved.

Provided Methods§

Source

fn is_authoritative(&self) -> bool

Returns true if this provider’s schema is authoritative (i.e., should take precedence over inference).

Source

fn field_metadata<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = SchemaResult<HashMap<String, FieldMeta>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns per-field metadata for the provided schema.

Default returns an empty map.

Implementors§