![]() |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
RollingBloomFilter is a probabilistic "keep track of most recently inserted" set. More...
#include <bloom.h>
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 |
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.
| CRollingBloomFilter::CRollingBloomFilter | ( | unsigned int | nElements, |
| double | nFPRate | ||
| ) |
| bool CRollingBloomFilter::contains | ( | const std::vector< unsigned char > & | vKey | ) | const |
| bool CRollingBloomFilter::contains | ( | const uint256 & | hash | ) | const |
| void CRollingBloomFilter::insert | ( | const std::vector< unsigned char > & | vKey | ) |
| void CRollingBloomFilter::reset | ( | ) |
|
private |
|
private |
1.8.17