diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-03-30 19:46:17 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-03-30 19:46:17 +0000 |
commit | bf7619be0f8e5fca7a16c28720ab908134d139bc (patch) | |
tree | 3433dea1f210b3da2329edc13183d0d8c14e0d81 /src/include | |
parent | b47c2f2d5175300a531778727c29787ab78749b8 (diff) | |
download | gnunet-bf7619be0f8e5fca7a16c28720ab908134d139bc.tar.gz gnunet-bf7619be0f8e5fca7a16c28720ab908134d139bc.zip |
add multihashmap_clear to API
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_container_lib.h | 18 | ||||
-rw-r--r-- | src/include/gnunet_datastore_service.h | 35 |
2 files changed, 35 insertions, 18 deletions
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h index b83130307..125bc81b2 100644 --- a/src/include/gnunet_container_lib.h +++ b/src/include/gnunet_container_lib.h | |||
@@ -699,6 +699,18 @@ GNUNET_CONTAINER_multihashmap_remove_all (struct GNUNET_CONTAINER_MultiHashMap * | |||
699 | 699 | ||
700 | /** | 700 | /** |
701 | * @ingroup hashmap | 701 | * @ingroup hashmap |
702 | * Remove all entries from the map. | ||
703 | * Note that the values would not be "freed". | ||
704 | * | ||
705 | * @param map the map | ||
706 | * @return number of values removed | ||
707 | */ | ||
708 | unsigned int | ||
709 | GNUNET_CONTAINER_multihashmap_clear (struct GNUNET_CONTAINER_MultiHashMap *map); | ||
710 | |||
711 | |||
712 | /** | ||
713 | * @ingroup hashmap | ||
702 | * Check if the map contains any value under the given | 714 | * Check if the map contains any value under the given |
703 | * key (including values that are NULL). | 715 | * key (including values that are NULL). |
704 | * | 716 | * |
@@ -757,8 +769,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, | |||
757 | * @return the number of key value pairs | 769 | * @return the number of key value pairs |
758 | */ | 770 | */ |
759 | unsigned int | 771 | unsigned int |
760 | GNUNET_CONTAINER_multihashmap_size (const struct GNUNET_CONTAINER_MultiHashMap | 772 | GNUNET_CONTAINER_multihashmap_size (const struct GNUNET_CONTAINER_MultiHashMap *map); |
761 | *map); | ||
762 | 773 | ||
763 | 774 | ||
764 | /** | 775 | /** |
@@ -772,8 +783,7 @@ GNUNET_CONTAINER_multihashmap_size (const struct GNUNET_CONTAINER_MultiHashMap | |||
772 | * #GNUNET_SYSERR if it aborted iteration | 783 | * #GNUNET_SYSERR if it aborted iteration |
773 | */ | 784 | */ |
774 | int | 785 | int |
775 | GNUNET_CONTAINER_multihashmap_iterate (const struct | 786 | GNUNET_CONTAINER_multihashmap_iterate (const struct GNUNET_CONTAINER_MultiHashMap *map, |
776 | GNUNET_CONTAINER_MultiHashMap *map, | ||
777 | GNUNET_CONTAINER_HashMapIterator it, | 787 | GNUNET_CONTAINER_HashMapIterator it, |
778 | void *it_cls); | 788 | void *it_cls); |
779 | 789 | ||
diff --git a/src/include/gnunet_datastore_service.h b/src/include/gnunet_datastore_service.h index 39605807a..38a027200 100644 --- a/src/include/gnunet_datastore_service.h +++ b/src/include/gnunet_datastore_service.h | |||
@@ -207,7 +207,8 @@ GNUNET_DATASTORE_release_reserve (struct GNUNET_DATASTORE_Handle *h, | |||
207 | * (or rather, will already have been invoked) | 207 | * (or rather, will already have been invoked) |
208 | */ | 208 | */ |
209 | struct GNUNET_DATASTORE_QueueEntry * | 209 | struct GNUNET_DATASTORE_QueueEntry * |
210 | GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, uint64_t uid, | 210 | GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, |
211 | uint64_t uid, | ||
211 | uint32_t priority, | 212 | uint32_t priority, |
212 | struct GNUNET_TIME_Absolute expiration, | 213 | struct GNUNET_TIME_Absolute expiration, |
213 | unsigned int queue_priority, | 214 | unsigned int queue_priority, |
@@ -239,8 +240,10 @@ GNUNET_DATASTORE_update (struct GNUNET_DATASTORE_Handle *h, uint64_t uid, | |||
239 | */ | 240 | */ |
240 | struct GNUNET_DATASTORE_QueueEntry * | 241 | struct GNUNET_DATASTORE_QueueEntry * |
241 | GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, | 242 | GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, |
242 | const struct GNUNET_HashCode * key, size_t size, | 243 | const struct GNUNET_HashCode *key, |
243 | const void *data, unsigned int queue_priority, | 244 | size_t size, |
245 | const void *data, | ||
246 | unsigned int queue_priority, | ||
244 | unsigned int max_queue_size, | 247 | unsigned int max_queue_size, |
245 | struct GNUNET_TIME_Relative timeout, | 248 | struct GNUNET_TIME_Relative timeout, |
246 | GNUNET_DATASTORE_ContinuationWithStatus cont, | 249 | GNUNET_DATASTORE_ContinuationWithStatus cont, |
@@ -261,14 +264,16 @@ GNUNET_DATASTORE_remove (struct GNUNET_DATASTORE_Handle *h, | |||
261 | * @param uid unique identifier for the datum; | 264 | * @param uid unique identifier for the datum; |
262 | * maybe 0 if no unique identifier is available | 265 | * maybe 0 if no unique identifier is available |
263 | */ | 266 | */ |
264 | typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls, | 267 | typedef void |
265 | const struct GNUNET_HashCode *key, | 268 | (*GNUNET_DATASTORE_DatumProcessor) (void *cls, |
266 | size_t size, const void *data, | 269 | const struct GNUNET_HashCode *key, |
267 | enum GNUNET_BLOCK_Type type, | 270 | size_t size, |
268 | uint32_t priority, | 271 | const void *data, |
269 | uint32_t anonymity, | 272 | enum GNUNET_BLOCK_Type type, |
270 | struct GNUNET_TIME_Absolute expiration, | 273 | uint32_t priority, |
271 | uint64_t uid); | 274 | uint32_t anonymity, |
275 | struct GNUNET_TIME_Absolute expiration, | ||
276 | uint64_t uid); | ||
272 | 277 | ||
273 | 278 | ||
274 | /** | 279 | /** |
@@ -293,13 +298,15 @@ typedef void (*GNUNET_DATASTORE_DatumProcessor) (void *cls, | |||
293 | * cancel | 298 | * cancel |
294 | */ | 299 | */ |
295 | struct GNUNET_DATASTORE_QueueEntry * | 300 | struct GNUNET_DATASTORE_QueueEntry * |
296 | GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offset, | 301 | GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, |
302 | uint64_t offset, | ||
297 | const struct GNUNET_HashCode *key, | 303 | const struct GNUNET_HashCode *key, |
298 | enum GNUNET_BLOCK_Type type, | 304 | enum GNUNET_BLOCK_Type type, |
299 | unsigned int queue_priority, | 305 | unsigned int queue_priority, |
300 | unsigned int max_queue_size, | 306 | unsigned int max_queue_size, |
301 | struct GNUNET_TIME_Relative timeout, | 307 | struct GNUNET_TIME_Relative timeout, |
302 | GNUNET_DATASTORE_DatumProcessor proc, void *proc_cls); | 308 | GNUNET_DATASTORE_DatumProcessor proc, |
309 | void *proc_cls); | ||
303 | 310 | ||
304 | 311 | ||
305 | /** | 312 | /** |
@@ -352,7 +359,7 @@ GNUNET_DATASTORE_get_zero_anonymity (struct GNUNET_DATASTORE_Handle *h, | |||
352 | * @param proc function to call on a random value; it | 359 | * @param proc function to call on a random value; it |
353 | * will be called once with a value (if available) | 360 | * will be called once with a value (if available) |
354 | * and always once with a value of NULL. | 361 | * and always once with a value of NULL. |
355 | * @param proc_cls closure for proc | 362 | * @param proc_cls closure for @a proc |
356 | * @return NULL if the entry was not queued, otherwise a handle that can be used to | 363 | * @return NULL if the entry was not queued, otherwise a handle that can be used to |
357 | * cancel | 364 | * cancel |
358 | */ | 365 | */ |