libdnf5::transaction
-
enum class libdnf5::transaction::TransactionState : int
Values:
-
enumerator STARTED
-
enumerator OK
-
enumerator ERROR
-
enumerator STARTED
-
enum class libdnf5::transaction::TransactionItemAction : int
Values:
-
enumerator INSTALL
-
enumerator UPGRADE
-
enumerator DOWNGRADE
-
enumerator REINSTALL
-
enumerator REMOVE
-
enumerator REPLACED
-
enumerator REASON_CHANGE
-
enumerator ENABLE
-
enumerator DISABLE
-
enumerator RESET
-
enumerator SWITCH
-
enumerator INSTALL
-
enum class libdnf5::transaction::TransactionItemReason : int
Values:
-
enumerator NONE
-
enumerator DEPENDENCY
-
enumerator USER
-
enumerator CLEAN
-
enumerator WEAK_DEPENDENCY
-
enumerator GROUP
-
enumerator EXTERNAL_USER
-
enumerator NONE
-
enum class libdnf5::transaction::TransactionItemState : int
Values:
-
enumerator STARTED
-
enumerator OK
-
enumerator ERROR
-
enumerator STARTED
-
enum class libdnf5::transaction::TransactionItemType : int
Values:
-
enumerator PACKAGE
-
enumerator GROUP
-
enumerator ENVIRONMENT
-
enumerator MODULE
-
enumerator PACKAGE
-
using libdnf5::transaction::TransactionWeakPtr = libdnf5::WeakPtr<Transaction, false>
-
using libdnf5::transaction::TransactionHistoryWeakPtr = libdnf5::WeakPtr<TransactionHistory, false>
- LIBDNF_API std::string libdnf5::transaction::transaction_state_to_string (TransactionState state)
- LIBDNF_API TransactionState libdnf5::transaction::transaction_state_from_string (const std::string &state)
- LIBDNF_API std::string libdnf5::transaction::transaction_item_action_to_string (TransactionItemAction action)
- LIBDNF_API TransactionItemAction libdnf5::transaction::transaction_item_action_from_string (const std::string &action)
- LIBDNF_API std::string libdnf5::transaction::transaction_item_action_to_letter (TransactionItemAction action)
- LIBDNF_API bool libdnf5::transaction::transaction_item_action_is_inbound (TransactionItemAction action)
- LIBDNF_API bool libdnf5::transaction::transaction_item_action_is_outbound (TransactionItemAction action)
- LIBDNF_API std::string libdnf5::transaction::transaction_item_reason_to_string (TransactionItemReason reason)
- LIBDNF_API TransactionItemReason libdnf5::transaction::transaction_item_reason_from_string (const std::string &reason)
- LIBDNF_API int libdnf5::transaction::transaction_item_reason_compare (TransactionItemReason lhs, TransactionItemReason rhs)
Compare transaction items and return: -1 if lhs < rhs 1 if lhs > rhs 0 if lhs == rhs Higher number means a better (or a stronger) reason.
- LIBDNF_API bool libdnf5::transaction::operator< (TransactionItemReason lhs, TransactionItemReason rhs)
- LIBDNF_API bool libdnf5::transaction::operator<= (TransactionItemReason lhs, TransactionItemReason rhs)
- LIBDNF_API bool libdnf5::transaction::operator> (TransactionItemReason lhs, TransactionItemReason rhs)
- LIBDNF_API bool libdnf5::transaction::operator>= (TransactionItemReason lhs, TransactionItemReason rhs)
- LIBDNF_API std::string libdnf5::transaction::transaction_item_state_to_string (TransactionItemState state)
- LIBDNF_API TransactionItemState libdnf5::transaction::transaction_item_state_from_string (const std::string &state)
- LIBDNF_API std::string libdnf5::transaction::transaction_item_type_to_string (TransactionItemType action)
- LIBDNF_API TransactionItemType libdnf5::transaction::transaction_item_type_from_string (const std::string &action)
-
class CompsEnvironment : public libdnf5::transaction::TransactionItem
- #include <comps_environment.hpp>
CompsEnvironment contains a copy of important data from comps::CompsEnvironment that is used to perform comps transaction and then stored in the transaction (history) database.
Public Functions
-
std::string to_string() const
Get string representation of the object, which equals to environment_id
-
CompsEnvironment(const CompsEnvironment &src)
-
CompsEnvironment &operator=(const CompsEnvironment &src)
-
CompsEnvironment(CompsEnvironment &&src) noexcept
-
CompsEnvironment &operator=(CompsEnvironment &&src) noexcept
-
~CompsEnvironment()
-
std::string to_string() const
-
class CompsEnvironmentGroup
Public Functions
-
~CompsEnvironmentGroup()
-
CompsEnvironmentGroup(const CompsEnvironmentGroup &src)
-
CompsEnvironmentGroup &operator=(const CompsEnvironmentGroup &src)
-
CompsEnvironmentGroup(CompsEnvironmentGroup &&src) noexcept
-
CompsEnvironmentGroup &operator=(CompsEnvironmentGroup &&src) noexcept
-
CompsEnvironmentGroup()
-
~CompsEnvironmentGroup()
-
class CompsGroup : public libdnf5::transaction::TransactionItem
- #include <comps_group.hpp>
CompsGroup contains a copy of important data from comps::CompsGroup that is used to perform comps transaction and then stored in the transaction (history) database.
Public Functions
-
std::string to_string() const
Get string representation of the object, which equals to group_id
-
libdnf5::comps::PackageType get_package_types() const noexcept
Get types of the packages to be installed with the group (related xml elements:
<comps><group><packagelist><packagereq type="VALUE" ...>
)
-
CompsGroup(const CompsGroup &src)
-
CompsGroup &operator=(const CompsGroup &src)
-
CompsGroup(CompsGroup &&src) noexcept
-
CompsGroup &operator=(CompsGroup &&src) noexcept
-
~CompsGroup()
-
std::string to_string() const
-
class CompsGroupPackage
- #include <comps_group.hpp>
CompsGroupPackage represents a package associated with a comps group
Public Functions
-
~CompsGroupPackage()
-
CompsGroupPackage(const CompsGroupPackage &src)
-
CompsGroupPackage &operator=(const CompsGroupPackage &src)
-
CompsGroupPackage(CompsGroupPackage &&src) noexcept
-
CompsGroupPackage &operator=(CompsGroupPackage &&src) noexcept
-
CompsGroupPackage()
-
~CompsGroupPackage()
-
class InvalidTransactionItemAction : public libdnf5::Error
Public Functions
-
InvalidTransactionItemAction(const std::string &action)
-
inline virtual const char *get_domain_name() const noexcept override
- Returns:
The domain name (namespace and enclosing class names) of the exception.
-
inline virtual const char *get_name() const noexcept override
- Returns:
The exception class name.
-
InvalidTransactionItemAction(const std::string &action)
-
class InvalidTransactionItemReason : public libdnf5::Error
Public Functions
-
InvalidTransactionItemReason(const std::string &reason)
-
inline virtual const char *get_domain_name() const noexcept override
- Returns:
The domain name (namespace and enclosing class names) of the exception.
-
inline virtual const char *get_name() const noexcept override
- Returns:
The exception class name.
-
InvalidTransactionItemReason(const std::string &reason)
-
class InvalidTransactionItemState : public libdnf5::Error
Public Functions
-
InvalidTransactionItemState(const std::string &state)
-
inline virtual const char *get_domain_name() const noexcept override
- Returns:
The domain name (namespace and enclosing class names) of the exception.
-
inline virtual const char *get_name() const noexcept override
- Returns:
The exception class name.
-
InvalidTransactionItemState(const std::string &state)
-
class InvalidTransactionItemType : public libdnf5::Error
Public Functions
-
InvalidTransactionItemType(const std::string &type)
-
inline virtual const char *get_domain_name() const noexcept override
- Returns:
The domain name (namespace and enclosing class names) of the exception.
-
inline virtual const char *get_name() const noexcept override
- Returns:
The exception class name.
-
InvalidTransactionItemType(const std::string &type)
-
class InvalidTransactionState : public libdnf5::Error
Public Functions
-
InvalidTransactionState(const std::string &state)
-
inline virtual const char *get_domain_name() const noexcept override
- Returns:
The domain name (namespace and enclosing class names) of the exception.
-
inline virtual const char *get_name() const noexcept override
- Returns:
The exception class name.
-
InvalidTransactionState(const std::string &state)
-
class Package : public libdnf5::transaction::TransactionItem
- #include <rpm_package.hpp>
Package contains a copy of important data from rpm::Package that is used to perform rpm transaction and then stored in the transaction (history) database.
Public Functions
-
const std::string &get_name() const noexcept
Get package name
-
const std::string &get_epoch() const noexcept
Get package epoch
-
const std::string &get_release() const noexcept
Get package release
-
const std::string &get_arch() const noexcept
Get package arch
-
const std::string &get_version() const noexcept
Get package version
-
std::string to_string() const
Get string representation of the object, which equals to package NEVRA
-
~Package()
-
const std::string &get_name() const noexcept
-
class Transaction
- #include <transaction.hpp>
Transaction holds information about a transaction. It contains transaction items such as packages, comps groups and environments. Transaction object are used to retrieve information about past transactions from the transaction history database as well as for performing a transaction to change packages on disk.
Public Types
-
using State = TransactionState
Public Functions
-
virtual ~Transaction()
-
Transaction(const Transaction &src)
-
Transaction &operator=(const Transaction &src)
-
Transaction(Transaction &&src) noexcept
-
Transaction &operator=(Transaction &&src) noexcept
-
bool operator==(const Transaction &other) const
-
bool operator<(const Transaction &other) const
-
bool operator>(const Transaction &other) const
-
int64_t get_id() const noexcept
Get Transaction database id (primary key) Return 0 if the id wasn’t set yet
-
int64_t get_dt_start() const noexcept
Get date and time of the transaction start
-
int64_t get_dt_end() const noexcept
Get date and time of the transaction end
-
const std::string &get_rpmdb_version_begin() const noexcept
Get RPM database version before the transaction Format:
<rpm_count>
:<sha1 of sorted SHA1HEADER fields of installed RPMs>
-
const std::string &get_rpmdb_version_end() const noexcept
Get RPM database version after the transaction Format:
<rpm_count>
:<sha1 of sorted SHA1HEADER fields of installed RPMs>
-
const std::string &get_releasever() const noexcept
Get $releasever variable value that was used during the transaction
-
uint32_t get_user_id() const noexcept
Get UID of a user that started the transaction
-
const std::string &get_description() const noexcept
Get the description of the transaction (e.g. the CLI command that was executed)
-
const std::string &get_comment() const noexcept
Get a user-specified comment describing the transaction.
-
std::vector<CompsEnvironment> &get_comps_environments()
Return all comps environments associated with the transaction
-
std::vector<CompsGroup> &get_comps_groups()
Return all comps groups associated with the transaction
-
std::string serialize()
Warning
This method is experimental/unstable and should not be relied on. It may be removed without warning Serialize the transaction into a json data format which can be later loaded into a
libdnf5::Goal
and replayed.
-
BaseWeakPtr get_base() const
- Returns:
A
Base
object to which the transaction belongs.
-
using State = TransactionState
-
class TransactionHistory
- #include <transaction_history.hpp>
A class for working with transactions recorded in the transaction history database.
Public Functions
-
explicit TransactionHistory(const libdnf5::BaseWeakPtr &base)
-
explicit TransactionHistory(libdnf5::Base &base)
-
~TransactionHistory()
-
TransactionHistory(const TransactionHistory &src) = delete
-
TransactionHistory &operator=(const TransactionHistory &src) = delete
-
TransactionHistory(TransactionHistory &&src) noexcept = delete
-
TransactionHistory &operator=(TransactionHistory &&src) noexcept = delete
-
TransactionHistoryWeakPtr get_weak_ptr()
-
std::vector<int64_t> list_transaction_ids()
Lists all transaction IDs from the transaction history database. The result is sorted in ascending order.
- Returns:
The list of transaction IDs.
-
std::vector<Transaction> list_transactions(const std::vector<int64_t> &ids)
Lists transactions from the transaction history for transaction ids in
ids
.- Parameters:
ids – The ids to list.
- Returns:
The listed transactions.
-
std::vector<Transaction> list_transactions(int64_t start, int64_t end)
Lists transactions from the transaction history for transaction ids within the [start, end] range (inclusive).
- Parameters:
start – The first id of the range to be listed.
end – The last id of the range to be listed.
- Returns:
The listed transactions.
-
std::vector<Transaction> list_all_transactions()
Lists all transactions from the transaction history.
- Returns:
The listed transactions.
-
libdnf5::BaseWeakPtr get_base() const
- Since
5.0
- Returns:
The
Base
object to which this object belongs.
-
TransactionItemReason transaction_item_reason_at(const std::string &name, const std::string &arch, int64_t transaction_id_point)
Get reason for package specified by name and arch at a point in history specified by transaction id.
- Parameters:
name – Name of rpm package
arch – Arch of rpm package
transaction_id_point – Id of a history transaction (can be obtained from libdnf5::transaction::TransactionHistory)
- Returns:
Reason of the last transaction item before transaction_id_point that has an rpm with matching name and arch.
-
std::unordered_map<int64_t, int64_t> get_transaction_item_counts(const std::vector<Transaction> &transactions)
Get counts of transaction items for specified transactions. It gets the counts in a single db query.
- Parameters:
transactions – Get counts for these transactions.
- Returns:
Mapped transaction id -> count.
-
void filter_transactions_by_pkg_names(std::vector<Transaction> &transactions, const std::vector<std::string> &pkg_names)
Filter out transactions that don’t contain any rpm with matching name
- Parameters:
transactions – Vector of Transactions to filter
pkg_names – Vector of rpm package names to match
-
explicit TransactionHistory(const libdnf5::BaseWeakPtr &base)
-
class TransactionItem
Subclassed by libdnf5::transaction::CompsEnvironment, libdnf5::transaction::CompsGroup, libdnf5::transaction::Package
Public Types
-
using Action = TransactionItemAction
-
using Reason = TransactionItemReason
-
using State = TransactionItemState
Public Functions
-
Action get_action() const noexcept
Get action associated with the transaction item in the transaction
-
Reason get_reason() const noexcept
Get reason of the action associated with the transaction item in the transaction
-
const std::string &get_repoid() const noexcept
Get transaction item repoid (text identifier of a repository)
-
~TransactionItem()
-
TransactionItem(const TransactionItem &src)
-
TransactionItem &operator=(const TransactionItem &src)
-
TransactionItem(TransactionItem &&src) noexcept
-
TransactionItem &operator=(TransactionItem &&src) noexcept
-
using Action = TransactionItemAction