estimator of set difference More...
Go to the source code of this file.
Data Structures | |
| struct | StrataEstimator |
| A handle to a strata estimator. More... | |
Functions | |
| size_t | strata_estimator_write (const struct StrataEstimator *se, void *buf) |
| Write the given strata estimator to the buffer. | |
| 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. | |
| 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. | |
| 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_insert (struct StrataEstimator *se, struct IBF_Key key) |
| Add a key to the strata estimator. | |
| void | strata_estimator_remove (struct StrataEstimator *se, struct IBF_Key key) |
| Remove a key from the strata estimator. | |
| void | strata_estimator_destroy (struct StrataEstimator *se) |
| Destroy a strata estimator, free all of its resources. | |
| struct StrataEstimator * | strata_estimator_dup (struct StrataEstimator *se) |
| Make a copy of a strata estimator. | |
estimator of set difference
Definition in file gnunet-service-set_union_strata_estimator.h.
| 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(), and handle_union_p2p_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.
| 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.
| 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.
| se1 | first strata estimator |
| se2 | second strata estimator |
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(), and 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().
| 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(), handle_union_p2p_strata_estimator(), union_op_cancel(), and union_set_destroy().
| 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().