rpm  5.4.15
Data Structures | Macros | Typedefs | Functions | Variables
rpmbf.h File Reference
#include <sys/types.h>
Include dependency graph for rpmbf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pbm_set
 

Macros

#define rpmbfUnlink(_bf)   ((rpmbf)rpmioUnlinkPoolItem((rpmioItem)(_bf), __FUNCTION__, __FILE__, __LINE__))
 
#define rpmbfLink(_bf)   ((rpmbf)rpmioLinkPoolItem((rpmioItem)(_bf), __FUNCTION__, __FILE__, __LINE__))
 
#define rpmbfFree(_bf)   ((rpmbf)rpmioFreePoolItem((rpmioItem)(_bf), __FUNCTION__, __FILE__, __LINE__))
 

Typedefs

typedef struct rpmbf_s * rpmbf
 
typedef unsigned int __pbm_bits
 

Functions

rpmbf rpmbfUnlink (rpmbf bf)
 Unreference a Bloom filter instance. More...
 
rpmbf rpmbfLink (rpmbf bf)
 Reference a Bloom filter instance. More...
 
rpmbf rpmbfFree (rpmbf bf)
 Destroy a Bloom filter. More...
 
rpmbf rpmbfNew (size_t m, size_t k, unsigned flags)
 Create a Bloom filter. More...
 
int rpmbfAdd (rpmbf bf, const void *_s, size_t ns)
 Add item to a Bloom filter. More...
 
int rpmbfClr (rpmbf bf)
 Clear a Bloom filter, discarding all set memberships. More...
 
int rpmbfChk (rpmbf bf, const void *_s, size_t ns)
 Check for item in a Bloom filter. More...
 
int rpmbfDel (rpmbf bf, const void *_s, size_t ns)
 Delete item from a Bloom filter. More...
 
int rpmbfIntersect (rpmbf a, const rpmbf b)
 Return intersection of two Bloom filters. More...
 
int rpmbfUnion (rpmbf a, const rpmbf b)
 Return union of two Bloom filters. More...
 
void rpmbfParams (size_t n, double e, size_t *mp, size_t *kp)
 Return optimal {m, k} for given n and e. More...
 

Variables

int _rpmbf_debug
 

Macro Definition Documentation

#define rpmbfFree (   _bf)    ((rpmbf)rpmioFreePoolItem((rpmioItem)(_bf), __FUNCTION__, __FILE__, __LINE__))

Definition at line 120 of file rpmbf.h.

#define rpmbfLink (   _bf)    ((rpmbf)rpmioLinkPoolItem((rpmioItem)(_bf), __FUNCTION__, __FILE__, __LINE__))

Definition at line 109 of file rpmbf.h.

#define rpmbfUnlink (   _bf)    ((rpmbf)rpmioUnlinkPoolItem((rpmioItem)(_bf), __FUNCTION__, __FILE__, __LINE__))

Definition at line 98 of file rpmbf.h.

Typedef Documentation

typedef unsigned int __pbm_bits

Definition at line 19 of file rpmbf.h.

typedef struct rpmbf_s* rpmbf

Definition at line 17 of file rpmbf.h.

Function Documentation

int rpmbfAdd ( rpmbf  bf,
const void *  _s,
size_t  ns 
)

Add item to a Bloom filter.

Parameters
bfBloom filter
*_sbytes
nsno. bytes (0 uses strlen)
Returns
0 on success, -1 on NULL pointer

Definition at line 68 of file rpmbf.c.

References _rpmbf_debug.

Referenced by db3Acallback(), removePackage(), rpmfiFNBF(), rpmhkpFindKey(), rpmhkpValidate(), rpmmiPrune(), rpmtsFindBaseNamesInDB(), and rpmtsFindPubkey().

int rpmbfChk ( rpmbf  bf,
const void *  _s,
size_t  ns 
)

Check for item in a Bloom filter.

Parameters
bfBloom filter
*_sbytes
nsno. bytes (0 uses strlen)
Returns
1 if string is present, 0 if not, -1 on NULL pointer

Definition at line 90 of file rpmbf.c.

References _rpmbf_debug.

Referenced by addRelation(), db3Acallback(), orgrpmAddRelation(), packagedDir(), rpmalAllFileSatisfiesDepend(), rpmhkpFindKey(), rpmhkpVerify(), rpmmiNext(), rpmtsFindBaseNamesInDB(), and rpmtsFindPubkey().

int rpmbfClr ( rpmbf  bf)

Clear a Bloom filter, discarding all set memberships.

Parameters
bfBloom filter
Returns
0 on success, -1 on NULL pointer

Definition at line 115 of file rpmbf.c.

References _rpmbf_debug.

int rpmbfDel ( rpmbf  bf,
const void *  _s,
size_t  ns 
)

Delete item from a Bloom filter.

Todo:
Counting bloom filter needed?
Parameters
bfBloom filter
*_sbytes
nsno. bytes (0 will do strlen)
Returns
0 on success, -1 on NULL pointer

Definition at line 132 of file rpmbf.c.

References _rpmbf_debug.

rpmbf rpmbfFree ( rpmbf  bf)

Destroy a Bloom filter.

Parameters
bfBloom filter
Returns
NULL on last dereference

Referenced by db3Acallback(), rpmalDel(), rpmalFini(), rpmfiFini(), rpmhkpFini(), rpmioClean(), rpmmiFini(), rpmtsFindBaseNamesInDB(), rpmtsFindPubkey(), and rpmtsFini().

int rpmbfIntersect ( rpmbf  a,
const rpmbf  b 
)

Return intersection of two Bloom filters.

Return values
aBloom filter
Parameters
bBloom filter
Returns
0 on success, -1 if {m,k} disagree or NULL pointers.

Definition at line 156 of file rpmbf.c.

References _rpmbf_debug, and i.

rpmbf rpmbfLink ( rpmbf  bf)

Reference a Bloom filter instance.

Parameters
bfBloom filter
Returns
new Bloom filter reference

Referenced by rpmalAdd(), rpmbfNew(), rpmhkpNew(), and rpmtsFindPubkey().

rpmbf rpmbfNew ( size_t  m,
size_t  k,
unsigned  flags 
)

Create a Bloom filter.

Parameters
mno. of bits
kno. of hashes
flagsflags
Returns
new Bloom filter

Definition at line 52 of file rpmbf.c.

References rpmbfGetPool(), and rpmbfLink().

Referenced by db3Acallback(), removePackage(), rpmfiFNBF(), rpmhkpNew(), rpmmiPrune(), and rpmtsFindBaseNamesInDB().

void rpmbfParams ( size_t  n,
double  e,
size_t *  mp,
size_t *  kp 
)

Return optimal {m, k} for given n and e.

Parameters
npopulation estimate
eprobability of error
Return values
*mpno. of bits
*kpno. of hashes

Definition at line 202 of file rpmbf.c.

References _rpmbf_debug.

Referenced by db3Acallback(), removePackage(), rpmfiFNBF(), rpmhkpNew(), rpmmiPrune(), and rpmtsFindBaseNamesInDB().

int rpmbfUnion ( rpmbf  a,
const rpmbf  b 
)

Return union of two Bloom filters.

Return values
aBloom filter
Parameters
bBloom filter
Returns
0 on success, -1 if {m,k} disagree or NULL pointers.

Definition at line 179 of file rpmbf.c.

References _rpmbf_debug, and i.

rpmbf rpmbfUnlink ( rpmbf  bf)

Unreference a Bloom filter instance.

Parameters
bfBloom filter
Returns
NULL on last dereference

Variable Documentation

int _rpmbf_debug