-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbloomfilter.h
More file actions
25 lines (22 loc) · 826 Bytes
/
bloomfilter.h
File metadata and controls
25 lines (22 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef BLOOMFILTER_H
#define BLOOMFILTER_H
#include <stdint.h>
typedef struct bloomfilter {
/* Used for loading/saving the bloom filter */
char *state_file;
/* Loads the bloom filter from filepath. */
void (*load)(const char *filepath);
/* Saves the current bloom filter. */
void (*save)();
/* Frees the memory allocated for the bloom filter. */
void (*free)();
/* Sets k entries in the bloom filter to 1.
* k: the number of hash functions */
void (*add)(const uint64_t key);
/* Checks if a given key is in the database by looking up the bloom filter.
* Returns 0 if the key is in the database, otherwise returns -1. */
int_fast8_t (*lookup)(const uint64_t key);
} bloomfilter_t;
/* Initializes the bloom filter. */
void init_bloomfilter(bloomfilter_t *bf);
#endif