libdnf5::plugin
-
class IPlugin
- #include <iplugin.hpp>
A base class for implementing LIBDNF5 plugins that introduce additional logic into the library using hooks.
Subclassed by libdnf5::plugin::IPlugin2_1
Public Functions
-
explicit IPlugin(IPluginData &data)
-
virtual ~IPlugin()
-
IPlugin() = delete
-
virtual PluginAPIVersion get_api_version() const noexcept = 0
Returns the version of the API supported by the plugin. It can be called at any time.
-
virtual const char *get_name() const noexcept = 0
Returns the name of the plugin. It can be called at any time.
-
virtual Version get_version() const noexcept = 0
Gets the plugin version. It can be called at any time.
-
virtual const char *const *get_attributes() const noexcept = 0
- Returns:
A nullptr terminated array of attributes supported by the plugin.
-
virtual const char *get_attribute(const char *name) const noexcept = 0
Gets the value of the attribute from the plugin. Returns nullptr if the attribute does not exist. It can be called at any time.
-
virtual void load_plugins()
The plugin can load additional plugins. E.g. C++ plugin for loading Python plugins. Called before init.
-
virtual void init()
Plugin initialization. Called before hooks.
-
virtual void pre_base_setup()
The pre_base_setup hook. It is called at the beginning of the
Base::setup
method (after theinit
hook).
-
virtual void post_base_setup()
The post_base_setup hook. It is called at the end of the
Base::setup
method.
-
virtual void repos_configured()
The repos_configured hook. It is called in
Base::notify_repos_configured
method.
-
virtual void repos_loaded()
The repos_loaded hook. It is called at the end of the
RepoSack::load_repos
method (in Impl).
-
virtual void pre_add_cmdline_packages(const std::vector<std::string> &paths)
The pre_add_cmdline_packages hook. It is called at the beginning of the
RepoSack::add_cmdline_packages
method.- Parameters:
paths – Vector of paths (local files or URLs) to package files to be inserted into cmdline repo.
-
virtual void post_add_cmdline_packages()
The post_add_cmdline_packages hook. It is called at the end of the
RepoSack::add_cmdline_packages
method.
-
virtual void pre_transaction(const libdnf5::base::Transaction &transaction)
The pre_transaction hook. It is called just before the actual transaction starts.
- Parameters:
transaction – Contains the transaction that will be started.
-
virtual void post_transaction(const libdnf5::base::Transaction &transaction)
The post_transaction hook. It is called after transactions.
- Parameters:
transaction – Contains the completed transaction.
-
virtual void finish() noexcept
Finish the plugin and release all resources obtained by the init method and in hooks.
-
Base &get_base() const noexcept
-
explicit IPlugin(IPluginData &data)
-
class IPlugin2_1 : public libdnf5::plugin::IPlugin
- #include <iplugin.hpp>
Extended plugin interface with additional hooks introduced in version 2.1 of the plugin API.
-
class PluginInfo
Public Functions
-
~PluginInfo()
-
PluginInfo(const PluginInfo &src)
-
PluginInfo(PluginInfo &&src) noexcept
-
PluginInfo &operator=(const PluginInfo &src)
-
PluginInfo &operator=(PluginInfo &&src) noexcept
-
PluginInfo() = delete
-
const std::string &get_name() const noexcept
- Returns:
the real name of the plugin or derived from the configuration file if the plugin is not loaded
-
bool is_loaded() const noexcept
- Returns:
true if the plugin is loaded
-
PluginAPIVersion get_api_version() const noexcept
- Returns:
the version of the API supported by the plugin, or zeros if the plugin is not loaded
-
const char *get_real_name() const noexcept
- Returns:
the real plugin name (returned from plugin) or nullptr if the plugin is not loaded
-
Version get_version() const noexcept
- Returns:
the version of the plugin, or zeros if the plugin is not loaded
-
const char *const *get_attributes() const noexcept
- Returns:
a nullptr terminated array of attributes supported by the plugin or nullptr if the plugin is not loaded
-
const char *get_attribute(const char *name) const noexcept
Gets the value of the attribute from the plugin. Returns nullptr if the attribute does not exist or plugin is not loaded.
- Returns:
the value of the
name
attribute or nullptr
Public Members
-
class LIBDNF_LOCAL Impl
-
~PluginInfo()
-
class StopRequest
- #include <iplugin.hpp>
The
StopRequest
class is used to mark a plugin-generated exception as a stop request. The stop request is not caused by an error in the plugin runtime, but is a plugin request. The exception is marked by inheriting from theStopRequest
class (using multiple inheritance).Public Functions
-
StopRequest() noexcept
-
StopRequest(const StopRequest &other) noexcept
-
StopRequest(StopRequest &&other) noexcept
-
~StopRequest()
-
StopRequest &operator=(const StopRequest &other) noexcept
-
StopRequest &operator=(StopRequest &&other) noexcept
-
StopRequest() noexcept
-
struct Version
- #include <plugin_version.hpp>
Plugin version.