CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
dablooms.h
Go to the documentation of this file.
1 /* Copyright @2012 by Justin Hines at Bitly under a very liberal license. See LICENSE in the source distribution. */
2 
3 #ifndef __BLOOM_H__
4 #define __BLOOM_H__
5 #include <stdint.h>
6 #include <stdlib.h>
7 
8 const char *dablooms_version(void);
9 
10 typedef struct {
11  size_t bytes;
12  int fd;
13  char *array;
14 } bitmap_t;
15 
16 #ifdef __cplusplus
17 extern "C"
18 {
19 #endif
20 bitmap_t *bitmap_resize(bitmap_t *bitmap, size_t old_size, size_t new_size);
21 bitmap_t *new_bitmap(int fd, size_t bytes);
22 
23 int bitmap_increment(bitmap_t *bitmap, unsigned int index, long offset);
24 int bitmap_decrement(bitmap_t *bitmap, unsigned int index, long offset);
25 int bitmap_check(bitmap_t *bitmap, unsigned int index, long offset);
26 int bitmap_flush(bitmap_t *bitmap);
27 
28 void free_bitmap(bitmap_t *bitmap);
29 
30 #ifdef __cplusplus
31 }
32 #endif
33 typedef struct {
35  uint32_t count;
36  uint32_t _pad;
38 
39 
40 typedef struct {
42  unsigned int capacity;
43  long offset;
44  unsigned int counts_per_func;
45  uint32_t *hashes;
46  size_t nfuncs;
47  size_t size;
48  size_t num_bytes;
49  double error_rate;
52 
53 #ifdef __cplusplus
54 extern "C"
55 {
56 #endif
58 counting_bloom_t *new_counting_bloom(unsigned int capacity, double error_rate, const char *filename);
59 counting_bloom_t *new_counting_bloom_from_file(unsigned int capacity, double error_rate, const char *filename);
60 int counting_bloom_add(counting_bloom_t *bloom, const char *s, size_t len);
61 int counting_bloom_remove(counting_bloom_t *bloom, const char *s, size_t len);
62 int counting_bloom_check(counting_bloom_t *bloom, const char *s, size_t len);
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 typedef struct {
72 
73 typedef struct {
75  unsigned int capacity;
76  unsigned int num_blooms;
77  size_t num_bytes;
78  double error_rate;
79  int fd;
83 
84 #ifdef __cplusplus
85 extern "C"
86 {
87 #endif
88 scaling_bloom_t *new_scaling_bloom(unsigned int capacity, double error_rate, const char *filename);
89 scaling_bloom_t *new_scaling_bloom_from_file(unsigned int capacity, double error_rate, const char *filename);
91 int scaling_bloom_add(scaling_bloom_t *bloom, const char *s, size_t len, uint64_t id);
92 int scaling_bloom_remove(scaling_bloom_t *bloom, const char *s, size_t len, uint64_t id);
93 int scaling_bloom_check(scaling_bloom_t *bloom, const char *s, size_t len);
97 #ifdef __cplusplus
98 }
99 #endif
100 #endif
counting_bloom_header_t * header
Definition: dablooms.h:41
unsigned int counts_per_func
Definition: dablooms.h:44
int scaling_bloom_add(scaling_bloom_t *bloom, const char *s, size_t len, uint64_t id)
void free_bitmap(bitmap_t *bitmap)
int counting_bloom_check(counting_bloom_t *bloom, const char *s, size_t len)
int bitmap_decrement(bitmap_t *bitmap, unsigned int index, long offset)
scaling_bloom_t * new_scaling_bloom(unsigned int capacity, double error_rate, const char *filename)
double error_rate
Definition: dablooms.h:49
int bitmap_increment(bitmap_t *bitmap, unsigned int index, long offset)
size_t bytes
Definition: dablooms.h:11
counting_bloom_t * new_counting_bloom(unsigned int capacity, double error_rate, const char *filename)
bitmap_t * bitmap
Definition: dablooms.h:81
uint64_t scaling_bloom_mem_seqnum(scaling_bloom_t *bloom)
int free_scaling_bloom(scaling_bloom_t *bloom)
counting_bloom_t * new_counting_bloom_from_file(unsigned int capacity, double error_rate, const char *filename)
bitmap_t * new_bitmap(int fd, size_t bytes)
scaling_bloom_header_t * header
Definition: dablooms.h:74
uint64_t scaling_bloom_disk_seqnum(scaling_bloom_t *bloom)
size_t num_bytes
Definition: dablooms.h:77
bitmap_t * bitmap_resize(bitmap_t *bitmap, size_t old_size, size_t new_size)
int fd
Definition: dablooms.h:12
int scaling_bloom_check(scaling_bloom_t *bloom, const char *s, size_t len)
tuple fd
Definition: ztee.py:136
int counting_bloom_add(counting_bloom_t *bloom, const char *s, size_t len)
counting_bloom_t ** blooms
Definition: dablooms.h:80
unsigned int capacity
Definition: dablooms.h:42
size_t num_bytes
Definition: dablooms.h:48
unsigned long long uint64_t
Definition: Time.h:15
int free_counting_bloom(counting_bloom_t *bloom)
bitmap_t * bitmap
Definition: dablooms.h:50
int bitmap_check(bitmap_t *bitmap, unsigned int index, long offset)
char * array
Definition: dablooms.h:13
uint32_t * hashes
Definition: dablooms.h:45
int counting_bloom_remove(counting_bloom_t *bloom, const char *s, size_t len)
tuple filename
Definition: lut2db_cfg.py:20
int scaling_bloom_remove(scaling_bloom_t *bloom, const char *s, size_t len, uint64_t id)
const char * dablooms_version(void)
uint64_t disk_seqnum
Definition: dablooms.h:70
int bitmap_flush(bitmap_t *bitmap)
unsigned int num_blooms
Definition: dablooms.h:76
size_t nfuncs
Definition: dablooms.h:46
scaling_bloom_t * new_scaling_bloom_from_file(unsigned int capacity, double error_rate, const char *filename)
unsigned int capacity
Definition: dablooms.h:75
int scaling_bloom_flush(scaling_bloom_t *bloom)
double error_rate
Definition: dablooms.h:78