The zenoh router (
zenohd executable) supports the loading of plugins at start-up.
A zenoh plugin is a library that can be loaded by the zenoh router at start-up. It shares a runtime with it, allowing the plugin to use the regular zenoh rust APIs with the same peer ID.
Zenoh already provides the following plugins in its default repository:
- the REST plugin: providing the zenoh REST API
- the Storages plugin: providing management of storages and backends
By default the zenoh router will automatically search for and load plugins library files with these names:
- on Unix/Linux:
- on macOS:
- on Windows:
The list of paths in which the zenoh router will search for plugins can be configured via the
--plugin-search-dir option (this can be repeated to specify several directories). The default list can be seen using the
This automatic search and load of plugins can be deactivated using the
Plugin library files to load manually can be specified using the
--plugin option (repeatable). In this case, the complete path of the library file must be specified, and its filename can be anything.
Zenoh 0.6 has had its configuration and plugin infrastructure overhauled. The most major change is that
zenohd no longer loads all available plugins at startup. Instead, only plugins that appear in the configuration are loaded.
This choice was made to reduce side effects, as loading all available plugins can lead to loading plugins that have behaviour you do not expect, or that may have weird interractions when running side-by-side.
The configuration has 2 fields that pertain to plugins:
plugin_search_dirs, where you may specify a list of directories where
zenohdshould look for plugins that have been requested by name.
plugins, where you may specify which plugins you require, as well as provide configuration for them.
Plugins can no longer add CLI arguments to those of
zenohd. Instead, they are expected to obtain the information they need to run through the new configuration infrastructure.
--plugin... arguments have also seen their purpose slightly changed:
--plugin-nolookupno longer exists, as this is now the normal behaviour of
--plugin-search-dirnow replaces the search directories specified through configuration.
--plugin [VALUE]now inserts a plugin into the configuration. If VALUE is a path, it will be requested by path. Otherwise, it will be requested by name.
plugins configuration field
This field may contain a dictionary, where each key is the configured plugin’s name, and the associated value is a dictionary holding its configuration.
In this latter dictionary, 2 properties are reserved by
__path__may hold a string or list of strings, which are the paths where the plugin is expected to be located. If this option is defined, lookup-by-name is disabled for the requested plugin, and the first path to resolve in a successful load will be used as the plugin’s path.
__required__may hold a boolean value. If set to
zenohdwill panic if unable to load the requested plugin. Otherwise, it will simply log an error. Plugins are encouraged to look to this field to assertain whether they should be allowed to panic or not.
The rest of the dictionary may be used by plugins as they see fit. If elements of their configuration are modified at runtime, plugins will be given a change to observe the modification and interfere in it.