GNUnet  0.16.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_DHT_PathElement *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...
 
enum GNUNET_GenericReturnValue(* del )(void *cls)
 Delete the entry with the lowest expiration value from the datacache right now. More...
 
unsigned int(* get_closest )(void *cls, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, 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_DHT_PathElement *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.

◆ 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 141 of file gnunet_datacache_plugin.h.

◆ del

enum GNUNET_GenericReturnValue(* 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 141 of file gnunet_datacache_plugin.h.

◆ get_closest

unsigned int(* GNUNET_DATACACHE_PluginFunctions::get_closest) (void *cls, const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, 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 returning the num_results that are numerically closest and larger than key and also num_results that are numerically lower than key. Thus, the maximum number of results returned is actually twice num_results.

Parameters
clsclosure (internal context for the plugin)
keyarea of the keyspace to look into
typedesired block type for the replies
num_resultshalf the number 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 175 of file gnunet_datacache_plugin.h.


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