mirror of https://github.com/PurpleI2P/i2pd.git
I2P: End-to-End encrypted and anonymous Internet
https://i2pd.website/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
643 B
32 lines
643 B
8 years ago
|
#ifndef BLOOM_FILTER_H_
|
||
|
#define BLOOM_FILTER_H_
|
||
|
#include <memory>
|
||
|
#include <cstdint>
|
||
|
|
||
|
namespace i2p
|
||
|
{
|
||
|
namespace util
|
||
|
{
|
||
|
|
||
8 years ago
|
/** @brief interface for bloom filter */
|
||
|
struct IBloomFilter
|
||
|
{
|
||
8 years ago
|
|
||
8 years ago
|
/** @brief destructor */
|
||
8 years ago
|
virtual ~IBloomFilter() {};
|
||
8 years ago
|
/** @brief add entry to bloom filter, return false if filter hit otherwise return true */
|
||
|
virtual bool Add(const uint8_t * data, std::size_t len) = 0;
|
||
|
/** @brief optionally decay old entries */
|
||
8 years ago
|
virtual void Decay() = 0;
|
||
8 years ago
|
};
|
||
8 years ago
|
|
||
8 years ago
|
typedef std::shared_ptr<IBloomFilter> BloomFilterPtr;
|
||
8 years ago
|
|
||
8 years ago
|
/** @brief create bloom filter */
|
||
|
BloomFilterPtr BloomFilter(std::size_t capacity = 1024 * 8);
|
||
8 years ago
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endif
|