GNUnet  0.10.x
Data Structures | Functions
plugin_datastore_heap.c File Reference

heap-based datastore backend; usually we want the datastore to be persistent, and storing data in the heap is obviously NOT going to be persistent; still, this plugin is useful for testing/benchmarking — but never for production! More...

#include "platform.h"
#include "gnunet_datastore_plugin.h"
Include dependency graph for plugin_datastore_heap.c:

Go to the source code of this file.

Data Structures

struct  Value
 Entry in the hash map. More...
 
struct  ZeroAnonByType
 We organize 0-anonymity values in arrays "by type". More...
 
struct  Plugin
 Handle for a plugin. More...
 
struct  UpdateContext
 Closure for update_rel_sum() and update_abs_sum(). More...
 
struct  GetContext
 Closure for get_cb(). More...
 
struct  GetAllContext
 Closure for the 'return_value' function. More...
 
struct  RemoveContext
 Closure for iterator called during 'remove_key'. More...
 

Functions

static void heap_plugin_estimate_size (void *cls, unsigned long long *estimate)
 Get an estimate of how much space the database is currently using. More...
 
static int update_iterator (void *cls, const struct GNUNET_HashCode *key, void *val)
 Update the matching value. More...
 
static void heap_plugin_put (void *cls, const struct GNUNET_HashCode *key, bool absent, uint32_t size, const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, uint32_t anonymity, uint32_t replication, struct GNUNET_TIME_Absolute expiration, PluginPutCont cont, void *cont_cls)
 Store an item in the datastore. More...
 
static void delete_value (struct Plugin *plugin, struct Value *value)
 Delete the given value, removing it from the plugin's data structures. More...
 
static int get_iterator (void *cls, const struct GNUNET_HashCode *key, void *val)
 Obtain the matching value with the lowest uid >= next_uid. More...
 
static void heap_plugin_get_key (void *cls, uint64_t next_uid, bool random, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc, void *proc_cls)
 Get one of the results for a particular key in the datastore. More...
 
static void heap_plugin_get_replication (void *cls, PluginDatumProcessor proc, void *proc_cls)
 Get a random item for replication. More...
 
static void heap_plugin_get_expiration (void *cls, PluginDatumProcessor proc, void *proc_cls)
 Get a random item for expiration. More...
 
static void heap_plugin_get_zero_anonymity (void *cls, uint64_t next_uid, enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc, void *proc_cls)
 Call the given processor on an item with zero anonymity. More...
 
static void heap_plugin_drop (void *cls)
 Drop database. More...
 
static int return_value (void *cls, const struct GNUNET_HashCode *key, void *val)
 Callback invoked to call callback on each value. More...
 
static void heap_get_keys (void *cls, PluginKeyProcessor proc, void *proc_cls)
 Get all of the keys in the datastore. More...
 
static int remove_iterator (void *cls, const struct GNUNET_HashCode *key, void *val)
 Obtain the matching value with the lowest uid >= next_uid. More...
 
static void heap_plugin_remove_key (void *cls, const struct GNUNET_HashCode *key, uint32_t size, const void *data, PluginRemoveCont cont, void *cont_cls)
 Remove a particular key in the datastore. More...
 
void * libgnunet_plugin_datastore_heap_init (void *cls)
 Entry point for the plugin. More...
 
static int free_value (void *cls, const struct GNUNET_HashCode *key, void *val)
 Callback invoked to free all value. More...
 
void * libgnunet_plugin_datastore_heap_done (void *cls)
 Exit point from the plugin. More...
 

Detailed Description

heap-based datastore backend; usually we want the datastore to be persistent, and storing data in the heap is obviously NOT going to be persistent; still, this plugin is useful for testing/benchmarking — but never for production!

Author
Christian Grothoff

Definition in file plugin_datastore_heap.c.

Function Documentation

◆ heap_plugin_estimate_size()

static void heap_plugin_estimate_size ( void *  cls,
unsigned long long *  estimate 
)
static

Get an estimate of how much space the database is currently using.

Parameters
clsour "struct Plugin*"
Returns
number of bytes used on disk

Definition at line 188 of file plugin_datastore_heap.c.

References plugin, and Plugin::size.

Referenced by libgnunet_plugin_datastore_heap_init().

189 {
190  struct Plugin *plugin = cls;
191 
192  if (NULL != estimate)
193  *estimate = plugin->size;
194 }
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
unsigned long long size
Size of all values we're storing.
Handle for a plugin.
Definition: block.c:37
Here is the caller graph for this function:

◆ update_iterator()

static int update_iterator ( void *  cls,
const struct GNUNET_HashCode key,
void *  val 
)
static

Update the matching value.

Parameters
clsthe 'struct UpdateContext'
keyunused
valthe 'struct Value'
Returns
GNUNET_YES (continue iteration), GNUNET_NO if value was found

Definition at line 243 of file plugin_datastore_heap.c.

References GNUNET_TIME_Absolute::abs_value_us, Value::data, UpdateContext::data, Value::expiration, UpdateContext::expiration, Value::expire_heap, GNUNET_CONTAINER_heap_update_cost(), GNUNET_NO, GNUNET_TIME_absolute_max(), GNUNET_YES, Value::priority, UpdateContext::priority, Value::replication, UpdateContext::replication, Value::size, UpdateContext::size, uc, UpdateContext::updated, and value.

Referenced by heap_plugin_put().

