libdnf5::plugin
- std::vector< std::filesystem::path > LIBDNF_API libdnf5::plugin::get_config_dirs (const Base &base)
Get the list of directories from which libdnf5 plugin configuration is read.
- Parameters:
base – The Base instance to query for configuration
- Returns:
Vector of filesystem paths to plugin configuration directories
-
class StopRequest
- #include <iplugin.hpp>
The
StopRequestclass 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 theStopRequestclass (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
-
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::setupmethod (after theinithook).
-
virtual void post_base_setup()
The post_base_setup hook. It is called at the end of the
Base::setupmethod.
-
virtual void repos_configured()
The repos_configured hook. It is called in
Base::notify_repos_configuredmethod.
-
virtual void repos_loaded()
The repos_loaded hook. It is called at the end of the
RepoSack::load_reposmethod (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_packagesmethod.- 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_packagesmethod.
-
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.
Subclassed by libdnf5::plugin::IPlugin2_2
-
class IPlugin2_2 : public libdnf5::plugin::IPlugin2_1
- #include <iplugin.hpp>
Extended plugin interface with cleanup hooks introduced in version 2.2 of the plugin API.
Cleanup hooks are guaranteed to run regardless of whether the operation succeeded or failed. They are intended for releasing resources acquired in the pre hook. Each cleanup hook must only touch the plugin’s own local state.
Public Functions
-
explicit IPlugin2_2(IPluginData &data)
-
~IPlugin2_2()
-
virtual void post_base_setup_cleanup() noexcept
Cleanup hook guaranteed to run after Base::setup() completes (successfully or not).
-
virtual void post_add_cmdline_packages_cleanup() noexcept
Cleanup hook guaranteed to run after RepoSack::add_cmdline_packages() completes (successfully or not).
-
virtual void post_transaction_cleanup(const libdnf5::base::Transaction &transaction) noexcept
Cleanup hook guaranteed to run after the transaction run finishes (successfully or not).
- Parameters:
transaction – The same transaction object passed to pre_transaction()/post_transaction().
-
explicit IPlugin2_2(IPluginData &data)
-
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
nameattribute or nullptr
Public Members
-
class LIBDNF_LOCAL Impl
-
~PluginInfo()
-
struct Version
- #include <plugin_version.hpp>
Plugin version.