Skip to main content

SourcePlugin

Trait SourcePlugin 

Source
pub trait SourcePlugin:
    Send
    + Sync
    + 'static {
    // Required methods
    fn kind(&self) -> &'static str;
    fn config_schema(&self) -> Schema;
    fn build(
        &self,
        name: &SourceName,
        config: &Value,
        secrets: &dyn SecretResolver,
    ) -> Result<Box<dyn TaskSource>, SourceError>;
}
Expand description

The factory that turns one configuration block into a live TaskSource.

Having the compile-time registry and the subprocess seam be the same shape is the whole reason this is a trait rather than a free function.

Required Methods§

Source

fn kind(&self) -> &'static str

The name a configuration document’s plugin: field names.

Source

fn config_schema(&self) -> Schema

The JSON Schema for this plugin’s own config: block.

Source

fn build( &self, name: &SourceName, config: &Value, secrets: &dyn SecretResolver, ) -> Result<Box<dyn TaskSource>, SourceError>

Build a live source from one configuration block.

name is the configured source’s name, for error messages only — a plugin never learns it for any other purpose.

§Errors

Returns SourceError::Config when config is not valid for this plugin, or SourceError::Auth when a named credential is absent.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§