246 {
247  struct UpdateContext *uc = cls;
248  struct Value *value = val;
249 
250  if (value->size != uc->size)
251  return GNUNET_YES;
252  if (0 != memcmp (value->data, uc->data, uc->size))
253  return GNUNET_YES;
255  uc->expiration);
257  {
258  value->expiration = uc->expiration;
260  value->expiration.abs_value_us);
261  }
262  /* Saturating adds, don't overflow */
263  if (value->priority > UINT32_MAX - uc->priority)
264  value->priority = UINT32_MAX;
265  else
266  value->priority += uc->priority;
267  if (value->replication > UINT32_MAX - uc->replication)
268  value->replication = UINT32_MAX;
269  else
270  value->replication += uc->replication;
271  uc->updated = true;
272  return GNUNET_NO;
273 }
size_t size
Payload (actual payload follows this struct)
void GNUNET_CONTAINER_heap_update_cost(struct GNUNET_CONTAINER_HeapNode *node, GNUNET_CONTAINER_HeapCostType new_cost)
Updates the cost of any node in the tree.
Closure for update_rel_sum() and update_abs_sum().
static struct GNUNET_FS_UnindexContext * uc
#define GNUNET_NO
Definition: gnunet_common.h:81
uint64_t abs_value_us
The actual value.
uint32_t replication
Replication level for the value.
uint32_t priority
Priority of the value.
static char * value
Value of the record to add/remove.
struct GNUNET_CONTAINER_HeapNode * expire_heap
Entry for this value in the 'expire' heap.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_max(struct GNUNET_TIME_Absolute t1, struct GNUNET_TIME_Absolute t2)
Return the maximum of two absolute time values.
Definition: time.c:317
uint32_t replication
Replication level for the value.
const void * data
Pointer to the data.
Entry in the hash map.
uint32_t priority
Priority of the value.
struct GNUNET_TIME_Absolute expiration
Expiration time for this value.
struct GNUNET_TIME_Absolute expiration
Expiration time for this value.
#define GNUNET_YES
Definition: gnunet_common.h:80
const void * data
Pointer to the value's data (allocated at the end of this struct).
uint32_t size
Number of bytes in 'data'.
bool updated
True if the value was found and updated.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ heap_plugin_put()

static void heap_plugin_put ( void *  cls,
const struct GNUNET_HashCode key,
bool  absent,
uint32_t  size,
const void *  data,
enum GNUNET_BLOCK_Type  type,
uint32_t  priority,
uint32_t  anonymity,
uint32_t  replication,
struct GNUNET_TIME_Absolute  expiration,
PluginPutCont  cont,
void *  cont_cls 
)
static

Store an item in the datastore.

Parameters
clsclosure
keykey for the item
absenttrue if the key was not found in the bloom filter
sizenumber of bytes in data
datacontent stored
typetype of the content
prioritypriority of the content
anonymityanonymity-level for the content
replicationreplication-level for the content
expirationexpiration time for the content
contcontinuation called with success or failure status
cont_clscontinuation closure

Definition at line 292 of file plugin_datastore_heap.c.

References GNUNET_TIME_Absolute::abs_value_us, Value::anonymity, ZeroAnonByType::array, ZeroAnonByType::array_pos, ZeroAnonByType::array_size, Plugin::by_expiration, Plugin::by_replication, Value::data, UpdateContext::data, Value::expiration, UpdateContext::expiration, Value::expire_heap, GNUNET_array_grow, GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_heap_insert(), GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_malloc, GNUNET_memcpy, GNUNET_new, GNUNET_NO, GNUNET_OK, Value::key, Plugin::keyvalue, ZeroAnonByType::next, plugin, Value::priority, UpdateContext::priority, Value::replication, UpdateContext::replication, Value::replication_heap, Value::size, Plugin::size, UpdateContext::size, Value::type, ZeroAnonByType::type, update_iterator(), UpdateContext::updated, value, Value::zero_anon_offset, Plugin::zero_head, and Plugin::zero_tail.

Referenced by libgnunet_plugin_datastore_heap_init().

