Macro coprocessor_plugin_api::declare_plugin[][src]

macro_rules! declare_plugin {
    ($plugin_ctor:expr) => { ... };
    ($plugin_name:expr, $plugin_ctor:expr) => { ... };
    ($plugin_name:expr, $plugin_version:expr, $plugin_ctor:expr) => { ... };
}

Declare a plugin for the library so that it can be loaded by TiKV.

The macro has three different versions:

The types of plugin_name and plugin_version have to be &'static str literals.

Notes

This works by automatically generating an extern "C" function with a pre-defined signature and symbol name. Therefore you will only be able to declare one plugin per library.

Further, it sets the #[global_allocator] of the plugin to use the hosts allocator. This makes passing owned data between TiKV and plugin easier but at the cost of not being able to use a custom allocator.