Skip to main content

export_plugin

Macro export_plugin 

Source
macro_rules! export_plugin {
    (
        plugin_id = $plugin_id:expr,
        core_version = $core_ver:expr,
        lib_version = $lib_ver:expr,
        plugin_version = $plugin_ver:expr,
        source_descriptors = [ $($source_desc:expr),* $(,)? ],
        reaction_descriptors = [ $($reaction_desc:expr),* $(,)? ],
        bootstrap_descriptors = [ $($bootstrap_desc:expr),* $(,)? ],
        worker_threads = $workers:expr $(,)?
    ) => { ... };
    (
        plugin_id = $plugin_id:expr,
        core_version = $core_ver:expr,
        lib_version = $lib_ver:expr,
        plugin_version = $plugin_ver:expr,
        source_descriptors = [ $($source_desc:expr),* $(,)? ],
        reaction_descriptors = [ $($reaction_desc:expr),* $(,)? ],
        bootstrap_descriptors = [ $($bootstrap_desc:expr),* $(,)? ] $(,)?
    ) => { ... };
    (
        @internal
        plugin_id = $plugin_id:expr,
        core_version = $core_ver:expr,
        lib_version = $lib_ver:expr,
        plugin_version = $plugin_ver:expr,
        init_fn = $init_fn:ident,
        default_workers = $default_workers:expr $(,)?
    ) => { ... };
}
Expand description

Export dynamic plugin entry points with FFI vtables.

Generates:

  • drasi_plugin_metadata() → version info for validation
  • drasi_plugin_init()FfiPluginRegistration with vtable factories
  • Plugin-local tokio runtime, FfiLogger, lifecycle callbacks

§Usage

drasi_plugin_sdk::export_plugin!(
    plugin_id = "postgres",
    core_version = "0.1.0",
    lib_version = "0.3.8",
    plugin_version = "1.0.0",
    source_descriptors = [PostgresSourceDescriptor],
    reaction_descriptors = [],
    bootstrap_descriptors = [PostgresBootstrapDescriptor],
);

An optional worker_threads parameter sets the default number of tokio worker threads for the plugin’s runtime (default: 2). This can be overridden at deploy time via the DRASI_PLUGIN_WORKERS environment variable.

drasi_plugin_sdk::export_plugin!(
    plugin_id = "postgres",
    // ...
    bootstrap_descriptors = [PostgresBootstrapDescriptor],
    worker_threads = 4,
);