VLink 2.0.0
A high-performance communication middleware
载入中...
搜索中...
未找到
conf_plugin_interface.h 文件参考

Plugin ABI for dynamically loaded transport Conf factories. 更多...

#include <memory>
#include "../base/plugin.h"
#include "./conf.h"
conf_plugin_interface.h 的引用(Include)关系图:

浏览该文件的源代码.

 Pure-virtual plugin interface for external transport Conf factories. 更多...

命名空间

详细描述

Plugin ABI for dynamically loaded transport Conf factories.

ConfPluginInterface is the abstract C++ interface that every externally loaded VLink transport plugin must implement. Plugins are shared libraries discovered at runtime via the VLINK_URL_PLUGINS environment variable (or the Url::init_plugins() call).

Plugin Discovery and Loading
When a Url is constructed and the built-in transport table does not recognise the transport field in the URL, Url::load_for_plugin() iterates over all loaded plugins and calls get_transport_type() on each to find a matching transport. If found, create() is called to obtain a fresh Conf instance for that transport.
Implementing a Plugin
// In your plugin shared library:
struct MyTransportPlugin final : public vlink::ConfPluginInterface {
return vlink::TransportType::kMyCustomTransport;
}
std::unique_ptr<vlink::Conf> create() const override {
return std::make_unique<MyTransportConf>();
}
};
VLINK_PLUGIN_EXPORT(MyTransportPlugin)
#define VLINK_PLUGIN_EXPORT
Macro Definitions
定义 plugin.h:329
注解
The VLINK_PLUGIN_EXPORT macro (from base/plugin.h) injects the symbol needed for the plugin loader to locate and instantiate this type.
Implementations must be stateless; create() may be called multiple times to produce independent Conf objects for different Url instances.