diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-10-08 11:30:19 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-10-08 11:30:19 +0000 |
commit | ae53a8d1d043cbd5967fb01316a32685c7a8af9b (patch) | |
tree | a8d791aed993ac8691f68ee6152a6ffb14a88ee3 /src/set/ibf.h | |
parent | e105a542a8ddb22184712bfe565aa734f1d0349d (diff) | |
download | gnunet-ae53a8d1d043cbd5967fb01316a32685c7a8af9b.tar.gz gnunet-ae53a8d1d043cbd5967fb01316a32685c7a8af9b.zip |
add logic for strata compression
Diffstat (limited to 'src/set/ibf.h')
-rw-r--r-- | src/set/ibf.h | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/set/ibf.h b/src/set/ibf.h index 831aa6b82..616cca5f6 100644 --- a/src/set/ibf.h +++ b/src/set/ibf.h | |||
@@ -123,7 +123,10 @@ struct InvertibleBloomFilter | |||
123 | * @param buf buffer to write the data to | 123 | * @param buf buffer to write the data to |
124 | */ | 124 | */ |
125 | void | 125 | void |
126 | ibf_write_slice (const struct InvertibleBloomFilter *ibf, uint32_t start, uint32_t count, void *buf); | 126 | ibf_write_slice (const struct InvertibleBloomFilter *ibf, |
127 | uint32_t start, | ||
128 | uint32_t count, | ||
129 | void *buf); | ||
127 | 130 | ||
128 | 131 | ||
129 | /** | 132 | /** |
@@ -132,10 +135,13 @@ ibf_write_slice (const struct InvertibleBloomFilter *ibf, uint32_t start, uint32 | |||
132 | * @param buf pointer to the buffer to read from | 135 | * @param buf pointer to the buffer to read from |
133 | * @param start which bucket to start at | 136 | * @param start which bucket to start at |
134 | * @param count how many buckets to read | 137 | * @param count how many buckets to read |
135 | * @param ibf the ibf to read from | 138 | * @param ibf the ibf to write to |
136 | */ | 139 | */ |
137 | void | 140 | void |
138 | ibf_read_slice (const void *buf, uint32_t start, uint32_t count, struct InvertibleBloomFilter *ibf); | 141 | ibf_read_slice (const void *buf, |
142 | uint32_t start, | ||
143 | uint32_t count, | ||
144 | struct InvertibleBloomFilter *ibf); | ||
139 | 145 | ||
140 | 146 | ||
141 | /** | 147 | /** |
@@ -164,7 +170,7 @@ ibf_hashcode_from_key (struct IBF_Key key, struct GNUNET_HashCode *dst); | |||
164 | * | 170 | * |
165 | * @param size number of IBF buckets | 171 | * @param size number of IBF buckets |
166 | * @param hash_num number of buckets one element is hashed in, usually 3 or 4 | 172 | * @param hash_num number of buckets one element is hashed in, usually 3 or 4 |
167 | * @return the newly created invertible bloom filter | 173 | * @return the newly created invertible bloom filter, NULL on error |
168 | */ | 174 | */ |
169 | struct InvertibleBloomFilter * | 175 | struct InvertibleBloomFilter * |
170 | ibf_create (uint32_t size, uint8_t hash_num); | 176 | ibf_create (uint32_t size, uint8_t hash_num); |
@@ -198,7 +204,8 @@ ibf_remove (struct InvertibleBloomFilter *ibf, struct IBF_Key key); | |||
198 | * @param ibf2 IBF that will be subtracted from ibf1 | 204 | * @param ibf2 IBF that will be subtracted from ibf1 |
199 | */ | 205 | */ |
200 | void | 206 | void |
201 | ibf_subtract (struct InvertibleBloomFilter *ibf1, const struct InvertibleBloomFilter *ibf2); | 207 | ibf_subtract (struct InvertibleBloomFilter *ibf1, |
208 | const struct InvertibleBloomFilter *ibf2); | ||
202 | 209 | ||
203 | 210 | ||
204 | /** | 211 | /** |
@@ -209,12 +216,14 @@ ibf_subtract (struct InvertibleBloomFilter *ibf1, const struct InvertibleBloomFi | |||
209 | * A negative sign indicates that the element was recovered | 216 | * A negative sign indicates that the element was recovered |
210 | * resides in an IBF that was previously subtracted from. | 217 | * resides in an IBF that was previously subtracted from. |
211 | * @param ret_id receives the hash code of the decoded element, if successful | 218 | * @param ret_id receives the hash code of the decoded element, if successful |
212 | * @return GNUNET_YES if decoding an element was successful, | 219 | * @return #GNUNET_YES if decoding an element was successful, |
213 | * GNUNET_NO if the IBF is empty, | 220 | * #GNUNET_NO if the IBF is empty, |
214 | * GNUNET_SYSERR if the decoding has failed | 221 | * #GNUNET_SYSERR if the decoding has failed |
215 | */ | 222 | */ |
216 | int | 223 | int |
217 | ibf_decode (struct InvertibleBloomFilter *ibf, int *ret_side, struct IBF_Key *ret_id); | 224 | ibf_decode (struct InvertibleBloomFilter *ibf, |
225 | int *ret_side, | ||
226 | struct IBF_Key *ret_id); | ||
218 | 227 | ||
219 | 228 | ||
220 | /** | 229 | /** |
@@ -244,4 +253,3 @@ ibf_destroy (struct InvertibleBloomFilter *ibf); | |||
244 | #endif | 253 | #endif |
245 | 254 | ||
246 | #endif | 255 | #endif |
247 | |||