rpmdb/rpmdb.h File Reference

Access RPM indices using Berkeley DB interface(s). More...

#include <assert.h>
#include "rpmlib.h"
#include "rpmsw.h"
#include "db.h"

Go to the source code of this file.

Data Structures

struct  _dbiIndexItem
 A single item from an index database (i.e. More...
struct  _dbiIndexSet
 Items retrieved from the index database. More...
struct  _dbiVec
 Private methods for accessing an index database. More...
struct  _dbiIndex
 Describes an index database (implemented on Berkeley db3 functionality). More...
struct  rpmdb_s
 Describes the collection of index databases used by rpm. More...

Defines

#define rpmdbUnlink(_db, _msg)   XrpmdbUnlink(_db, _msg, __FILE__, __LINE__)
#define rpmdbLink(_db, _msg)   XrpmdbLink(_db, _msg, __FILE__, __LINE__)

Typedefs

typedef enum rpmMireMode_e rpmMireMode
 Tag value pattern match mode.
typedef _dbiIndexItemdbiIndexItem
typedef _dbiIndexSetdbiIndexSet
 A single element (i.e.
typedef _dbiIndexdbiIndex

Enumerations

enum  rpmMireMode_e { RPMMIRE_DEFAULT = 0, RPMMIRE_STRCMP = 1, RPMMIRE_REGEX = 2, RPMMIRE_GLOB = 3 }
 Tag value pattern match mode. More...
enum  rpmdbFlags { RPMDB_FLAG_JUSTCHECK = (1 << 0), RPMDB_FLAG_MINIMAL = (1 << 1), RPMDB_FLAG_CHROOT = (1 << 2) }

Functions

dbiIndex db3New (rpmdb rpmdb, rpmTag rpmtag)
 Return new configured index database handle instance.
dbiIndex db3Free (dbiIndex dbi)
 Destroy index database handle instance.
const char *const prDbiOpenFlags (int dbflags, int print_dbenv_flags)
 Format db3 open flags for debugging print.
dbiIndex dbiOpen (rpmdb db, rpmTag rpmtag, unsigned int flags)
 Return handle for an index database.
static int dbiCopen (dbiIndex dbi, DB_TXN *txnid, DBC **dbcp, unsigned int flags)
 Open a database cursor.
static int dbiCclose (dbiIndex dbi, DBC *dbcursor, unsigned int flags)
 Close a database cursor.
static int dbiCdup (dbiIndex dbi, DBC *dbcursor, DBC **dbcp, unsigned int flags)
 Duplicate a database cursor.
static int dbiDel (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags)
 Delete (key,data) pair(s) from index database.
static int dbiGet (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags)
 Retrieve (key,data) pair from index database.
static int dbiPget (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *pkey, DBT *data, unsigned int flags)
 Retrieve (key,data) pair using dbcursor->c_pget.
static int dbiPut (dbiIndex dbi, DBC *dbcursor, DBT *key, DBT *data, unsigned int flags)
 Store (key,data) pair in index database.
static int dbiCount (dbiIndex dbi, DBC *dbcursor, unsigned int *countp, unsigned int flags)
 Retrieve count of (possible) duplicate items.
static int dbiVerify (dbiIndex dbi, unsigned int flags)
 Verify (and close) index database.
static int dbiClose (dbiIndex dbi, unsigned int flags)
 Close index database.
static int dbiSync (dbiIndex dbi, unsigned int flags)
 Flush pending operations to disk.
static int dbiAssociate (dbiIndex dbi, dbiIndex dbisecondary, int(*callback)(DB *, const DBT *, const DBT *, DBT *), unsigned int flags)
 Associate secondary database with primary.
static int dbiJoin (dbiIndex dbi, DBC **curslist, DBC **dbcp, unsigned int flags)
 Return join cursor for list of cursors.
static int dbiByteSwapped (dbiIndex dbi)
 Is database byte swapped?
static int dbiStat (dbiIndex dbi, unsigned int flags)
 Is database byte swapped?
unsigned int rpmdbGetIteratorFileNum (rpmdbMatchIterator mi)
dbiIndexSet dbiFreeIndexSet (dbiIndexSet set)
 Destroy set of index database items.
unsigned int dbiIndexSetCount (dbiIndexSet set)
 Count items in index database set.
unsigned int dbiIndexRecordOffset (dbiIndexSet set, int recno)
 Return record offset of header from element in index database set.
unsigned int dbiIndexRecordFileNumber (dbiIndexSet set, int recno)
 Return file index from element in index database set.
rpmdb rpmdbUnlink (rpmdb db, const char *msg)
 Unreference a database instance.
rpmdb XrpmdbUnlink (rpmdb db, const char *msg, const char *fn, unsigned ln)
rpmdb rpmdbLink (rpmdb db, const char *msg)
 Reference a database instance.
rpmdb XrpmdbLink (rpmdb db, const char *msg, const char *fn, unsigned ln)
int rpmdbOpen (const char *prefix, rpmdb *dbp, int mode, int perms)
 Open rpm database.
int rpmdbInit (const char *prefix, int perms)
 Initialize database.
int rpmdbVerify (const char *prefix)
 Verify database components.
int rpmdbCloseDBI (rpmdb db, int rpmtag)
 Close a single database index.
int rpmdbClose (rpmdb db)
 Close all database indices and free rpmdb.
int rpmdbSync (rpmdb db)
 Sync all database indices.
int rpmdbOpenAll (rpmdb db)
 Open all database indices.
int rpmdbCountPackages (rpmdb db, const char *name)
 Return number of instances of package in rpm database.
unsigned int rpmdbGetIteratorOffset (rpmdbMatchIterator mi)
 Return header join key for current position of rpm database iterator.
int rpmdbGetIteratorCount (rpmdbMatchIterator mi)
 Return number of elements in rpm database iterator.
int rpmdbAppendIterator (rpmdbMatchIterator mi, const int *hdrNums, int nHdrNums)
 Append items to set of package instances to iterate.
int rpmdbPruneIterator (rpmdbMatchIterator mi, int *hdrNums, int nHdrNums, int sorted)
 Remove items from set of package instances to iterate.
int rpmdbSetIteratorRE (rpmdbMatchIterator mi, rpmTag tag, rpmMireMode mode, const char *pattern)
 Add pattern to iterator selector.
int rpmdbSetIteratorRewrite (rpmdbMatchIterator mi, int rewrite)
 Prepare iterator for lazy writes.
int rpmdbSetIteratorModified (rpmdbMatchIterator mi, int modified)
 Modify iterator to mark header for lazy write on release.
int rpmdbSetHdrChk (rpmdbMatchIterator mi, rpmts ts, rpmRC(*hdrchk)(rpmts ts, const void *uh, size_t uc, const char **msg))
 Modify iterator to verify retrieved header blobs.
rpmdbMatchIterator rpmdbInitIterator (rpmdb db, rpmTag rpmtag, const void *keyp, size_t keylen)
 Return database iterator.
Header rpmdbNextIterator (rpmdbMatchIterator mi)
 Return next package header from iteration.
int rpmdbCheckSignals (void)
 Check for and exit on termination signals.
int rpmdbCheckTerminate (int terminate)
 Check rpmdb signal handler for trapped signal and/or requested exit, clean up any open iterators and databases on termination condition.
rpmdbMatchIterator rpmdbFreeIterator (rpmdbMatchIterator mi)
 Destroy rpm database iterator.
int rpmdbAdd (rpmdb db, int iid, Header h, rpmts ts, rpmRC(*hdrchk)(rpmts ts, const void *uh, size_t uc, const char **msg))
 Add package header to rpm database and indices.
int rpmdbRemove (rpmdb db, int rid, unsigned int hdrNum, rpmts ts, rpmRC(*hdrchk)(rpmts ts, const void *uh, size_t uc, const char **msg))
 Remove package header from rpm database and indices.
int rpmdbRebuild (const char *prefix, rpmts ts, rpmRC(*hdrchk)(rpmts ts, const void *uh, size_t uc, const char **msg))
 Rebuild database indices from package headers.
int mergesort (void *base, size_t nmemb, size_t size, int(*cmp)(const void *, const void *))
 Mergesort, same arguments as qsort(2).

Variables

int _rpmdb_debug
int * dbiTags
 Tags for which rpmdb indices will be built.
int dbiTagsMax


Detailed Description

Access RPM indices using Berkeley DB interface(s).

Definition in file rpmdb.h.


Define Documentation

#define rpmdbLink ( _db,
_msg   )     XrpmdbLink(_db, _msg, __FILE__, __LINE__)

Definition at line 851 of file rpmdb.h.

Referenced by newRpmdb(), and rpmdbInitIterator().

#define rpmdbUnlink ( _db,
_msg   )     XrpmdbUnlink(_db, _msg, __FILE__, __LINE__)