304 {
305  struct Plugin *plugin = cls;
306  struct Value *value;
307 
308  if (!absent) {
309  struct UpdateContext uc;
310 
311  uc.size = size;
312  uc.data = data;
313  uc.priority = priority;
314  uc.replication = replication;
315  uc.expiration = expiration;
316  uc.updated = false;
318  key,
320  &uc);
321  if (uc.updated)
322  {
323  cont (cont_cls, key, size, GNUNET_NO, NULL);
324  return;
325  }
326  }
327  value = GNUNET_malloc (sizeof (struct Value) + size);
328  value->key = *key;
329  value->data = &value[1];
331  value,
332  expiration.abs_value_us);
334  value,
335  replication);
336  value->expiration = expiration;
337  if (0 == anonymity)
338  {
339  struct ZeroAnonByType *zabt;
340 
341  for (zabt = plugin->zero_head; NULL != zabt; zabt = zabt->next)
342  if (zabt->type == type)
343  break;
344  if (NULL == zabt)
345  {
346  zabt = GNUNET_new (struct ZeroAnonByType);
347  zabt->type = type;
349  plugin->zero_tail,
350  zabt);
351  }
352  if (zabt->array_size == zabt->array_pos)
353  {
354  GNUNET_array_grow (zabt->array,
355  zabt->array_size,
356  zabt->array_size * 2 + 4);
357  }
358  value->zero_anon_offset = zabt->array_pos;
359  zabt->array[zabt->array_pos++] = value;
360  }
361  value->size = size;
362  value->priority = priority;
363  value->anonymity = anonymity;
364  value->replication = replication;
365  value->type = type;
366  GNUNET_memcpy (&value[1], data, size);
368  &value->key,
369  value,
371  plugin->size += size;
372  cont (cont_cls, key, size, GNUNET_OK, NULL);
373 }
size_t size
Payload (actual payload follows this struct)
static char * expiration
Credential TTL.
Closure for update_rel_sum() and update_abs_sum().
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_CONTAINER_HeapNode * GNUNET_CONTAINER_heap_insert(struct GNUNET_CONTAINER_Heap *heap, void *element, GNUNET_CONTAINER_HeapCostType cost)
Inserts a new element into the heap.
struct GNUNET_CONTAINER_MultiHashMap * keyvalue
Mapping from keys to 'struct Value's.
static struct GNUNET_FS_UnindexContext * uc
static unsigned int replication
unsigned int array_size
Allocated size of the array.
unsigned int array_pos
First unused offset in 'array'.
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#define GNUNET_new(type)
Allocate a struct or union of the given type.
uint64_t abs_value_us
The actual value.
struct GNUNET_CONTAINER_Heap * by_expiration
Heap organized by minimum expiration time.
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
#define GNUNET_array_grow(arr, size, tsize)
Grow a well-typed (!) array.
uint32_t priority
Priority of the value.
#define GNUNET_memcpy(dst, src, n)
static char * value
Value of the record to add/remove.
enum GNUNET_BLOCK_Type type
Type of all of the values in 'array'.
unsigned int zero_anon_offset
Offset of this value in the array of the 'struct ZeroAnonByType'; only used if anonymity is zero...
enum GNUNET_BLOCK_Type type
Type of the block.
struct GNUNET_CONTAINER_HeapNode * expire_heap
Entry for this value in the 'expire' heap.
struct Value ** array
Array of 0-anonymity items of the given type.
struct ZeroAnonByType * zero_tail
Tail of list of arrays containing zero-anonymity values by type.
We organize 0-anonymity values in arrays "by type".
struct GNUNET_HashCode key
Key for the entry.
struct GNUNET_CONTAINER_HeapNode * replication_heap
Entry for this value in the 'replication' heap.
struct GNUNET_HashCode key
The key used in the DHT.
static unsigned int size
Size of the "table".
Definition: peer.c:67
uint32_t replication
Replication level for the value.
int GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
Allow multiple values with the same key.
Entry in the hash map.
int GNUNET_CONTAINER_multihashmap_get_multiple(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
unsigned long long size
Size of all values we're storing.
uint32_t priority
Priority of the value.
Handle for a plugin.
Definition: block.c:37
struct GNUNET_CONTAINER_Heap * by_replication
Heap organized by maximum replication value.
uint32_t anonymity
Anonymity level for the value.
struct GNUNET_TIME_Absolute expiration
Expiration time for this value.
struct ZeroAnonByType * zero_head
Head of list of arrays containing zero-anonymity values by type.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
static unsigned int anonymity
const void * data
Pointer to the value's data (allocated at the end of this struct).
uint32_t data
The data value.
struct ZeroAnonByType * next
We keep these in a DLL.
#define GNUNET_malloc(size)
Wrapper around malloc.
static int update_iterator(void *cls, const struct GNUNET_HashCode *key, void *val)
Update the matching value.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ delete_value()

static void delete_value ( struct Plugin plugin,
struct Value value 
)
static

Delete the given value, removing it from the plugin's data structures.

Parameters
pluginthe plugin
valuevalue to delete

Definition at line 384 of file plugin_datastore_heap.c.

References Value::anonymity, ZeroAnonByType::array, ZeroAnonByType::array_pos, ZeroAnonByType::array_size, Value::expire_heap, GNUNET_array_grow, GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_heap_remove_node(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_free, GNUNET_YES, Value::key, Plugin::keyvalue, ZeroAnonByType::next, Value::replication_heap, Value::size, Plugin::size, Value::type, ZeroAnonByType::type, Value::zero_anon_offset, Plugin::zero_head, and Plugin::zero_tail.

Referenced by free_value(), heap_plugin_get_expiration(), and heap_plugin_remove_key().

386 {
389  &value->key,
390  value));
393  if (0 == value->anonymity)
394  {
395  struct ZeroAnonByType *zabt;
396 
397  for (zabt = plugin->zero_head; NULL != zabt; zabt = zabt->next)
398  if (zabt->type == value->type)
399  break;
400  GNUNET_assert (NULL != zabt);
401  zabt->array[value->zero_anon_offset] = zabt->array[--zabt->array_pos];
403  if (0 == zabt->array_pos)
404  {
405  GNUNET_array_grow (zabt->array,
406  zabt->array_size,
407  0);
409  plugin->zero_tail,
410  zabt);
411  GNUNET_free (zabt);
412  }
413  }
414  plugin->size -= value->size;
415  GNUNET_free (value);
416 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
size_t size
Payload (actual payload follows this struct)
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_CONTAINER_MultiHashMap * keyvalue
Mapping from keys to 'struct Value's.
unsigned int array_size
Allocated size of the array.
unsigned int array_pos
First unused offset in 'array'.
#define GNUNET_array_grow(arr, size, tsize)
Grow a well-typed (!) array.
enum GNUNET_BLOCK_Type type
Type of all of the values in 'array'.
unsigned int zero_anon_offset
Offset of this value in the array of the 'struct ZeroAnonByType'; only used if anonymity is zero...
enum GNUNET_BLOCK_Type type
Type of the block.
struct GNUNET_CONTAINER_HeapNode * expire_heap
Entry for this value in the 'expire' heap.
int GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
struct Value ** array
Array of 0-anonymity items of the given type.
struct ZeroAnonByType * zero_tail
Tail of list of arrays containing zero-anonymity values by type.
We organize 0-anonymity values in arrays "by type".
struct GNUNET_HashCode key
Key for the entry.
struct GNUNET_CONTAINER_HeapNode * replication_heap
Entry for this value in the 'replication' heap.
unsigned long long size
Size of all values we're storing.
uint32_t anonymity
Anonymity level for the value.
struct ZeroAnonByType * zero_head
Head of list of arrays containing zero-anonymity values by type.
#define GNUNET_YES
Definition: gnunet_common.h:80
void * GNUNET_CONTAINER_heap_remove_node(struct GNUNET_CONTAINER_HeapNode *node)
Removes a node from the heap.
struct ZeroAnonByType * next
We keep these in a DLL.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_iterator()

