|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Concrete implementation of plugin_loader using OS dynamic loading APIs. More...
#include <plugin_loader.h>


Classes | |
| struct | plugin_entry |
| Information about a loaded plugin. More... | |
Public Member Functions | |
| dynamic_plugin_loader () | |
| ~dynamic_plugin_loader () override | |
| dynamic_plugin_loader (const dynamic_plugin_loader &)=delete | |
| dynamic_plugin_loader & | operator= (const dynamic_plugin_loader &)=delete |
| dynamic_plugin_loader (dynamic_plugin_loader &&) noexcept | |
| dynamic_plugin_loader & | operator= (dynamic_plugin_loader &&) noexcept |
| auto | load_plugin (std::string_view path) -> std::unique_ptr< collector_plugin > override |
| Load a plugin from a shared library. | |
| auto | unload_plugin (std::string_view plugin_name) -> bool override |
| Unload a previously loaded plugin. | |
| auto | get_last_error () const -> plugin_load_error override |
| Get the last error that occurred. | |
| auto | get_last_error_message () const -> std::string override |
| Get detailed error message for the last error. | |
| auto | is_plugin_loaded (std::string_view plugin_name) const -> bool override |
| Check if a plugin is currently loaded. | |
| auto | get_loaded_plugins () const -> std::vector< std::string > override |
| Get list of loaded plugin names. | |
Public Member Functions inherited from kcenon::monitoring::plugin_loader | |
| virtual | ~plugin_loader ()=default |
Private Member Functions | |
| auto | load_library (std::string_view path) -> std::unique_ptr< library_handle > |
| Load a library file. | |
| void | unload_library (std::unique_ptr< library_handle > handle) |
| Unload a library. | |
| template<typename T > | |
| auto | resolve_symbol (library_handle *handle, const char *symbol_name) -> T |
| Resolve a symbol from a library. | |
| auto | verify_api_version (const plugin_api_metadata &metadata) const -> bool |
| Verify plugin API version compatibility. | |
| void | set_error (plugin_load_error error, std::string message) |
| Set error state. | |
Private Attributes | |
| std::unordered_map< std::string, plugin_entry > | loaded_plugins_ |
| plugin_load_error | last_error_ {plugin_load_error::none} |
| std::string | last_error_message_ |
| std::mutex | mutex_ |
Concrete implementation of plugin_loader using OS dynamic loading APIs.
This class uses platform-specific APIs:
Thread Safety:
Definition at line 150 of file plugin_loader.h.
| kcenon::monitoring::dynamic_plugin_loader::dynamic_plugin_loader | ( | ) |
|
override |
|
delete |
|
noexcept |
|
overridevirtual |
|
overridevirtual |
Get detailed error message for the last error.
Implements kcenon::monitoring::plugin_loader.
|
overridevirtual |
Get list of loaded plugin names.
Implements kcenon::monitoring::plugin_loader.
|
overridevirtual |
Check if a plugin is currently loaded.
| plugin_name | Name of the plugin |
Implements kcenon::monitoring::plugin_loader.
|
private |
Load a library file.
| path | Library file path |
|
overridevirtual |
Load a plugin from a shared library.
| path | Path to the plugin library (.so/.dylib/.dll) |
The loader will:
On failure, check get_last_error() for details.
Implements kcenon::monitoring::plugin_loader.
|
delete |
|
noexcept |
|
private |
Resolve a symbol from a library.
| T | Function pointer type |
| handle | Library handle |
| symbol_name | Symbol name to resolve |
|
private |
Set error state.
| error | Error code |
| message | Detailed error message |
|
private |
Unload a library.
| handle | Library handle to unload |
|
overridevirtual |
Unload a previously loaded plugin.
| plugin_name | Name of the plugin to unload |
This will:
The plugin instance must have been destroyed before calling this.
Implements kcenon::monitoring::plugin_loader.
|
private |
Verify plugin API version compatibility.
| metadata | Plugin API metadata |
|
private |
Definition at line 237 of file plugin_loader.h.
|
private |
Definition at line 238 of file plugin_loader.h.
|
private |
Definition at line 234 of file plugin_loader.h.
|
mutableprivate |
Definition at line 241 of file plugin_loader.h.