Base

class Base

Instances of :class:libdnf::Base are the central point of functionality supplied by libdnf. An application will typically create a single instance of this class which it will keep for the run-time needed to accomplish its packaging tasks. :class:.Base instances are stateful objects owning various data.

Public Functions

void lock()

Sets the pointer to the locked instance “Base” to “this” instance. Blocks if the pointer is already set. Pointer to a locked “Base” instance can be obtained using “get_locked_base()”.

void unlock()

Resets the pointer to a locked “Base” instance to “nullptr”. Throws an exception if another or no instance is locked.

void load_config_from_file()

Loads main configuration from file defined by the current configuration.

void setup()

Load vars from environment, varsdirs and installroot (releasever, arch). To prevent differences between configuration and internal Base settings, following configurations will be locked: installroot, varsdir. The method is supposed to be called after configuration is updated, plugins applied their pre configuration modification in configuration, but before repositories are loaded or any Package or Advisory query created.

inline VarsWeakPtr get_vars()

Gets base variables. They can be used in configuration files. Syntax in the config - ${var_name} or $var_name.

inline libdnf::system::State &get_system_state()

Since

5.0

Returns

The system state object.

Public Static Functions

static Base *get_locked_base() noexcept

Returns a pointer to a locked “Base” instance or “nullptr” if no instance is locked.