static int get_iterator ( void *  cls,
const struct GNUNET_HashCode key,
void *  val 
)
static

Obtain the matching value with the lowest uid >= next_uid.

Parameters
clsthe 'struct GetContext'
keyunused
valthe 'struct Value'
Returns
GNUNET_YES (continue iteration), GNUNET_NO if result was found

Definition at line 457 of file plugin_datastore_heap.c.

References GNUNET_BLOCK_TYPE_ANY, GNUNET_NO, GNUNET_OK, GetContext::random, Value::type, GetContext::type, value, and GetContext::value.

Referenced by heap_plugin_get_key().

460 {
461  struct GetContext *gc = cls;
462  struct Value *value = val;
463 
464  if ( (gc->type != GNUNET_BLOCK_TYPE_ANY) &&
465  (gc->type != value->type) )
466  return GNUNET_OK;
467  if (gc->random)
468  {
469  gc->value = value;
470  return GNUNET_NO;
471  }
472  if ( (uint64_t) (intptr_t) value < gc->next_uid)
473  return GNUNET_OK;
474  if ( (NULL != gc->value) &&
475  (value > gc->value) )
476  return GNUNET_OK;
477  gc->value = value;
478  return GNUNET_OK;
479 }
Any type of block, used as a wildcard when searching.
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
static char * value
Value of the record to add/remove.
struct Value * value
Value with lowest uid >= next_uid found so far.
enum GNUNET_BLOCK_Type type
Type of the block.
enum GNUNET_BLOCK_Type type
Block type requested.
bool random
If true, return a random value.
Closure for get_cb().
Entry in the hash map.
Here is the caller graph for this function:

◆ heap_plugin_get_key()

static void heap_plugin_get_key ( void *  cls,
uint64_t  next_uid,
bool  random,
const struct GNUNET_HashCode key,
enum GNUNET_BLOCK_Type  type,
PluginDatumProcessor  proc,
void *  proc_cls 
)
static

Get one of the results for a particular key in the datastore.

Parameters
clsclosure
next_uidreturn the result with lowest uid >= next_uid
randomif true, return a random result instead of using next_uid
keymaybe NULL (to match all entries)
typeentries of which type are relevant? Use 0 for any type.
procfunction to call on the matching value; will be called with NULL if nothing matches
proc_clsclosure for proc

Definition at line 496 of file plugin_datastore_heap.c.

