GNUnet  0.11.x
Data Fields
GNUNET_DATACACHE_PluginFunctions Struct Reference

struct returned by the initialization function of the plugin More...

#include <gnunet_datacache_plugin.h>

Data Fields

void * cls
 Closure to pass to all plugin functions. More...
 
ssize_t(* put )(void *cls, const struct GNUNET_HashCode *key, uint32_t xor_distance, size_t size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute discard_time, unsigned int path_info_len, const struct GNUNET_PeerIdentity *path_info)
 Store an item in the datastore. More...
 
unsigned int(* get )(void *cls, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
 Iterate over the results for a particular key in the datastore. More...
 
int(* del )(void *cls)
 Delete the entry with the lowest expiration value from the datacache right now. More...
 
unsigned int(* get_random )(void *cls, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
 Return a random value from the datastore. More...
 
unsigned int(* get_closest )(void *cls, const struct GNUNET_HashCode *key, unsigned int num_results, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
 Iterate over the results that are "close" to a particular key in the datacache. More...
 

Detailed Description

struct returned by the initialization function of the plugin

Definition at line 97 of file gnunet_datacache_plugin.h.

Field Documentation

◆ cls

void* GNUNET_DATACACHE_PluginFunctions::cls

◆ put

ssize_t(* GNUNET_DATACACHE_PluginFunctions::put) (void *cls, const struct GNUNET_HashCode *key, uint32_t xor_distance, size_t size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute discard_time, unsigned int path_info_len, const struct GNUNET_PeerIdentity *path_info)

Store an item in the datastore.

Parameters
clsclosure (internal context for the plugin)
keykey to store the value under
xor_distancehow close is key to our PID?
sizenumber of bytes in data
datadata to store
typetype of the value
discard_timewhen to discard the value in any case
path_info_lennumber of entries in path_info
path_infoa path through the network
Returns
0 if duplicate, -1 on error, number of bytes used otherwise

Definition at line 118 of file gnunet_datacache_plugin.h.

Referenced by GNUNET_DATACACHE_put(), libgnunet_plugin_datacache_heap_init(), libgnunet_plugin_datacache_postgres_init(), libgnunet_plugin_datacache_sqlite_init(), and libgnunet_plugin_datacache_template_init().

◆ get

unsigned int(* GNUNET_DATACACHE_PluginFunctions::get) (void *cls, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, GNUNET_DATACACHE_Iterator iter, void *iter_cls)

Iterate over the results for a particular key in the datastore.

Parameters
clsclosure (internal context for the plugin)
keykey to look for
typeentries of which type are relevant?
itermaybe NULL (to just count)
iter_clsclosure for iter
Returns
the number of results found

Definition at line 139 of file gnunet_datacache_plugin.h.

Referenced by GNUNET_DATACACHE_get(), libgnunet_plugin_datacache_heap_init(), libgnunet_plugin_datacache_postgres_init(), libgnunet_plugin_datacache_sqlite_init(), and libgnunet_plugin_datacache_template_init().

◆ del

int(* GNUNET_DATACACHE_PluginFunctions::del) (void *cls)

Delete the entry with the lowest expiration value from the datacache right now.

Parameters
clsclosure (internal context for the plugin)
Returns
GNUNET_OK on success, GNUNET_SYSERR on error

Definition at line 152 of file gnunet_datacache_plugin.h.

Referenced by GNUNET_DATACACHE_put(), libgnunet_plugin_datacache_heap_init(), libgnunet_plugin_datacache_postgres_init(), libgnunet_plugin_datacache_sqlite_init(), and libgnunet_plugin_datacache_template_init().

◆ get_random

unsigned int(* GNUNET_DATACACHE_PluginFunctions::get_random) (void *cls, GNUNET_DATACACHE_Iterator iter, void *iter_cls)

Return a random value from the datastore.

Parameters
clsclosure (internal context for the plugin)
itermaybe NULL (to just count)
iter_clsclosure for iter
Returns
the number of results found (zero or one)

Definition at line 162 of file gnunet_datacache_plugin.h.

Referenced by GNUNET_DATACACHE_get_random(), libgnunet_plugin_datacache_heap_init(), libgnunet_plugin_datacache_postgres_init(), libgnunet_plugin_datacache_sqlite_init(), and libgnunet_plugin_datacache_template_init().

◆ get_closest

unsigned int(* GNUNET_DATACACHE_PluginFunctions::get_closest) (void *cls, const struct GNUNET_HashCode *key, unsigned int num_results, GNUNET_DATACACHE_Iterator iter, void *iter_cls)

Iterate over the results that are "close" to a particular key in the datacache.

"close" is defined as numerically larger than key (when interpreted as a circular address space), with small distance.

Parameters
clsclosure (internal context for the plugin)
keyarea of the keyspace to look into
num_resultsnumber of results that should be returned to iter
itermaybe NULL (to just count)
iter_clsclosure for iter
Returns
the number of results found

Definition at line 180 of file gnunet_datacache_plugin.h.

Referenced by GNUNET_DATACACHE_get_closest(), libgnunet_plugin_datacache_heap_init(), libgnunet_plugin_datacache_postgres_init(), libgnunet_plugin_datacache_sqlite_init(), and libgnunet_plugin_datacache_template_init().


The documentation for this struct was generated from the following file: