a version of hash map implemented in container_multihashmap.c but with uint32_t as keys More...
Go to the source code of this file.
Data Structures | |
union | MapEntry |
Entry in the map. More... | |
struct | GNUNET_CONTAINER_MultiHashMap32 |
Internal representation of the hash map. More... | |
struct | GNUNET_CONTAINER_MultiHashMap32Iterator |
Cursor into a multihashmap. More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "util-container-multihashmap32", __VA_ARGS__) |
#define | NEXT_CACHE_SIZE 16 |
Maximum recursion depth for callbacks of GNUNET_CONTAINER_multihashmap_get_multiple() themselves again calling GNUNET_CONTAINER_multihashmap_get_multiple(). More... | |
Functions | |
struct GNUNET_CONTAINER_MultiHashMap32 * | GNUNET_CONTAINER_multihashmap32_create (unsigned int len) |
Create a multi hash map. More... | |
void | GNUNET_CONTAINER_multihashmap32_destroy (struct GNUNET_CONTAINER_MultiHashMap32 *map) |
Destroy a hash map. More... | |
static unsigned int | idx_of (const struct GNUNET_CONTAINER_MultiHashMap32 *m, const uint32_t key) |
Compute the index of the bucket for the given key. More... | |
unsigned int | GNUNET_CONTAINER_multihashmap32_size (const struct GNUNET_CONTAINER_MultiHashMap32 *map) |
Get the number of key-value pairs in the map. More... | |
void * | GNUNET_CONTAINER_multihashmap32_get (const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key) |
Given a key find a value in the map matching the key. More... | |
int | GNUNET_CONTAINER_multihashmap32_iterate (struct GNUNET_CONTAINER_MultiHashMap32 *map, GNUNET_CONTAINER_MulitHashMapIterator32Callback it, void *it_cls) |
Iterate over all entries in the map. More... | |
static void | update_next_cache (struct GNUNET_CONTAINER_MultiHashMap32 *map, const struct MapEntry *me) |
We are about to free() the me, make sure it is not in the list of next values for any iterator in the map's next_cache. More... | |
int | GNUNET_CONTAINER_multihashmap32_remove (struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, const void *value) |
Remove the given key-value pair from the map. More... | |
int | GNUNET_CONTAINER_multihashmap32_remove_all (struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key) |
Remove all entries for the given key from the map. More... | |
int | GNUNET_CONTAINER_multihashmap32_contains (const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key) |
Check if the map contains any value under the given key (including values that are NULL). More... | |
int | GNUNET_CONTAINER_multihashmap32_contains_value (const struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, const void *value) |
Check if the map contains the given value under the given key. More... | |
static void | grow (struct GNUNET_CONTAINER_MultiHashMap32 *map) |
Grow the given map to a more appropriate size. More... | |
int | GNUNET_CONTAINER_multihashmap32_put (struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt) |
Store a key-value pair in the map. More... | |
int | GNUNET_CONTAINER_multihashmap32_get_multiple (struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, GNUNET_CONTAINER_MulitHashMapIterator32Callback it, void *it_cls) |
Iterate over all entries in the map that match a particular key. More... | |
struct GNUNET_CONTAINER_MultiHashMap32Iterator * | GNUNET_CONTAINER_multihashmap32_iterator_create (const struct GNUNET_CONTAINER_MultiHashMap32 *map) |
Create an iterator for a multihashmap. More... | |
int | GNUNET_CONTAINER_multihashmap32_iterator_next (struct GNUNET_CONTAINER_MultiHashMap32Iterator *iter, uint32_t *key, const void **value) |
Retrieve the next element from the hash map at the iterator's position. More... | |
void | GNUNET_CONTAINER_multihashmap32_iterator_destroy (struct GNUNET_CONTAINER_MultiHashMapIterator *iter) |
Destroy a multihashmap iterator. More... | |
a version of hash map implemented in container_multihashmap.c but with uint32_t as keys
Definition in file container_multihashmap32.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "util-container-multihashmap32", __VA_ARGS__) |
Definition at line 32 of file container_multihashmap32.c.
#define NEXT_CACHE_SIZE 16 |
Maximum recursion depth for callbacks of GNUNET_CONTAINER_multihashmap_get_multiple() themselves again calling GNUNET_CONTAINER_multihashmap_get_multiple().
Should be totally excessive, but if violated we die.
Definition at line 42 of file container_multihashmap32.c.
|
static |
Compute the index of the bucket for the given key.
m | hash map for which to compute the index |
key | what key should the index be computed for |
Definition at line 192 of file container_multihashmap32.c.
References GNUNET_assert, key, and m.
Referenced by GNUNET_CONTAINER_multihashmap32_contains(), GNUNET_CONTAINER_multihashmap32_contains_value(), GNUNET_CONTAINER_multihashmap32_get(), GNUNET_CONTAINER_multihashmap32_get_multiple(), GNUNET_CONTAINER_multihashmap32_put(), GNUNET_CONTAINER_multihashmap32_remove(), GNUNET_CONTAINER_multihashmap32_remove_all(), and grow().
|
static |
We are about to free() the me, make sure it is not in the list of next values for any iterator in the map's next_cache.
map | the map to check |
me | the entry that is about to be free'd |
Definition at line 270 of file container_multihashmap32.c.
References map, me, GNUNET_CONTAINER_MultiPeerMap::next_cache, and GNUNET_CONTAINER_MultiPeerMap::next_cache_off.
Referenced by GNUNET_CONTAINER_multihashmap32_remove(), and GNUNET_CONTAINER_multihashmap32_remove_all().
|
static |
Grow the given map to a more appropriate size.
map | the hash map to grow |
Definition at line 400 of file container_multihashmap32.c.
References e, GNUNET_free, GNUNET_malloc_large, idx_of(), map, GNUNET_CONTAINER_MultiPeerMap::map, GNUNET_CONTAINER_MultiPeerMap::map_length, and GNUNET_CONTAINER_MultiPeerMap::modification_counter.
Referenced by GNUNET_CONTAINER_multihashmap32_put().