Definition at line 833 of file rpmdb.h.

Referenced by rpmdbClose().


Typedef Documentation

typedef struct _dbiIndex* dbiIndex

Definition at line 53 of file rpmdb.h.

typedef struct _dbiIndexItem* dbiIndexItem

Definition at line 44 of file rpmdb.h.

typedef enum rpmMireMode_e rpmMireMode

Tag value pattern match mode.


Enumeration Type Documentation

enum rpmMireMode_e

Tag value pattern match mode.

Enumerator:
RPMMIRE_DEFAULT  regex with \., .* and ^...$ added
RPMMIRE_STRCMP  strings using strcmp(3)
RPMMIRE_REGEX  regex(7) patterns through regcomp(3)
RPMMIRE_GLOB  glob(7) patterns through fnmatch(3)

Definition at line 35 of file rpmdb.h.


Function Documentation

int mergesort ( void *  base,
size_t  nmemb,
size_t  size,
int(*)(const void *, const void *)  cmp 
)

Mergesort, same arguments as qsort(2).

Definition at line 208 of file merge.c.

References CCOPY_ELT, CCOPY_LIST, errno, EVAL, ICOPY_ELT, ICOPY_LIST, ISIZE, PSIZE, and setup().

Referenced by rpmdbSortIterator().

int rpmdbCloseDBI ( rpmdb  db,
int  rpmtag 
)

