rpm  5.2.1
Macros | Typedefs | Enumerations | Functions | Variables

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

#include <assert.h>
#include <rpmtypes.h>
#include <mire.h>
#include "db_emu.h"
#include <rpmio.h>
#include <rpmsw.h>
Include dependency graph for rpmdb.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define rpmdbUnlink(_db, _msg)   ((rpmdb)rpmioUnlinkPoolItem((rpmioItem)(_db), _msg, __FILE__, __LINE__))
 
#define rpmdbLink(_db, _msg)   ((void *)rpmioLinkPoolItem((rpmioItem)(_db), _msg, __FILE__, __LINE__))
 
#define rpmmiUnlink(_mi)   ((rpmmi)rpmioUnlinkPoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))
 
#define rpmmiLink(_mi)   ((rpmmi)rpmioLinkPoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))
 
#define rpmmiFree(_mi)   ((rpmmi)rpmioFreePoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))
 

Typedefs

typedef struct _dbiIndexItem * dbiIndexItem
 
typedef struct _dbiIndexSet * dbiIndexSet
 A single element (i.e. More...
 
typedef struct _dbiIndex * dbiIndex
 

Enumerations

enum  rpmdbFlags { RPMDB_FLAG_JUSTCHECK = (1 << 0), RPMDB_FLAG_MINIMAL = (1 << 1), RPMDB_FLAG_CHROOT = (1 << 2) }
 

Functions

rpmdb rpmdbUnlink (rpmdb db, const char *msg)
 Unreference a database instance. More...
 
rpmdb rpmdbLink (rpmdb db, const char *msg)
 Reference a database instance. More...
 
rpmdb rpmdbNew (const char *root, const char *home, int mode, int perms, int flags)
 
int rpmdbOpenDatabase (const char *prefix, const char *dbpath, int _dbapi, rpmdb *dbp, int mode, int perms, int flags)
 
int rpmdbOpen (const char *prefix, rpmdb *dbp, int mode, int perms)
 Open rpm database. More...
 
int rpmdbInit (const char *prefix, int perms)
 Initialize database. More...
 
int rpmdbVerifyAllDBI (rpmdb db)
 Verify all database components. More...
 
int rpmdbVerify (const char *prefix)
 Open and verify all database components. More...
 
int rpmdbBlockDBI (rpmdb db, int tag)
 Block access to a single database index. More...
 
int rpmdbCloseDBI (rpmdb db, int tag)
 Close a single database index. More...
 
int rpmdbClose (rpmdb db)
 Close all database indices and free rpmdb. More...
 
int rpmdbSync (rpmdb db)
 Sync all database indices. More...
 
int rpmdbOpenAll (rpmdb db)
 Open all database indices. More...
 
int rpmdbCount (rpmdb db, rpmTag tag, const void *keyp, size_t keylen)
 Return number of instances of key in a tag index. More...
 
int rpmdbCountPackages (rpmdb db, const char *name)
 Return number of instances of package in Name index. More...
 
unsigned int rpmmiInstance (rpmmi mi)
 Return header instance join key for current position of rpmdb iterator. More...
 
unsigned int rpmmiFilenum (rpmmi mi)
 Return header tag index join key for current position of rpmdb iterator. More...
 
int rpmmiCount (rpmmi mi)
 Return number of elements in rpm database iterator. More...
 
int rpmmiGrow (rpmmi mi, const int *hdrNums, int nHdrNums)
 Append items to set of package instances to iterate. More...
 
int rpmmiPrune (rpmmi mi, int *hdrNums, int nHdrNums, int sorted)
 Remove items from set of package instances to iterate. More...
 
int rpmmiAddPattern (rpmmi mi, rpmTag tag, rpmMireMode mode, const char *pattern)
 Add pattern to iterator selector. More...
 
int rpmmiSetRewrite (rpmmi mi, int rewrite)
 Prepare iterator for lazy writes. More...
 
int rpmmiSetModified (rpmmi mi, int modified)
 Modify iterator to mark header for lazy write on release. More...
 
int rpmmiSetHdrChk (rpmmi mi, rpmts ts)
 Modify iterator to verify retrieved header blobs. More...
 
rpmmi rpmmiInit (rpmdb db, rpmTag tag, const void *keyp, size_t keylen)
 Return database iterator. More...
 
Header rpmmiNext (rpmmi mi)
 Return next package header from iteration. More...
 
int rpmdbCheckTerminate (int terminate)
 Check rpmdb signal handler for trapped signal and/or requested exit. More...
 
int rpmdbCheckSignals (void)
 Check for and exit on termination signals. More...
 
rpmmi rpmmiUnlink (rpmmi mi)
 Unreference a rpm database iterator. More...
 
rpmmi rpmmiLink (rpmmi mi)
 Reference a rpm database iterator. More...
 
rpmmi rpmmiFree (rpmmi mi)
 Destroy rpm database iterator. More...
 
int rpmdbMireApply (rpmdb db, rpmTag tag, rpmMireMode mode, const char *pat, const char ***argvp)
 Return array of keys matching a pattern. More...
 
int rpmdbAdd (rpmdb db, int iid, Header h, rpmts ts)
 Add package header to rpm database and indices. More...
 
int rpmdbRemove (rpmdb db, int rid, unsigned int hdrNum, rpmts ts)
 Remove package header from rpm database and indices. More...
 
int rpmdbRebuild (const char *prefix, rpmts ts)
 Rebuild database indices from package headers. More...
 
int rpm_mergesort (void *base, size_t nmemb, size_t size, int(*cmp)(const void *, const void *))
 Mergesort, same arguments as qsort(2). More...
 

Variables

int _rpmdb_debug
 

Detailed Description

Access RPM indices using Berkeley DB interface(s).

Definition in file rpmdb.h.

Macro Definition Documentation

#define rpmdbLink (   _db,
  _msg 
)    ((void *)rpmioLinkPoolItem((rpmioItem)(_db), _msg, __FILE__, __LINE__))