References Value::anonymity, Value::expiration, get_iterator(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_OK, GNUNET_TIME_UNIT_ZERO_ABS, Value::key, Plugin::keyvalue, GetContext::next_uid, plugin, Value::priority, GetContext::random, Value::replication, Value::size, Value::type, GetContext::type, and GetContext::value.

Referenced by libgnunet_plugin_datastore_heap_init().

503 {
504  struct Plugin *plugin = cls;
505  struct GetContext gc;
506 
507  gc.value = NULL;
508  gc.next_uid = next_uid;
509  gc.random = random;
510  gc.type = type;
511  if (NULL == key)
512  {
514  &get_iterator,
515  &gc);
516  }
517  else
518  {
520  key,
521  &get_iterator,
522  &gc);
523  }
524  if (NULL == gc.value)
525  {
526  proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
527  return;
528  }
530  proc (proc_cls,
531  &gc.value->key,
532  gc.value->size,
533  &gc.value[1],
534  gc.value->type,
535  gc.value->priority,
536  gc.value->anonymity,
537  gc.value->replication,
538  gc.value->expiration,
539  (uint64_t) (intptr_t) gc.value));
540 }
#define GNUNET_TIME_UNIT_ZERO_ABS
Absolute time zero.
static int get_iterator(void *cls, const struct GNUNET_HashCode *key, void *val)
Obtain the matching value with the lowest uid >= next_uid.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
struct GNUNET_CONTAINER_MultiHashMap * keyvalue
Mapping from keys to &#39;struct Value&#39;s.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
uint64_t next_uid
Lowest uid to consider.
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
struct Value * value
Value with lowest uid >= next_uid found so far.
bool random
If true, return a random value.
Closure for get_cb().
int GNUNET_CONTAINER_multihashmap_get_multiple(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
Handle for a plugin.
Definition: block.c:37
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ heap_plugin_get_replication()

static void heap_plugin_get_replication ( void *  cls,
PluginDatumProcessor  proc,
void *  proc_cls 
)
static

Get a random item for replication.

Returns a single, not expired, random item from those with the highest replication counters. The item's replication counter is decremented by one IF it was positive before. Call 'proc' with all values ZERO or NULL if the datastore is empty.

Parameters
clsclosure
procfunction to call the value (once only).
proc_clsclosure for proc

Definition at line 555 of file plugin_datastore_heap.c.

References Value::anonymity, Plugin::by_replication, Value::expiration, GNUNET_assert, GNUNET_CONTAINER_heap_insert(), GNUNET_CONTAINER_heap_remove_root(), GNUNET_CONTAINER_heap_walk_get_next(), GNUNET_OK, GNUNET_TIME_UNIT_ZERO_ABS, Value::key, plugin, Value::priority, Value::replication, Value::replication_heap, Value::size, Value::type, and value.

Referenced by libgnunet_plugin_datastore_heap_init().

558 {
559  struct Plugin *plugin = cls;
560  struct Value *value;
561 
563  if (NULL == value)
564  {
565  proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
566  return;
567  }
568  if (value->replication > 0)
569  {
570  value->replication--;
572  value,
573  value->replication);
574  }
575  else
576  {
577  /* need a better way to pick a random item, replication level is always 0 */
579  value,
580  value->replication);
582  }
584  proc (proc_cls,
585  &value->key,
586  value->size,
587  &value[1],
588  value->type,
589  value->priority,
590  value->anonymity,
591  value->replication,
592  value->expiration,
593  (uint64_t) (intptr_t) value));
594 }
size_t size
Payload (actual payload follows this struct)
#define GNUNET_TIME_UNIT_ZERO_ABS
Absolute time zero.
struct GNUNET_CONTAINER_HeapNode * GNUNET_CONTAINER_heap_insert(struct GNUNET_CONTAINER_Heap *heap, void *element, GNUNET_CONTAINER_HeapCostType cost)
Inserts a new element into the heap.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
static char * value
Value of the record to add/remove.
enum GNUNET_BLOCK_Type type
Type of the block.
void * GNUNET_CONTAINER_heap_walk_get_next(struct GNUNET_CONTAINER_Heap *heap)
Perform a random walk of the tree.
struct GNUNET_HashCode key
Key for the entry.
struct GNUNET_CONTAINER_HeapNode * replication_heap
Entry for this value in the &#39;replication&#39; heap.
uint32_t replication
Replication level for the value.
Entry in the hash map.
uint32_t priority
Priority of the value.
Handle for a plugin.
Definition: block.c:37
struct GNUNET_CONTAINER_Heap * by_replication
Heap organized by maximum replication value.
uint32_t anonymity
Anonymity level for the value.
void * GNUNET_CONTAINER_heap_remove_root(struct GNUNET_CONTAINER_Heap *heap)
Remove root of the heap.
struct GNUNET_TIME_Absolute expiration
Expiration time for this value.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ heap_plugin_get_expiration()

static void heap_plugin_get_expiration ( void *  cls,
PluginDatumProcessor  proc,
void *  proc_cls 
)
static

Get a random item for expiration.

Call 'proc' with all values ZERO or NULL if the datastore is empty.

Parameters
clsclosure
procfunction to call the value (once only).
proc_clsclosure for proc

Definition at line 606 of file plugin_datastore_heap.c.

References Value::anonymity, Plugin::by_expiration, delete_value(), Value::expiration, GNUNET_CONTAINER_heap_peek(), GNUNET_NO, GNUNET_TIME_UNIT_ZERO_ABS, Value::key, plugin, Value::priority, Value::replication, Value::size, Value::type, and value.

Referenced by libgnunet_plugin_datastore_heap_init().

608 {
609  struct Plugin *plugin = cls;
610  struct Value *value;
611 
612  value = GNUNET_CONTAINER_heap_peek (plugin->by_expiration);
613  if (NULL == value)
614  {
615  proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
616  return;
617  }
618  if (GNUNET_NO ==
619  proc (proc_cls,
620  &value->key,
621  value->size,
622  &value[1],
623  value->type,
624  value->priority,
625  value->anonymity,
626  value->replication,
627  value->expiration,
628  (uint64_t) (intptr_t) value))
629  delete_value (plugin, value);
630 }
size_t size
Payload (actual payload follows this struct)
#define GNUNET_TIME_UNIT_ZERO_ABS
Absolute time zero.
static void delete_value(struct Plugin *plugin, struct Value *value)
Delete the given value, removing it from the plugin&#39;s data structures.
#define GNUNET_NO
Definition: gnunet_common.h:81
struct GNUNET_CONTAINER_Heap * by_expiration
Heap organized by minimum expiration time.
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
static char * value
Value of the record to add/remove.
void * GNUNET_CONTAINER_heap_peek(const struct GNUNET_CONTAINER_Heap *heap)
Get element stored at the root of heap.
enum GNUNET_BLOCK_Type type
Type of the block.
struct GNUNET_HashCode key
Key for the entry.
uint32_t replication
Replication level for the value.
Entry in the hash map.
uint32_t priority
Priority of the value.
Handle for a plugin.
Definition: block.c:37
uint32_t anonymity
Anonymity level for the value.
struct GNUNET_TIME_Absolute expiration
Expiration time for this value.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ heap_plugin_get_zero_anonymity()

static void heap_plugin_get_zero_anonymity ( void *  cls,
uint64_t  next_uid,
enum GNUNET_BLOCK_Type  type,
PluginDatumProcessor  proc,
void *  proc_cls 
)
static

Call the given processor on an item with zero anonymity.

Parameters
clsour "struct Plugin*"
next_uidreturn the result with lowest uid >= next_uid
typeentries of which type should be considered? Must not be zero (ANY).
procfunction to call on each matching value; will be called with NULL if no value matches
proc_clsclosure for proc

Definition at line 645 of file plugin_datastore_heap.c.