Close a single database index.

Parameters:
db rpm database
rpmtag rpm tag
Returns:
0 on success

Definition at line 841 of file rpmdb.c.

References rpmdb_s::_dbi, dbiClose(), dbiTags, and dbiTagsMax.

Referenced by rpmtsCheck().

rpmdb XrpmdbLink ( rpmdb  db,
const char *  msg,
const char *  fn,
unsigned  ln 
)

Todo:
Remove debugging entry from the ABI.

Definition at line 1123 of file rpmdb.c.

References _rpmdb_debug, and rpmdb_s::nrefs.

rpmdb XrpmdbUnlink ( rpmdb  db,
const char *  msg,
const char *  fn,
unsigned  ln 
)

Todo:
Remove debugging entry from the ABI.

Definition at line 1113 of file rpmdb.c.

References _rpmdb_debug, and rpmdb_s::nrefs.


Variable Documentation

int _rpmdb_debug

Definition at line 49 of file rpmdb.c.

int dbiTagsMax

Definition at line 63 of file rpmdb.c.

Referenced by dbiOpen(), dbiTagsInit(), dbiTagToDbix(), newRpmdb(), openDatabase(), rpmdbAdd(), rpmdbCloseDBI(), rpmdbMoveDatabase(), rpmdbOpenAll(), rpmdbRemove(), and rpmdbRemoveDatabase().


Generated on Fri Oct 12 08:44:56 2007 for rpm by  doxygen 1.5.2