Definition at line 892 of file rpmdb.h.

#define rpmdbUnlink (   _db,
  _msg 
)    ((rpmdb)rpmioUnlinkPoolItem((rpmioItem)(_db), _msg, __FILE__, __LINE__))

Definition at line 880 of file rpmdb.h.

#define rpmmiFree (   _mi)    ((rpmmi)rpmioFreePoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))

Definition at line 1194 of file rpmdb.h.

#define rpmmiLink (   _mi)    ((rpmmi)rpmioLinkPoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))

Definition at line 1182 of file rpmdb.h.

#define rpmmiUnlink (   _mi)    ((rpmmi)rpmioUnlinkPoolItem((rpmioItem)(_mi), __FUNCTION__, __FILE__, __LINE__))

Definition at line 1170 of file rpmdb.h.

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.

Function Documentation

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

Mergesort, same arguments as qsort(2).

Definition at line 213 of file merge.c.

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

Referenced by rpmdbSortIterator().

int rpmdbBlockDBI ( rpmdb  db,
int  tag 
)

Block access to a single database index.

Parameters
dbrpm database
tagrpm tag (negative to block)
Returns
0 on success

Definition at line 974 of file rpmdb.c.

Referenced by rpmgiNext().

int rpmdbCloseDBI ( rpmdb  db,
int  tag 
)

Close a single database index.

Parameters
dbrpm database
tagrpm tag
Returns
0 on success

Definition at line 992 of file rpmdb.c.

Referenced by rpmtsCheck().

rpmdb rpmdbNew ( const char *  root,
const char *  home,
int  mode,
int  perms,
int  flags 
)
int rpmdbOpenDatabase ( const char *  prefix,
const char *  dbpath,
int  _dbapi,
rpmdb dbp,
int  mode,
int  perms,
int  flags 
)

Variable Documentation

int _rpmdb_debug

Definition at line 61 of file rpmdb.c.