Skip to content

Commit

Permalink
Add a new method whether base was correctly initialized
Browse files Browse the repository at this point in the history
The methods is required in some applications with not exactly
transparent work-flows.

Resolves: #310
  • Loading branch information
j-mracek authored and m-blaha committed Feb 22, 2023
1 parent 9a0d1d5 commit e892f87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/libdnf/base/base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ class Base {
/// The method is supposed to be called after configuration is updated, application plugins applied
/// their pre configuration modification in configuration, but before repositories are loaded or any Package
/// or Advisory query created.
/// Calling the method for the second time result in throwing an exception
void setup();

/// Returns true when setup() (mandatory method in many workflows) was alredy called
bool is_initialized();

// TODO(jmracek) Remove from public API due to unstability of the code
transaction::TransactionHistoryWeakPtr get_transaction_history() { return transaction_history.get_weak_ptr(); }
libdnf::comps::CompsWeakPtr get_comps() { return comps.get_weak_ptr(); }
Expand Down
4 changes: 4 additions & 0 deletions libdnf/base/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,8 @@ void Base::setup() {
p_impl->plugins.post_base_setup();
}

bool Base::is_initialized() {
return p_impl->pool.get() != nullptr;
}

} // namespace libdnf

0 comments on commit e892f87

Please sign in to comment.