References Value::anonymity, ZeroAnonByType::array, ZeroAnonByType::array_pos, Value::expiration, GNUNET_assert, GNUNET_BLOCK_TYPE_ANY, GNUNET_OK, GNUNET_TIME_UNIT_ZERO_ABS, Value::key, ZeroAnonByType::next, plugin, Value::priority, Value::replication, Value::size, Value::type, ZeroAnonByType::type, value, and Plugin::zero_head.

Referenced by libgnunet_plugin_datastore_heap_init().

648 {
649  struct Plugin *plugin = cls;
650  struct ZeroAnonByType *zabt;
651  struct Value *value = NULL;
652 
653  for (zabt = plugin->zero_head; NULL != zabt; zabt = zabt->next)
654  {
655  if ( (type != GNUNET_BLOCK_TYPE_ANY) &&
656  (type != zabt->type) )
657  continue;
658  for (int i = 0; i < zabt->array_pos; ++i)
659  {
660  if ( (uint64_t) (intptr_t) zabt->array[i] < next_uid)
661  continue;
662  if ( (NULL != value) &&
663  (zabt->array[i] > value) )
664  continue;
665  value = zabt->array[i];
666  }
667  }
668  if (NULL == value)
669  {
670  proc (proc_cls, NULL, 0, NULL, 0, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
671  return;
672  }
674  proc (proc_cls,
675  &value->key,
676  value->size,
677  &value[1],
678  value->type,
679  value->priority,
680  value->anonymity,
681  value->replication,
682  value->expiration,
683  (uint64_t) (intptr_t) value));
684 }
size_t size
Payload (actual payload follows this struct)
#define GNUNET_TIME_UNIT_ZERO_ABS
Absolute time zero.
Any type of block, used as a wildcard when searching.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
unsigned int array_pos
First unused offset in &#39;array&#39;.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
static char * value
Value of the record to add/remove.
enum GNUNET_BLOCK_Type type
Type of all of the values in &#39;array&#39;.
enum GNUNET_BLOCK_Type type
Type of the block.
struct Value ** array
Array of 0-anonymity items of the given type.
We organize 0-anonymity values in arrays "by type".
struct GNUNET_HashCode key
Key for the entry.
uint32_t replication
Replication level for the value.
Entry in the hash map.
uint32_t priority
Priority of the value.
Handle for a plugin.
Definition: block.c:37
uint32_t anonymity
Anonymity level for the value.
struct GNUNET_TIME_Absolute expiration
Expiration time for this value.
struct ZeroAnonByType * zero_head
Head of list of arrays containing zero-anonymity values by type.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct ZeroAnonByType * next
We keep these in a DLL.
Here is the caller graph for this function:

◆ heap_plugin_drop()

static void heap_plugin_drop ( void *  cls)
static

Drop database.

Definition at line 691 of file plugin_datastore_heap.c.

Referenced by libgnunet_plugin_datastore_heap_init().

692 {
693  /* nothing needs to be done */
694 }
Here is the caller graph for this function:

◆ return_value()

static int return_value ( void *  cls,
const struct GNUNET_HashCode key,
void *  val 
)
static

Callback invoked to call callback on each value.

Parameters
clsthe plugin
keyunused
valthe value
Returns
GNUNET_OK (continue to iterate)

Definition at line 723 of file plugin_datastore_heap.c.

References GNUNET_OK, GetAllContext::proc, and GetAllContext::proc_cls.

Referenced by heap_get_keys().

726 {
727  struct GetAllContext *gac = cls;
728 
729  gac->proc (gac->proc_cls,
730  key,
731  1);
732  return GNUNET_OK;
733 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
PluginKeyProcessor proc
Function to call.
void * proc_cls
Closure for &#39;proc&#39;.
Closure for the &#39;return_value&#39; function.
Here is the caller graph for this function:

◆ heap_get_keys()

static void heap_get_keys ( void *  cls,
PluginKeyProcessor  proc,
void *  proc_cls 
)
static

Get all of the keys in the datastore.

Parameters
clsclosure
procfunction to call on each key
proc_clsclosure for proc

Definition at line 744 of file plugin_datastore_heap.c.

References GNUNET_CONTAINER_multihashmap_iterate(), Plugin::keyvalue, plugin, GetAllContext::proc, GetAllContext::proc_cls, and return_value().

Referenced by libgnunet_plugin_datastore_heap_init().

747 {
748  struct Plugin *plugin = cls;
749  struct GetAllContext gac;
750 
751  gac.proc = proc;
752  gac.proc_cls = proc_cls;
754  &return_value,
755  &gac);
756  proc (proc_cls, NULL, 0);
757 }
struct GNUNET_CONTAINER_MultiHashMap * keyvalue
Mapping from keys to &#39;struct Value&#39;s.
PluginKeyProcessor proc
Function to call.
void * proc_cls
Closure for &#39;proc&#39;.
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
Closure for the &#39;return_value&#39; function.
static int return_value(void *cls, const struct GNUNET_HashCode *key, void *val)
Callback invoked to call callback on each value.
Handle for a plugin.
Definition: block.c:37
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_iterator()

static int remove_iterator ( void *  cls,
const struct GNUNET_HashCode key,
void *  val 
)
static

Obtain the matching value with the lowest uid >= next_uid.

Parameters
clsthe 'struct GetContext'
keyunused
valthe 'struct Value'
Returns
GNUNET_YES (continue iteration), GNUNET_NO if result was found

Definition at line 793 of file plugin_datastore_heap.c.

References Value::data, RemoveContext::data, GNUNET_NO, GNUNET_YES, Value::size, RemoveContext::size, value, and RemoveContext::value.

