77 bool contains(
const void* key,
size_t keyLengthInBytes)
override {
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: 02 Apr....
Definition: cs_CuckooFilter.h:69
CuckooFilter(cuckoo_filter_data_t *data)
Wraps a data struct into a CuckooFilter object.
Definition: cs_CuckooFilter.h:125
bool add(cuckoo_extended_fingerprint_t efp)
constexpr size_t size()
Total number of bytes this instance occypies.
Definition: cs_CuckooFilter.h:85
bool add(cuckoo_key_t key, size_t keyLengthInBytes)
Definition: cs_CuckooFilter.h:106
cuckoo_filter_data_t * _data
Definition: cs_CuckooFilter.h:192
void init(cuckoo_index_t bucketCount, cuckoo_index_t nestsPerBucket)
Sets the size parameters and then clear()s this object so that the bucket_array is filled with precis...
constexpr size_t bufferSize()
Definition: cs_CuckooFilter.h:179
bool removeFingerprintFromBucket(cuckoo_fingerprint_t fingerprint, cuckoo_index_t bucketIndex)
Returns true if found and removed, returns false if not found.
static constexpr size_t bufferSize(size_t bucketCount, cuckoo_index_t nestsPerBucket)
Size of the byte buffer in bytes.
Definition: cs_CuckooFilter.h:159
bool contains(const void *key, size_t keyLengthInBytes) override
Definition: cs_CuckooFilter.h:77
bool remove(cuckoo_key_t key, size_t keyLengthInBytes)
Definition: cs_CuckooFilter.h:108
bool move(cuckoo_extended_fingerprint_t entryToInsert)
bool add(cuckoo_fingerprint_t finger, cuckoo_index_t bucketIndex)
Definition: cs_CuckooFilter.h:90
bool remove(cuckoo_extended_fingerprint_t efp)
cuckoo_fingerprint_t & lookupFingerprint(cuckoo_index_t bucketIndex, cuckoo_index_t fingerIndex)
Returns a reference to the fingerprint at the given coordinates.
Definition: cs_CuckooFilter.h:232
static constexpr size_t MAX_KICK_ATTEMPTS
Definition: cs_CuckooFilter.h:186
bool contains(cuckoo_fingerprint_t finger, cuckoo_index_t bucketIndex)
Definition: cs_CuckooFilter.h:98
void clear()
Memsets the bucket_array to 0x00 and sets victim to 0.
cuckoo_extended_fingerprint_t getExtendedFingerprint(cuckoo_fingerprint_t fingerprint, cuckoo_index_t bucketIndex)
Expands a fingerprint and the index where it is placed into an extended fingerprint,...
static constexpr size_t fingerprintCount(size_t bucketCount, cuckoo_index_t nestsPerBucket)
Definition: cs_CuckooFilter.h:152
cuckoo_fingerprint_t hashToFingerprint(cuckoo_key_t key, size_t keyLengthInBytes)
Hashes the given key into a fingerprint.
cuckoo_extended_fingerprint_t getExtendedFingerprint(cuckoo_key_t key, size_t keyLengthInBytes)
Reduces a key (element) to an extended fingerprint, consisting of the fingerprint of the key and its ...
static constexpr size_t size(cuckoo_index_t bucketCount, cuckoo_index_t nestsPerBucket)
Total number of bytes a CuckooFilter with the given parameters would occupy.
Definition: cs_CuckooFilter.h:170
constexpr size_t bucketCount()
Actual bucket count value may be bigger than a cuckoo_index_t can hold.
Definition: cs_CuckooFilter.h:177
cuckoo_fingerprint_t filterHash()
A crc16 hash of this filters current contents (_data).
bool remove(cuckoo_fingerprint_t finger, cuckoo_index_t bucketIndex)
Definition: cs_CuckooFilter.h:94
cuckoo_compressed_fingerprint_t getCompressedFingerprint(cuckoo_key_t key, size_t keyLengthInBytes)
Reduces a key (element) to a compressed fingerprint, consisting of the fingerprint of the key and its...
CuckooFilter()
Use this with loads of care, _data is never checked to be non-nullptr in this class.
Definition: cs_CuckooFilter.h:130
bool contains(cuckoo_extended_fingerprint_t efp)
bool addFingerprintToBucket(cuckoo_fingerprint_t fingerprint, cuckoo_index_t bucketIndex)
Returns true if there was an empty space in the bucket and placement was successful,...
cuckoo_fingerprint_t hashToBucket(cuckoo_key_t key, size_t keyLengthInBytes)
Hashes the given key to obtain an (untruncated) bucket index.
Used in AssetFiltering as a generic way to query a filter for containment and assetId.
Definition: cs_FilterInterface.h:16
uint16_t cuckoo_fingerprint_t
Definition: cs_CuckooFilterStructs.h:14
const void * cuckoo_key_t
Definition: cs_CuckooFilterStructs.h:13
uint8_t cuckoo_index_t
Definition: cs_CuckooFilterStructs.h:15
Definition: cs_CuckooFilterStructs.h:30
Representation of an object (O) in this filter comprises of a fingerprint (F) and a the bucket index ...
Definition: cs_CuckooFilterStructs.h:24
Data content of the cuckoo filter.
Definition: cs_CuckooFilterStructs.h:38
cuckoo_fingerprint_t bucketArray[]
Definition: cs_CuckooFilterStructs.h:42
cuckoo_index_t bucketCountLog2
Definition: cs_CuckooFilterStructs.h:39
cuckoo_index_t nestsPerBucket
Definition: cs_CuckooFilterStructs.h:40