PRCYCoin  2.0.0.7rc1
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
CRollingBloomFilter Class Reference

RollingBloomFilter is a probabilistic "keep track of most recently inserted" set. More...

#include <bloom.h>

Collaboration diagram for CRollingBloomFilter:
[legend]

Public Member Functions

 CRollingBloomFilter (unsigned int nElements, double nFPRate)
 
void insert (const std::vector< unsigned char > &vKey)
 
void insert (const uint256 &hash)
 
bool contains (const std::vector< unsigned char > &vKey) const
 
bool contains (const uint256 &hash) const
 
void reset ()
 

Private Attributes

unsigned int nBloomSize
 
unsigned int nInsertions
 
CBloomFilter b1
 
CBloomFilter b2
 

Detailed Description

RollingBloomFilter is a probabilistic "keep track of most recently inserted" set.

Construct it with the number of items to keep track of, and a false-positive rate. Unlike CBloomFilter, by default nTweak is set to a cryptographically secure random value for you. Similarly rather than clear() the method reset() is provided, which also changes nTweak to decrease the impact of false-positives.

contains(item) will always return true if item was one of the last N things insert()'ed ... but may also return true for items that were not inserted.

Definition at line 116 of file bloom.h.

Constructor & Destructor Documentation

◆ CRollingBloomFilter()

CRollingBloomFilter::CRollingBloomFilter ( unsigned int  nElements,
double  nFPRate 
)

Definition at line 207 of file bloom.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ contains() [1/2]

bool CRollingBloomFilter::contains ( const std::vector< unsigned char > &  vKey) const

Definition at line 240 of file bloom.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ contains() [2/2]

bool CRollingBloomFilter::contains ( const uint256 hash) const

Definition at line 248 of file bloom.cpp.

◆ insert() [1/2]

void CRollingBloomFilter::insert ( const std::vector< unsigned char > &  vKey)

Definition at line 220 of file bloom.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insert() [2/2]

void CRollingBloomFilter::insert ( const uint256 hash)

Definition at line 234 of file bloom.cpp.

◆ reset()

void CRollingBloomFilter::reset ( )

Definition at line 254 of file bloom.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ b1

CBloomFilter CRollingBloomFilter::b1
private

Definition at line 134 of file bloom.h.

◆ b2

CBloomFilter CRollingBloomFilter::b2
private

Definition at line 134 of file bloom.h.

◆ nBloomSize

unsigned int CRollingBloomFilter::nBloomSize
private

Definition at line 132 of file bloom.h.

◆ nInsertions

unsigned int CRollingBloomFilter::nInsertions
private

Definition at line 133 of file bloom.h.


The documentation for this class was generated from the following files: