GNUnet 0.21.0
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, uint32_t xor_distance, const struct GNUNET_DATACACHE_Block *block)
 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 101 of file gnunet_datacache_plugin.h.

Field Documentation

◆ cls

void* GNUNET_DATACACHE_PluginFunctions::cls

◆ put

ssize_t(* GNUNET_DATACACHE_PluginFunctions::put) (void *cls, uint32_t xor_distance, const struct GNUNET_DATACACHE_Block *block)

Store an item in the datastore.

Parameters
clsclosure (internal context for the plugin)
xor_distancehow close is key to our PID?
blockdata to store
Returns
0 if duplicate, -1 on error, number of bytes used otherwise

Definition at line 116 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 133 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 133 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 167 of file gnunet_datacache_plugin.h.


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