diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-04-30 07:29:31 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-04-30 07:29:31 +0000 |
commit | a49b0f351926cf4376a58937a94e37426e3ae167 (patch) | |
tree | d2d36817e0cc65d0300385934474a29ecfcf353a /src/include | |
parent | 0b48745c1c6ec80a8e99bcdb9514e028b8656fe0 (diff) | |
download | gnunet-a49b0f351926cf4376a58937a94e37426e3ae167.tar.gz gnunet-a49b0f351926cf4376a58937a94e37426e3ae167.zip |
adding GNUNET_CONTAINER_multipeermap_get_random
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_container_lib.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h index 1ecf4f52a..d8886c504 100644 --- a/src/include/gnunet_container_lib.h +++ b/src/include/gnunet_container_lib.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2001-2013 Christian Grothoff (and other contributing authors) | 3 | Copyright (C) 2001-2015 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -857,7 +857,8 @@ GNUNET_CONTAINER_multihashmap_get_multiple (const struct GNUNET_CONTAINER_MultiH | |||
857 | /** | 857 | /** |
858 | * @ingroup hashmap | 858 | * @ingroup hashmap |
859 | * Call @a it on a random value from the map, or not at all | 859 | * Call @a it on a random value from the map, or not at all |
860 | * if the map is empty. | 860 | * if the map is empty. Note that this function has linear |
861 | * complexity (in the size of the map). | ||
861 | * | 862 | * |
862 | * @param map the map | 863 | * @param map the map |
863 | * @param it function to call on a random entry | 864 | * @param it function to call on a random entry |
@@ -1115,6 +1116,22 @@ GNUNET_CONTAINER_multipeermap_get_multiple (const struct GNUNET_CONTAINER_MultiP | |||
1115 | void *it_cls); | 1116 | void *it_cls); |
1116 | 1117 | ||
1117 | 1118 | ||
1119 | /** | ||
1120 | * @ingroup hashmap | ||
1121 | * Call @a it on a random value from the map, or not at all | ||
1122 | * if the map is empty. Note that this function has linear | ||
1123 | * complexity (in the size of the map). | ||
1124 | * | ||
1125 | * @param map the map | ||
1126 | * @param it function to call on a random entry | ||
1127 | * @param it_cls extra argument to @a it | ||
1128 | * @return the number of key value pairs processed, zero or one. | ||
1129 | */ | ||
1130 | unsigned int | ||
1131 | GNUNET_CONTAINER_multipeermap_get_random (const struct GNUNET_CONTAINER_MultiPeerMap *map, | ||
1132 | GNUNET_CONTAINER_PeerMapIterator it, | ||
1133 | void *it_cls); | ||
1134 | |||
1118 | 1135 | ||
1119 | /* Version of multihashmap with 32 bit keys */ | 1136 | /* Version of multihashmap with 32 bit keys */ |
1120 | 1137 | ||