Trait Native Plugin

View as Markdown

Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-pii-redaction -p nemo-relay-ffi -p nemo-relay-types -p nemo-relay-plugin -p nemo-relay-worker-proto -p nemo-relay-worker.

pub trait NativePlugin: Send + 'static {
    // Required methods
    fn plugin_kind(&self) -> &str;
    fn register(
        &mut self,
        plugin_config: &Map<String, Json>,
        ctx: &mut PluginContext<'_>,
    ) -> Result<()>;
​
    // Provided methods
    fn allows_multiple_components(&self) -> bool { ... }
    fn executor_config(&self) -> NativeExecutorConfig { ... }
    fn executor_config_for_component(
        &self,
        plugin_config: &Map<String, Json>,
    ) -> Result<NativeExecutorConfig> { ... }
    fn validate(
        &self,
        plugin_config: &Map<String, Json>,
    ) -> Vec<ConfigDiagnostic> { ... }
}

Trait implemented by Rust native plugins.

Required Methods

plugin_kind

fn plugin_kind(&self) -> &str

Returns the stable plugin kind.

register

fn register(
    &mut self,
    plugin_config: &Map<String, Json>,
    ctx: &mut PluginContext<'_>,
) -> Result<()>

Registers runtime behavior through the component-scoped plugin context.

Provided Methods

allows_multiple_components

fn allows_multiple_components(&self) -> bool

Returns whether the plugin allows multiple configured components.

executor_config

fn executor_config(&self) -> NativeExecutorConfig

Configures the SDK-owned Tokio executor used by typed middleware.

This supplies the plugin-wide default. Relay applies an optional component-local [plugins.dynamic.config.executor] override when it registers each component.

executor_config_for_component

fn executor_config_for_component(
    &self,
    plugin_config: &Map<String, Json>,
) -> Result<NativeExecutorConfig>

Resolves the executor configuration for one component registration.

Override this only when the plugin needs custom component configuration rules. The default recognizes executor.worker_threads and validates that it is a positive integer.

validate

fn validate(&self, plugin_config: &Map<String, Json>) -> Vec<ConfigDiagnostic>

Validates one component-local JSON config object.

Implementors