#include <librpmDb.h>
Inheritance diagram for librpmDb:
Public Types | |
typedef InstTargetError | Error |
Public Member Functions | |
virtual | ~librpmDb () |
const Pathname & | root () const |
const Pathname & | dbPath () const |
PMError | error () const |
bool | valid () const |
bool | empty () const |
void * | dont_call_it () const |
virtual std::ostream & | dumpOn (std::ostream &str) const |
Static Public Member Functions | |
bool | globalInit () |
std::string | expand (const std::string ¯o_r) |
std::string | stringPath (const Pathname &root_r, const Pathname &sub_r) |
const Pathname & | defaultRoot () |
const Pathname & | defaultDbPath () |
PMError | dbAccess (const Pathname &root_r, const Pathname &dbPath_r) |
PMError | dbAccess (constlibrpmDbPtr &ptr_r) |
unsigned | dbRelease (bool force_r=false) |
unsigned | blockAccess () |
void | unblockAccess () |
bool | isBlocked () |
std::ostream & | dumpState (std::ostream &str) |
Protected Member Functions | |
librpmDb (const Pathname &root_r, const Pathname &dbPath_r, bool readonly_r) | |
virtual void | unref_to (unsigned refCount_r) const |
Private Member Functions | |
REP_BODY (librpmDb) | |
Static Private Member Functions | |
PMError | dbAccess (librpmDbPtr &ptr_r) |
librpmDb * | newLibrpmDb (Pathname root_r, Pathname dbPath_r, bool readonly_r, PMError &err_r) |
PMError | dbAccess () |
Private Attributes | |
D & | _d |
Static Private Attributes | |
Pathname | _defaultRoot |
Pathname | _defaultDbPath |
constlibrpmDbPtr | _defaultDb |
bool | _dbBlocked |
|
Default error class |
|
Private constructor! librpmDb objects are to be created via static interface only. |
|
Destructor. Closes rpmdb. |
|
Blocks further access to rpmdb. Basically the same as dbRelease( true ), but subsequent calls to dbAccess will fail returning E_RpmDB_access_blocked.
|
|
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.
|
|
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.
|
|
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.
|
|
INTENTIONALLY UNDEFINED<> because of bug in Ptr classes which allows implicit conversion from librpmDbPtr to constlibrpmDbPtr. Currently we don't want to provide non const handles, as the database is opened READONLY. |
|
|
|
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.
|
|
|
|
|
|
Dont call it ;) It's for development and testing only. |
|
Dump debug info. Reimplemented from CountedRep. |
|
Dump debug info. |
|
|
|
Return any database error. Usg. if the database was blocked by calling dbRelease(true) or blockAccess. |
|
|
|
Initialize lib librpm (read configfiles etc.). It's called on demand but you may call it anytime.
|
|
|
|
For internal use. Pointer returned should immediately be wrapped into librpmDbPtr. |
|
|
|
|
|
|
|
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.
|
|
Trigger from Rep, after refCount was decreased. Reimplemented from Rep. |
|
|
|
|
|
Wheter access is blocked (no _defaultDb will be available). |
|
Current rpmdb handle. |
|
Current directory (below root) that contains the rpmdb. (initialy /var/lib/rpm) |
|
Current root directory for all operations. (initialy /) |