invertible bloom filter More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "ibf.h"
#include "gnunet-service-set_union_strata_estimator.h"
Go to the source code of this file.
Macros | |
#define | FAIL_10_1_COMPATIBILTIY 1 |
Should we try compressing the strata estimator? This will break compatibility with the 0.10.1-network. More... | |
Functions | |
size_t | strata_estimator_write (const struct StrataEstimator *se, void *buf) |
Write the given strata estimator to the buffer. More... | |
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. More... | |
void | strata_estimator_insert (struct StrataEstimator *se, struct IBF_Key key) |
Add a key to the strata estimator. More... | |
void | strata_estimator_remove (struct StrataEstimator *se, struct IBF_Key key) |
Remove a key from the strata estimator. More... | |
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. More... | |
unsigned int | strata_estimator_difference (const struct StrataEstimator *se1, const struct StrataEstimator *se2) |
Estimate set difference with two strata estimators, i.e. More... | |
struct StrataEstimator * | strata_estimator_dup (struct StrataEstimator *se) |
Make a copy of a strata estimator. More... | |
void | strata_estimator_destroy (struct StrataEstimator *se) |
Destroy a strata estimator, free all of its resources. More... | |
invertible bloom filter
Definition in file gnunet-service-set_union_strata_estimator.c.
#define FAIL_10_1_COMPATIBILTIY 1 |
Should we try compressing the strata estimator? This will break compatibility with the 0.10.1-network.
Definition at line 36 of file gnunet-service-set_union_strata_estimator.c.
size_t strata_estimator_write | ( | const struct StrataEstimator * | se, |
void * | buf | ||
) |
Write the given strata estimator to the buffer.
se | strata estimator to serialize | |
[out] | buf | buffer to write to, must be of appropriate size |
Definition at line 47 of file gnunet-service-set_union_strata_estimator.c.
References GNUNET_assert, GNUNET_free, GNUNET_memcpy, GNUNET_try_compression(), GNUNET_YES, IBF_BUCKET_SIZE, StrataEstimator::ibf_size, ibf_write_slice(), StrataEstimator::strata, and StrataEstimator::strata_count.
Referenced by handle_client_accept(), and union_accept().
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.
The strata estimator must already be allocated.
buf | buffer to read from | |
buf_len | number of bytes in buf | |
is_compressed | is the data compressed? | |
[out] | se | strata estimator to write to |
Definition at line 95 of file gnunet-service-set_union_strata_estimator.c.
References GNUNET_break, GNUNET_break_op, GNUNET_decompress(), GNUNET_free, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, IBF_BUCKET_SIZE, ibf_read_slice(), StrataEstimator::ibf_size, StrataEstimator::strata, and StrataEstimator::strata_count.
Referenced by handle_union_p2p_strata_estimator().
void strata_estimator_insert | ( | struct StrataEstimator * | se, |
struct IBF_Key | key | ||
) |
Add a key to the strata estimator.
se | strata estimator to add the key to |
key | key to add |
Definition at line 144 of file gnunet-service-set_union_strata_estimator.c.
References ibf_insert(), key, and StrataEstimator::strata.
Referenced by handle_client_set_add(), and union_add().
void strata_estimator_remove | ( | struct StrataEstimator * | se, |
struct IBF_Key | key | ||
) |
Remove a key from the strata estimator.
se | strata estimator to remove the key from |
key | key to remove |
Definition at line 159 of file gnunet-service-set_union_strata_estimator.c.
References ibf_remove(), key, and StrataEstimator::strata.
Referenced by union_remove().
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.
strata_count | number of stratas, that is, number of ibfs in the estimator |
ibf_size | size of each ibf stratum |
ibf_hashnum | hashnum parameter of each ibf |
Definition at line 182 of file gnunet-service-set_union_strata_estimator.c.
References GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_new, GNUNET_new_array, ibf_create(), ibf_destroy(), StrataEstimator::ibf_size, ibf_size, StrataEstimator::strata, and StrataEstimator::strata_count.
Referenced by handle_client_create_set(), handle_union_p2p_strata_estimator(), and union_set_create().
unsigned int strata_estimator_difference | ( | const struct StrataEstimator * | se1, |
const struct StrataEstimator * | se2 | ||
) |
Estimate set difference with two strata estimators, i.e.
Get an estimation of the symmetric difference of the elements contained in both strata estimators.
arrays of IBFs. Does not not modify its arguments.
se1 | first strata estimator |
se2 | second strata estimator |
Definition at line 222 of file gnunet-service-set_union_strata_estimator.c.
References InvertibleBloomFilter::count, GNUNET_assert, GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, ibf_decode(), ibf_destroy(), ibf_dup(), ibf_subtract(), InvertibleBloomFilter::size, StrataEstimator::strata, and StrataEstimator::strata_count.
Referenced by handle_union_p2p_strata_estimator().
struct StrataEstimator * strata_estimator_dup | ( | struct StrataEstimator * | se | ) |
Make a copy of a strata estimator.
se | the strata estimator to copy |
Definition at line 267 of file gnunet-service-set_union_strata_estimator.c.
References GNUNET_new, GNUNET_new_array, ibf_dup(), StrataEstimator::ibf_size, StrataEstimator::strata, and StrataEstimator::strata_count.
Referenced by handle_client_accept(), handle_client_evaluate(), union_accept(), union_copy_state(), and union_evaluate().
void strata_estimator_destroy | ( | struct StrataEstimator * | se | ) |
Destroy a strata estimator, free all of its resources.
se | strata estimator to destroy. |
Definition at line 289 of file gnunet-service-set_union_strata_estimator.c.
References GNUNET_free, ibf_destroy(), StrataEstimator::strata, and StrataEstimator::strata_count.
Referenced by _GSS_operation_destroy(), client_disconnect_cb(), handle_union_p2p_strata_estimator(), union_op_cancel(), and union_set_destroy().