GNUnet  0.10.x
gnunet-service-set_union_strata_estimator.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2012 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19 */
20 
27 #ifndef GNUNET_CONSENSUS_STRATA_ESTIMATOR_H
28 #define GNUNET_CONSENSUS_STRATA_ESTIMATOR_H
29 
30 #include "platform.h"
31 #include "gnunet_common.h"
32 #include "gnunet_util_lib.h"
33 
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #if 0 /* keep Emacsens' auto-indent happy */
38 }
39 #endif
40 #endif
41 
42 
47 {
52 
56  unsigned int strata_count;
57 
61  unsigned int ibf_size;
62 };
63 
64 
72 size_t
73 strata_estimator_write (const struct StrataEstimator *se,
74  void *buf);
75 
76 
87 int
88 strata_estimator_read (const void *buf,
89  size_t buf_len,
90  int is_compressed,
91  struct StrataEstimator *se);
92 
93 
102 struct StrataEstimator *
104  uint32_t ibf_size,
105  uint8_t ibf_hashnum);
106 
107 
116 unsigned int
118  const struct StrataEstimator *se2);
119 
120 
127 void
129  struct IBF_Key key);
130 
131 
138 void
140  struct IBF_Key key);
141 
142 
148 void
150 
151 
158 struct StrataEstimator *
160 
161 
162 #if 0 /* keep Emacsens' auto-indent happy */
163 {
164 #endif
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 #endif
Invertible bloom filter (IBF).
Definition: ibf.h:82
A handle to a strata estimator.
unsigned int strata_estimator_difference(const struct StrataEstimator *se1, const struct StrataEstimator *se2)
Get an estimation of the symmetric difference of the elements contained in both strata estimators...
void strata_estimator_remove(struct StrataEstimator *se, struct IBF_Key key)
Remove a key from the strata estimator.
struct StrataEstimator * strata_estimator_create(unsigned int strata_count, uint32_t ibf_size, uint8_t ibf_hashnum)
Create a new strata estimator with the given parameters.
static char buf[2048]
void strata_estimator_destroy(struct StrataEstimator *se)
Destroy a strata estimator, free all of its resources.
unsigned int strata_count
Size of the IBF array in strata.
struct StrataEstimator * strata_estimator_dup(struct StrataEstimator *se)
Make a copy of a strata estimator.
void strata_estimator_insert(struct StrataEstimator *se, struct IBF_Key key)
Add a key to the strata estimator.
size_t strata_estimator_write(const struct StrataEstimator *se, void *buf)
Write the given strata estimator to the buffer.
struct GNUNET_HashCode key
The key used in the DHT.
int strata_estimator_read(const void *buf, size_t buf_len, int is_compressed, struct StrataEstimator *se)
Read strata from the buffer into the given strata estimator.
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
struct InvertibleBloomFilter ** strata
The IBFs of this strata estimator.
Keys that can be inserted into and removed from an IBF.
Definition: ibf.h:45
unsigned int ibf_size
Size of each IBF stratum (in bytes)