Manage access to librpm database.
More...
#include <librpmDb.h>
|
| librpmDb (const Pathname &root_r, const Pathname &dbPath_r, bool readonly_r) |
| Private constructor! librpmDb objects are to be created via static interface only. More...
|
|
virtual void | unref_to (unsigned refCount_r) const |
| Trigger from Rep, after refCount was decreased. More...
|
|
virtual void | ref_to (unsigned) const |
| Trigger derived classes after refCount was increased. More...
|
|
Manage access to librpm database.
Definition at line 38 of file librpmDb.h.
zypp::target::rpm::librpmDb::librpmDb |
( |
const Pathname & |
root_r, |
|
|
const Pathname & |
dbPath_r, |
|
|
bool |
readonly_r |
|
) |
| |
|
protected |
Private constructor! librpmDb objects are to be created via static interface only.
Definition at line 374 of file librpmDb.cc.
zypp::target::rpm::librpmDb::~librpmDb |
( |
| ) |
|
|
virtual |
static void zypp::target::rpm::librpmDb::dbAccess |
( |
librpmDb::Ptr & |
ptr_r | ) |
|
|
staticprivate |
INTENTIONALLY UNDEFINED<> because of bug in Ptr classes which allows implicit conversion from librpmDb::Ptr to librpmDb::constPtr.
Currently we don't want to provide non const handles, as the database is opened READONLY.
- Exceptions
-
librpmDb * zypp::target::rpm::librpmDb::newLibrpmDb |
( |
Pathname |
root_r, |
|
|
Pathname |
dbPath_r, |
|
|
bool |
readonly_r |
|
) |
| |
|
staticprivate |
For internal use.
Pointer returned should immediately be wrapped into librpmDb::Ptr.
- Exceptions
-
Definition at line 179 of file librpmDb.cc.
void zypp::target::rpm::librpmDb::dbAccess |
( |
| ) |
|
|
staticprivate |
Access the database at the current default location.
If necessary (eg. after dbRelease), the database is opened. This just creates the internal handle. Once the handle is passed to e.g. some db_const_iterator, the database will be closed if the last outstanding reference goes out of scope. If no external reference is created, you'll have to explicitly call dbRelease to close the database.
- Exceptions
-
Definition at line 248 of file librpmDb.cc.
bool zypp::target::rpm::librpmDb::globalInit |
( |
| ) |
|
|
static |
Initialize lib librpm (read configfiles etc.).
It's called on demand but you may call it anytime.
- Returns
- Whether librpm is initialized.
Definition at line 128 of file librpmDb.cc.
std::string zypp::target::rpm::librpmDb::expand |
( |
const std::string & |
macro_r | ) |
|
|
static |
- Returns
- librpm macro expansion.
Definition at line 159 of file librpmDb.cc.
static std::string zypp::target::rpm::librpmDb::stringPath |
( |
const Pathname & |
root_r, |
|
|
const Pathname & |
sub_r |
|
) |
| |
|
inlinestatic |
- Returns
- String '(root_r)sub_r' used in debug output.
Definition at line 127 of file librpmDb.h.
static const Pathname& zypp::target::rpm::librpmDb::defaultRoot |
( |
| ) |
|
|
inlinestatic |
- Returns
- Current root directory for all operations.
Definition at line 137 of file librpmDb.h.
static const Pathname& zypp::target::rpm::librpmDb::defaultDbPath |
( |
| ) |
|
|
inlinestatic |
- Returns
- Current directory (below root) that contains the rpmdb.
Definition at line 145 of file librpmDb.h.
void zypp::target::rpm::librpmDb::dbAccess |
( |
const Pathname & |
root_r, |
|
|
const Pathname & |
dbPath_r |
|
) |
| |
|
static |
Adjust access to the given database location, making it the new default location on success.
No relative Pathnames are allowed.
It's not possible to access a database while access is blocked (see blockAccess), but valid Pathnames provided will be stored as new default location.
It's not allowed to switch to another location while a database is accessed. Use dbRelease to force releasing the database first.
- Exceptions
-
Definition at line 215 of file librpmDb.cc.
Same as &ref dbAccess(), but returns the database handle if avaialble, otherwise NULL.
This creates an external reference, thus it should not be used longer than necessary. Be prepared that the handle might become invalid (see dbRelease) later.
- Exceptions
-
Definition at line 268 of file librpmDb.cc.
unsigned zypp::target::rpm::librpmDb::dbRelease |
( |
bool |
force_r = false | ) |
|
|
static |
If there are no outstanding references to the database (e.g.
by db_const_iterator), the database is closed. Subsequent calls to dbAccess may however open the database again.
If forced, the internal reference is dropped and it will look like the database was closed. But physically the database will be closed after all outstanding references are gone.
- Returns
- The number of outstandig references to the database, 0 if if database was physically closed.
Definition at line 289 of file librpmDb.cc.
unsigned zypp::target::rpm::librpmDb::blockAccess |
( |
| ) |
|
|
static |
Blocks further access to rpmdb.
Basically the same as dbRelease( true ), but subsequent calls to dbAccess will fail returning E_RpmDB_access_blocked.
- Returns
- The number of outstandig references to the database, 0 if if database was physically closed.
Definition at line 326 of file librpmDb.cc.
void zypp::target::rpm::librpmDb::unblockAccess |
( |
| ) |
|
|
static |
Allow access to rpmdb e.g.
after blockAccess. Subsequent calls to dbAccess will perform.
NOTE: Initially we're in blocked mode. So you must call unblockAccess unblockAccess at least once. Othwise nothing will happen.
- Returns
- The number of outstandig references to the database, 0 if if database was physically closed.
Definition at line 339 of file librpmDb.cc.
static bool zypp::target::rpm::librpmDb::isBlocked |
( |
| ) |
|
|
inlinestatic |
- Returns
- Whether database access is blocked.
Definition at line 215 of file librpmDb.h.
ostream & zypp::target::rpm::librpmDb::dumpState |
( |
std::ostream & |
str | ) |
|
|
static |
void zypp::target::rpm::librpmDb::unref_to |
( |
unsigned |
refCount_r | ) |
const |
|
protectedvirtual |
const Pathname & zypp::target::rpm::librpmDb::root |
( |
| ) |
const |
- Returns
- This handles root directory for all operations.
Definition at line 411 of file librpmDb.cc.
const Pathname & zypp::target::rpm::librpmDb::dbPath |
( |
| ) |
const |
- Returns
- This handles directory that contains the rpmdb.
Definition at line 422 of file librpmDb.cc.
Return any database error.
Usg. if the database was blocked by calling dbRelease(true) or blockAccess.
Definition at line 433 of file librpmDb.cc.
bool zypp::target::rpm::librpmDb::valid |
( |
| ) |
const |
|
inline |
- Returns
- Whether handle is valid.
Definition at line 290 of file librpmDb.h.
bool zypp::target::rpm::librpmDb::empty |
( |
| ) |
const |
- Returns
- True if handle is valid and database is empty.
Definition at line 444 of file librpmDb.cc.
unsigned zypp::target::rpm::librpmDb::size |
( |
| ) |
const |
- Returns
- Number of entries in the database (0 if not valid).
Definition at line 455 of file librpmDb.cc.
void * zypp::target::rpm::librpmDb::dont_call_it |
( |
| ) |
const |
Dont call it ;) It's for development and testing only.
Definition at line 473 of file librpmDb.cc.
ostream & zypp::target::rpm::librpmDb::dumpOn |
( |
std::ostream & |
str | ) |
const |
|
virtual |
Pathname zypp::target::rpm::librpmDb::_defaultRoot |
|
staticprivate |
Current root directory for all operations.
(initialy /)
Definition at line 68 of file librpmDb.h.
Pathname zypp::target::rpm::librpmDb::_defaultDbPath |
|
staticprivate |
Current directory (below root) that contains the rpmdb.
(initialy /var/lib/rpm)
Definition at line 74 of file librpmDb.h.
Current rpmdb handle.
Definition at line 79 of file librpmDb.h.
bool zypp::target::rpm::librpmDb::_dbBlocked |
|
staticprivate |
Whether access is blocked (no _defaultDb will be available).
Definition at line 84 of file librpmDb.h.
D& zypp::target::rpm::librpmDb::_d |
|
private |
The documentation for this class was generated from the following files: