typedef int (*GNUNET_HashCodeIterator) (void *cls,
GNUNET_HashCode * next);
+
/**
* Load a bloom-filter from a file.
*
int
k);
+
/**
* Create a bloom filter from raw bits.
*
int
k);
+
/**
* Copy the raw data of this bloomfilter into
* the given data array.
*bf, char *data,
size_t size);
+
/**
* Test if an element is in the filter.
* @param e the element
int GNUNET_CONTAINER_bloomfilter_test (const struct GNUNET_CONTAINER_BloomFilter
*bf, const GNUNET_HashCode * e);
+
/**
* Add an element to the filter
* @param bf the filter
void GNUNET_CONTAINER_bloomfilter_add (struct GNUNET_CONTAINER_BloomFilter
*bf, const GNUNET_HashCode * e);
+
/**
* Remove an element from the filter.
* @param bf the filter
void GNUNET_CONTAINER_bloomfilter_remove (struct GNUNET_CONTAINER_BloomFilter
*bf, const GNUNET_HashCode * e);
+
+/**
+ * Free the space associcated with a filter
+ * in memory, flush to drive if needed (do not
+ * free the space on the drive)
+ * @param bf the filter
+ */
+struct GNUNET_CONTAINER_BloomFilter *
+GNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilter *bf);
+
+
+
/**
* Free the space associcated with a filter
* in memory, flush to drive if needed (do not
*
*/
void *
-GNUNET_CONTAINER_heap_get_random (struct GNUNET_CONTAINER_Heap *heap, uint32_t max);
+GNUNET_CONTAINER_heap_get_random (struct GNUNET_CONTAINER_Heap *heap,
+ uint32_t max);
+
/**
* Perform a random walk of the tree. The walk is biased
fprintf (stderr,
"\nThroughput was %llu kb/s\n",
total_bytes * 1000 / 1024 / delta);
- GNUNET_asprintf(&value_name, "reliable_kbs_%s", test_name);
+ GNUNET_asprintf(&value_name, "reliable-%s_kb/s", test_name);
GAUGER (value_name, (int)(total_bytes * 1000 / 1024 /delta));
GNUNET_free(value_name);
ok = 0;
"Transports disconnected, returning success!\n");
#endif
delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
- GNUNET_asprintf(&value_name, "unreliable_kbs_%s", test_name);
+ GNUNET_asprintf(&value_name, "unreliable-%s_kb/s", test_name);
GAUGER (value_name, (int)(total_bytes * 1000 / 1024 /delta));
GNUNET_free(value_name);
fprintf (stderr,
fprintf (stderr,
"\nThroughput was %llu kb/s\n",
total_bytes * 1000 / 1024 / delta);
- GNUNET_asprintf(&value_name, "unreliable_kbs_%s", test_name);
+ GNUNET_asprintf(&value_name, "unreliable-%s_kb/s", test_name);
GAUGER (value_name, (int)(total_bytes * 1000 / 1024 /delta));
GNUNET_free(value_name);
- GNUNET_asprintf(&value_name, "unreliable_failed_%s", test_name);
+ GNUNET_asprintf(&value_name, "unreliable-%s_failed messages", test_name);
GAUGER (value_name, (int)num_failed);
GNUNET_free(value_name);
GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Had %d failed messages!\n", num_failed);
}
+/**
+ * Copy an existing memory. Any association with a file
+ * on-disk will be lost in the process.
+ * @param bf the filter to copy
+ * @retun copy of the bf
+ */
+struct GNUNET_CONTAINER_BloomFilter *
+GNUNET_CONTAINER_bloomfilter_copy (const struct GNUNET_CONTAINER_BloomFilter *bf)
+{
+ return GNUNET_CONTAINER_bloomfilter_init (bf->bitArray,
+ bf->bitArraySize,
+ bf->addressesPerElement);
+}
+
+
/**
* Sets a bit active in the bitArray. Increment bit-specific
* usage counter on disk only if below 4bit max (==15).