Referenced by heap_plugin_remove_key().

796 {
797  struct RemoveContext *rc = cls;
798  struct Value *value = val;
799 
800  if (value->size != rc->size)
801  return GNUNET_YES;
802  if (0 != memcmp (value->data, rc->data, rc->size))
803  return GNUNET_YES;
804  rc->value = value;
805  return GNUNET_NO;
806 }
size_t size
Payload (actual payload follows this struct)
uint32_t size
Size of data.
const void * data
Data to remove.
#define GNUNET_NO
Definition: gnunet_common.h:81
static char * value
Value of the record to add/remove.
struct Value * value
Value found.
Entry in the hash map.
#define GNUNET_YES
Definition: gnunet_common.h:80
const void * data
Pointer to the value&#39;s data (allocated at the end of this struct).
Closure for iterator called during &#39;remove_key&#39;.
Here is the caller graph for this function:

◆ heap_plugin_remove_key()

static void heap_plugin_remove_key ( void *  cls,
const struct GNUNET_HashCode key,
uint32_t  size,
const void *  data,
PluginRemoveCont  cont,
void *  cont_cls 
)
static

Remove a particular key in the datastore.

Parameters
clsclosure
keykey for the content
sizenumber of bytes in data
datacontent stored
contcontinuation called with success or failure status
cont_clscontinuation closure for cont

Definition at line 820 of file plugin_datastore_heap.c.

References Value::data, RemoveContext::data, delete_value(), GNUNET_CONTAINER_multihashmap_get_multiple(), GNUNET_NO, GNUNET_OK, Plugin::keyvalue, plugin, remove_iterator(), Value::size, RemoveContext::size, and RemoveContext::value.

Referenced by libgnunet_plugin_datastore_heap_init().

826 {
827  struct Plugin *plugin = cls;
828  struct RemoveContext rc;
829 
830  rc.value = NULL;
831  rc.size = size;
832  rc.data = data;
834  key,
836  &rc);
837  if (NULL == rc.value)
838  {
839  cont (cont_cls,
840  key,
841  size,
842  GNUNET_NO,
843  NULL);
844  return;
845  }
846  delete_value (plugin,
847  rc.value);
848  cont (cont_cls,
849  key,
850  size,
851  GNUNET_OK,
852  NULL);
853 }
size_t size
Payload (actual payload follows this struct)
struct GNUNET_CONTAINER_MultiHashMap * keyvalue
Mapping from keys to &#39;struct Value&#39;s.
static void delete_value(struct Plugin *plugin, struct Value *value)
Delete the given value, removing it from the plugin&#39;s data structures.
#define GNUNET_NO
Definition: gnunet_common.h:81
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
struct Value * value
Value found.
static int remove_iterator(void *cls, const struct GNUNET_HashCode *key, void *val)
Obtain the matching value with the lowest uid >= next_uid.
static unsigned int size
Size of the "table".
Definition: peer.c:67
int GNUNET_CONTAINER_multihashmap_get_multiple(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
Handle for a plugin.
Definition: block.c:37
Closure for iterator called during &#39;remove_key&#39;.
uint32_t data
The data value.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libgnunet_plugin_datastore_heap_init()

void* libgnunet_plugin_datastore_heap_init ( void *  cls)

Entry point for the plugin.

Parameters
clsthe "struct GNUNET_DATASTORE_PluginEnvironment*"
Returns
our "struct Plugin*"

Definition at line 863 of file plugin_datastore_heap.c.

References _, Plugin::api, Plugin::by_expiration, Plugin::by_replication, GNUNET_DATASTORE_PluginEnvironment::cfg, GNUNET_DATASTORE_PluginEnvironment::cls, GNUNET_DATASTORE_PluginFunctions::cls, GNUNET_DATASTORE_PluginFunctions::drop, env, Plugin::env, GNUNET_DATASTORE_PluginFunctions::estimate_size, GNUNET_DATASTORE_PluginFunctions::get_expiration, GNUNET_DATASTORE_PluginFunctions::get_key, GNUNET_DATASTORE_PluginFunctions::get_keys, GNUNET_DATASTORE_PluginFunctions::get_replication, GNUNET_DATASTORE_PluginFunctions::get_zero_anonymity, GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONTAINER_heap_create(), GNUNET_CONTAINER_HEAP_ORDER_MAX, GNUNET_CONTAINER_HEAP_ORDER_MIN, GNUNET_CONTAINER_multihashmap_create(), GNUNET_ERROR_TYPE_INFO, GNUNET_log_from, GNUNET_new, GNUNET_OK, GNUNET_YES, heap_get_keys(), heap_plugin_drop(), heap_plugin_estimate_size(), heap_plugin_get_expiration(), heap_plugin_get_key(), heap_plugin_get_replication(), heap_plugin_get_zero_anonymity(), heap_plugin_put(), heap_plugin_remove_key(), Plugin::keyvalue, plugin, GNUNET_DATASTORE_PluginFunctions::put, and GNUNET_DATASTORE_PluginFunctions::remove_key.

864 {
867  struct Plugin *plugin;
868  unsigned long long esize;
869 
870  if (GNUNET_OK !=
872  "datastore-heap",
873  "HASHMAPSIZE",
874  &esize))
875  esize = 128 * 1024;
876  plugin = GNUNET_new (struct Plugin);
877  plugin->env = env;
882  api->cls = plugin;
884  api->put = &heap_plugin_put;
889  api->drop = &heap_plugin_drop;
890  api->get_keys = &heap_get_keys;
893  _("Heap database running\n"));
894  return api;
895 }
PluginGetKeys get_keys
Iterate over all keys in the database.
PluginPut put
Function to store an item in the datastore.
PluginGetType get_zero_anonymity
Get datum (of the specified type) with anonymity level zero.
int GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
static void heap_plugin_put(void *cls, const struct GNUNET_HashCode *key, bool absent, uint32_t size, const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, uint32_t anonymity, uint32_t replication, struct GNUNET_TIME_Absolute expiration, PluginPutCont cont, void *cont_cls)
Store an item in the datastore.
struct GNUNET_CONTAINER_MultiHashMap * keyvalue
Mapping from keys to &#39;struct Value&#39;s.
static void heap_plugin_get_key(void *cls, uint64_t next_uid, bool random, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc, void *proc_cls)
Get one of the results for a particular key in the datastore.
PluginRemoveKey remove_key
Function to remove an item from the database.
PluginEstimateSize estimate_size
Calculate the current on-disk size of the SQ store.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct GNUNET_CONTAINER_Heap * by_expiration
Heap organized by minimum expiration time.
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
Definition: block.c:47
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
PluginGetRandom get_replication
Function to get a random item with high replication score from the database, lowering the item&#39;s repl...
static void heap_plugin_get_replication(void *cls, PluginDatumProcessor proc, void *proc_cls)
Get a random item for replication.
PluginDrop drop
Delete the database.
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
PluginGetRandom get_expiration
Function to get a random expired item or, if none are expired, either the oldest entry or one with a ...
struct GNUNET_DATACACHE_PluginEnvironment * env
Our execution environment.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
static void heap_plugin_drop(void *cls)
Drop database.
Heap with the minimum cost at the root.
The datastore service will pass a pointer to a struct of this type as the first and only argument to ...
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
static void heap_plugin_estimate_size(void *cls, unsigned long long *estimate)
Get an estimate of how much space the database is currently using.
void * cls
Closure to use for all of the following callbacks (except "next_request").
struct GNUNET_CONTAINER_Heap * GNUNET_CONTAINER_heap_create(enum GNUNET_CONTAINER_HeapOrder order)
Create a new heap.
static void heap_plugin_get_zero_anonymity(void *cls, uint64_t next_uid, enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc, void *proc_cls)
Call the given processor on an item with zero anonymity.
Handle for a plugin.
Definition: block.c:37
struct GNUNET_CONTAINER_Heap * by_replication
Heap organized by maximum replication value.
Heap with the maximum cost at the root.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
static void heap_get_keys(void *cls, PluginKeyProcessor proc, void *proc_cls)
Get all of the keys in the datastore.
static void heap_plugin_remove_key(void *cls, const struct GNUNET_HashCode *key, uint32_t size, const void *data, PluginRemoveCont cont, void *cont_cls)
Remove a particular key in the datastore.
#define GNUNET_YES
Definition: gnunet_common.h:80
#define GNUNET_log_from(kind, comp,...)
PluginGetKey get_key
Get a particular datum matching a given hash from the datastore.
static void heap_plugin_get_expiration(void *cls, PluginDatumProcessor proc, void *proc_cls)
Get a random item for expiration.
const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration to use.
Here is the call graph for this function:

