Macro coprocessor_plugin_api::declare_plugin [−][src]
Declare a plugin for the library so that it can be loaded by TiKV.
The macro has three different versions:
declare_plugin!(plugin_name, plugin_version, plugin_ctor)
which gives you full control.declare_plugin!(plugin_name, plugin_ctor)
automatically fetches the version fromCargo.toml
.declare_plugin!(plugin_ctor)
automatically fetches plugin name and version fromCargo.toml
.
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.