◆ free_value()

static int free_value ( void *  cls,
const struct GNUNET_HashCode key,
void *  val 
)
static

Callback invoked to free all value.

Parameters
clsthe plugin
keyunused
valthe value
Returns
GNUNET_OK (continue to iterate)

Definition at line 907 of file plugin_datastore_heap.c.

References delete_value(), GNUNET_OK, plugin, and value.

Referenced by libgnunet_plugin_datastore_heap_done().

910 {
911  struct Plugin *plugin = cls;
912  struct Value *value = val;
913 
914  delete_value (plugin, value);
915  return GNUNET_OK;
916 }
static void delete_value(struct Plugin *plugin, struct Value *value)
Delete the given value, removing it from the plugin&#39;s data structures.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
static char * value
Value of the record to add/remove.
Entry in the hash map.
Handle for a plugin.
Definition: block.c:37
Here is the call graph for this function:
Here is the caller graph for this function:

◆ libgnunet_plugin_datastore_heap_done()

void* libgnunet_plugin_datastore_heap_done ( void *  cls)

Exit point from the plugin.

Parameters
clsour "struct Plugin*"
Returns
always NULL

Definition at line 925 of file plugin_datastore_heap.c.

References Plugin::by_expiration, Plugin::by_replication, GNUNET_DATASTORE_PluginFunctions::cls, free_value(), GNUNET_CONTAINER_heap_destroy(), GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_free, Plugin::keyvalue, and plugin.

926 {
928  struct Plugin *plugin = api->cls;
929 
931  &free_value,
932  plugin);
936  GNUNET_free (plugin);
937  GNUNET_free (api);
938  return NULL;
939 }
struct GNUNET_CONTAINER_MultiHashMap * keyvalue
Mapping from keys to &#39;struct Value&#39;s.
struct GNUNET_CONTAINER_Heap * by_expiration
Heap organized by minimum expiration time.
static int free_value(void *cls, const struct GNUNET_HashCode *key, void *val)
Callback invoked to free all value.
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
void GNUNET_CONTAINER_heap_destroy(struct GNUNET_CONTAINER_Heap *heap)
Destroys the heap.
void * cls
Closure to use for all of the following callbacks (except "next_request").
Handle for a plugin.
Definition: block.c:37
struct GNUNET_CONTAINER_Heap * by_replication
Heap organized by maximum replication value.
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function: