GNUnet  0.11.x
Data Structures | Macros | Functions | Variables
gnunet-service-dht_datacache.c File Reference

GNUnet DHT service's datacache integration. More...

#include "platform.h"
#include "gnunet_datacache_lib.h"
#include "gnunet-service-dht_datacache.h"
#include "gnunet-service-dht_neighbours.h"
#include "gnunet-service-dht_routing.h"
#include "gnunet-service-dht.h"
Include dependency graph for gnunet-service-dht_datacache.c:

Go to the source code of this file.

Data Structures

struct  GetRequestContext
 Context containing information about a GET request. More...
 
struct  SuccContext
 Closure for datacache_get_successors_iterator(). More...
 

Macros

#define LOG(kind, ...)   GNUNET_log_from (kind, "dht-dhtcache", __VA_ARGS__)
 
#define NUM_CLOSEST   42
 How many "closest" results to we return for migration when asked (at most)? More...
 

Functions

void GDS_DATACACHE_handle_put (struct GNUNET_TIME_Absolute expiration, const struct GNUNET_HashCode *key, unsigned int put_path_length, const struct GNUNET_PeerIdentity *put_path, enum GNUNET_BLOCK_Type type, size_t data_size, const void *data)
 Handle a datum we've received from another peer. More...
 
static int datacache_get_iterator (void *cls, const struct GNUNET_HashCode *key, size_t data_size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute exp, unsigned int put_path_length, const struct GNUNET_PeerIdentity *put_path)
 Iterator for local get request results,. More...
 
enum GNUNET_BLOCK_EvaluationResult GDS_DATACACHE_handle_get (const struct GNUNET_HashCode *key, enum GNUNET_BLOCK_Type type, const void *xquery, size_t xquery_size, struct GNUNET_BLOCK_Group *bg, GDS_DATACACHE_GetCallback gc, void *gc_cls)
 Handle a GET request we've received from another peer. More...
 
static int datacache_random_iterator (void *cls, const struct GNUNET_HashCode *key, size_t data_size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute exp, unsigned int path_info_len, const struct GNUNET_PeerIdentity *path_info)
 Function called with a random element from the datacache. More...
 
int GDS_DATACACHE_get_random_key (struct GNUNET_HashCode *key)
 Obtain a random key from the datacache. More...
 
static int datacache_get_successors_iterator (void *cls, const struct GNUNET_HashCode *key, size_t size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute exp, unsigned int put_path_length, const struct GNUNET_PeerIdentity *put_path)
 Iterator for local get request results,. More...
 
void GDS_DATACACHE_get_successors (const struct GNUNET_HashCode *key, GDS_DATACACHE_SuccessorCallback cb, void *cb_cls)
 Handle a request for data close to a key that we have received from another peer. More...
 
void GDS_DATACACHE_init ()
 Initialize datacache subsystem. More...
 
void GDS_DATACACHE_done ()
 Shutdown datacache subsystem. More...
 

Variables

static struct GNUNET_DATACACHE_Handledatacache
 Handle to the datacache service (for inserting/retrieving data) More...
 

Detailed Description

GNUnet DHT service's datacache integration.

Author
Christian Grothoff
Nathan Evans

Definition in file gnunet-service-dht_datacache.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from (kind, "dht-dhtcache", __VA_ARGS__)

◆ NUM_CLOSEST

#define NUM_CLOSEST   42

How many "closest" results to we return for migration when asked (at most)?

Definition at line 39 of file gnunet-service-dht_datacache.c.

Referenced by GDS_DATACACHE_get_successors().

Function Documentation

◆ GDS_DATACACHE_handle_put()

void GDS_DATACACHE_handle_put ( struct GNUNET_TIME_Absolute  expiration,
const struct GNUNET_HashCode key,
unsigned int  put_path_length,
const struct GNUNET_PeerIdentity put_path,
enum GNUNET_BLOCK_Type  type,
size_t  data_size,
const void *  data 
)

Handle a datum we've received from another peer.

Cache if possible.

Parameters
expirationwhen will the reply expire
keythe query this reply is for
put_path_lengthnumber of peers in put_path
put_pathpath the reply took on put
typetype of the reply
data_sizenumber of bytes in data
dataapplication payload data

Definition at line 60 of file gnunet-service-dht_datacache.c.

References _, GDS_stats, gettext_noop, GNUNET_break, GNUNET_CRYPTO_hash_matching_bits(), GNUNET_DATACACHE_put(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_h2s(), GNUNET_log, GNUNET_MAX_MESSAGE_SIZE, GNUNET_NO, GNUNET_STATISTICS_update(), LOG, and my_identity_hash.

Referenced by handle_dht_local_put(), handle_dht_p2p_put(), and process_reply_with_path().

67 {
68  int r;
69 
70  if (NULL == datacache)
71  {
73  _ ("%s request received, but have no datacache!\n"), "PUT");
74  return;
75  }
77  {
78  GNUNET_break (0);
79  return;
80  }
81  /* Put size is actual data size plus struct overhead plus path length (if any) */
83  gettext_noop ("# ITEMS stored in datacache"),
84  1,
85  GNUNET_NO);
87  key,
90  data_size,
91  data,
92  type,
93  expiration,
94  put_path_length,
95  put_path);
97  "DATACACHE PUT for key %s [%u] completed (%d) after %u hops\n",
98  GNUNET_h2s (key),
99  data_size,
100  r,
101  put_path_length);
102 }
struct GNUNET_STATISTICS_Handle * GDS_stats
Handle for the statistics service.
unsigned int GNUNET_CRYPTO_hash_matching_bits(const struct GNUNET_HashCode *first, const struct GNUNET_HashCode *second)
Determine how many low order bits match in two struct GNUNET_HashCodes.
Definition: crypto_hash.c:272
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
int GNUNET_DATACACHE_put(struct GNUNET_DATACACHE_Handle *h, const struct GNUNET_HashCode *key, uint32_t xor_distance, size_t data_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.
Definition: datacache.c:250
#define GNUNET_NO
Definition: gnunet_common.h:78
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_HashCode my_identity_hash
Hash of the identity of this peer.
#define _(String)
GNU gettext support macro.
Definition: platform.h:181
#define LOG(kind,...)
#define GNUNET_MAX_MESSAGE_SIZE
Largest supported message (to be precise, one byte more than the largest possible message...
#define GNUNET_log(kind,...)
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
static struct GNUNET_DATACACHE_Handle * datacache
Handle to the datacache service (for inserting/retrieving data)
uint32_t data
The data value.
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:
Here is the caller graph for this function:

◆ datacache_get_iterator()

static int datacache_get_iterator ( void *  cls,
const struct GNUNET_HashCode key,
size_t  data_size,
const char *  data,
enum GNUNET_BLOCK_Type  type,
struct GNUNET_TIME_Absolute  exp,
unsigned int  put_path_length,
const struct GNUNET_PeerIdentity put_path 
)
static

Iterator for local get request results,.

Parameters
clsclosure for iterator, a struct GetRequestContext
expwhen does this value expire?
keythe key this data is stored under
data_sizethe size of the data identified by key
datathe actual data
typethe type of the data
put_path_lengthnumber of peers in put_path
put_pathpath the reply took on put
Returns
GNUNET_OK to continue iteration, anything else to stop iteration.

Definition at line 162 of file gnunet-service-dht_datacache.c.

References _, GetRequestContext::bg, ctx, GetRequestContext::eval, GetRequestContext::gc, GetRequestContext::gc_cls, GDS_block_context, GDS_stats, gettext_noop, GNUNET_BLOCK_EO_LOCAL_SKIP_CRYPTO, GNUNET_BLOCK_evaluate(), GNUNET_BLOCK_EVALUATION_OK_DUPLICATE, GNUNET_BLOCK_EVALUATION_OK_LAST, GNUNET_BLOCK_EVALUATION_OK_MORE, GNUNET_BLOCK_EVALUATION_REQUEST_INVALID, GNUNET_BLOCK_EVALUATION_REQUEST_VALID, GNUNET_BLOCK_EVALUATION_RESULT_INVALID, GNUNET_BLOCK_EVALUATION_RESULT_IRRELEVANT, GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED, GNUNET_break, GNUNET_break_op, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_h2s(), GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_STATISTICS_update(), GNUNET_SYSERR, GNUNET_TIME_absolute_get_remaining(), LOG, GetRequestContext::xquery, and GetRequestContext::xquery_size.

Referenced by GDS_DATACACHE_handle_get().

170 {
171  static char non_null;
172  struct GetRequestContext *ctx = cls;
174 
175  if (0 == GNUNET_TIME_absolute_get_remaining (exp).rel_value_us)
176  {
177  GNUNET_break (0); /* why does datacache return expired values? */
178  return GNUNET_OK; /* skip expired record */
179  }
180  if ((NULL == data) &&
181  (0 == data_size))
182  data = &non_null; /* point anywhere, but not to NULL */
183 
184  eval
186  type,
187  ctx->bg,
189  key,
190  ctx->xquery,
191  ctx->xquery_size,
192  data,
193  data_size);
195  "Found reply for query %s in datacache, evaluation result is %d\n",
196  GNUNET_h2s (key),
197  (int) eval);
198  ctx->eval = eval;
199  switch (eval)
200  {
203  /* forward to local clients */
206  ("# Good RESULTS found in datacache"), 1,
207  GNUNET_NO);
208  ctx->gc (ctx->gc_cls,
209  type,
210  exp,
211  key,
212  put_path_length, put_path,
213  0, NULL,
214  data, data_size);
215  break;
216 
219  gettext_noop (
220  "# Duplicate RESULTS found in datacache"),
221  1,
222  GNUNET_NO);
223  break;
224 
227  gettext_noop (
228  "# Invalid RESULTS found in datacache"),
229  1,
230  GNUNET_NO);
231  break;
232 
235  gettext_noop (
236  "# Irrelevant RESULTS found in datacache"),
237  1,
238  GNUNET_NO);
239  break;
240 
242  GNUNET_break (0);
243  break;
244 
246  GNUNET_break_op (0);
247  return GNUNET_SYSERR;
248 
251  gettext_noop (
252  "# Unsupported RESULTS found in datacache"),
253  1,
254  GNUNET_NO);
256  _ ("Unsupported block type (%u) in local response!\n"),
257  type);
258  break;
259  }
261 }
Block does not match query (invalid result)
enum GNUNET_BLOCK_EvaluationResult eval
Return value to give back.
struct GNUNET_STATISTICS_Handle * GDS_stats
Handle for the statistics service.
size_t xquery_size
Number of bytes in xquery.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
GDS_DATACACHE_GetCallback gc
Function to call on results.
Block does not match xquery (valid result, not relevant for the request)
#define GNUNET_NO
Definition: gnunet_common.h:78
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
#define _(String)
GNU gettext support macro.
Definition: platform.h:181
struct GNUNET_BLOCK_Context * GDS_block_context
Our handle to the BLOCK library.
#define LOG(kind,...)
Valid result, but suppressed because it is a duplicate.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
enum GNUNET_BLOCK_EvaluationResult GNUNET_BLOCK_evaluate(struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type, struct GNUNET_BLOCK_Group *group, enum GNUNET_BLOCK_EvaluationOptions eo, const struct GNUNET_HashCode *query, const void *xquery, size_t xquery_size, const void *reply_block, size_t reply_block_size)
Function called to validate a reply or a request.
Definition: block.c:338
Last possible valid result.
Context containing information about a GET request.
struct GNUNET_BLOCK_Group * bg
Block group to use to evaluate replies (updated)
The block is obtained from the local database, skip cryptographic checks.
Valid result, and there may be more.
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
GNUNET_BLOCK_EvaluationResult
Possible ways for how a block may relate to a query.
Specified block type not supported by this plugin.
Query format does not match block type (invalid query).
#define GNUNET_log(kind,...)
void * gc_cls
Closure for gc.
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
Definition: time.c:331
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
uint32_t data
The data value.
Query is valid, no reply given.
const void * xquery
extended query (see gnunet_block_lib.h).
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GDS_DATACACHE_handle_get()

enum GNUNET_BLOCK_EvaluationResult GDS_DATACACHE_handle_get ( const struct GNUNET_HashCode key,
enum GNUNET_BLOCK_Type  type,
const void *  xquery,
size_t  xquery_size,
struct GNUNET_BLOCK_Group bg,
GDS_DATACACHE_GetCallback  gc,
void *  gc_cls 
)

Handle a GET request we've received from another peer.

Parameters
keythe query
typerequested data type
xqueryextended query
xquery_sizenumber of bytes in xquery
bgblock group to use for reply evaluation
gcfunction to call on the results
gc_clsclosure for gc
Returns
evaluation result for the local replies

Definition at line 277 of file gnunet-service-dht_datacache.c.

References GetRequestContext::bg, datacache_get_iterator(), GetRequestContext::eval, GetRequestContext::gc, GetRequestContext::gc_cls, GDS_stats, gettext_noop, GNUNET_BLOCK_EVALUATION_REQUEST_VALID, GNUNET_DATACACHE_get(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_NO, GNUNET_STATISTICS_update(), GetRequestContext::key, LOG, GetRequestContext::xquery, and GetRequestContext::xquery_size.

Referenced by handle_dht_local_get(), and handle_dht_p2p_get().

284 {
285  struct GetRequestContext ctx;
286  unsigned int r;
287 
288  if (NULL == datacache)
291  gettext_noop ("# GET requests given to datacache"),
292  1,
293  GNUNET_NO);
295  ctx.key = *key;
296  ctx.xquery = xquery;
297  ctx.xquery_size = xquery_size;
298  ctx.bg = bg;
299  ctx.gc = gc;
300  ctx.gc_cls = gc_cls;
302  key,
303  type,
305  &ctx);
307  "DATACACHE GET for key %s completed (%d). %u results found.\n",
308  GNUNET_h2s (key),
309  ctx.eval,
310  r);
311  return ctx.eval;
312 }
struct GNUNET_STATISTICS_Handle * GDS_stats
Handle for the statistics service.
size_t xquery_size
Number of bytes in xquery.
GDS_DATACACHE_GetCallback gc
Function to call on results.
#define GNUNET_NO
Definition: gnunet_common.h:78
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
#define LOG(kind,...)
unsigned int GNUNET_DATACACHE_get(struct GNUNET_DATACACHE_Handle *h, 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 datacache.
Definition: datacache.c:313
Context containing information about a GET request.
struct GNUNET_BLOCK_Group * bg
Block group to use to evaluate replies (updated)
struct GNUNET_HashCode key
The key used in the DHT.
static int datacache_get_iterator(void *cls, const struct GNUNET_HashCode *key, size_t data_size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute exp, unsigned int put_path_length, const struct GNUNET_PeerIdentity *put_path)
Iterator for local get request results,.
void * gc_cls
Closure for gc.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
static struct GNUNET_DATACACHE_Handle * datacache
Handle to the datacache service (for inserting/retrieving data)
Query is valid, no reply given.
const void * xquery
extended query (see gnunet_block_lib.h).
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:
Here is the caller graph for this function:

◆ datacache_random_iterator()

static int datacache_random_iterator ( void *  cls,
const struct GNUNET_HashCode key,
size_t  data_size,
const char *  data,
enum GNUNET_BLOCK_Type  type,
struct GNUNET_TIME_Absolute  exp,
unsigned int  path_info_len,
const struct GNUNET_PeerIdentity path_info 
)
static

Function called with a random element from the datacache.

Stores the key in the closure.

Parameters
clsa struct GNUNET_HashCode *, where to store the key
keykey for the content
data_sizenumber of bytes in data
datacontent stored
typetype of the content
expwhen will the content expire?
path_info_lennumber of entries in path_info
path_infoa path through the network
Returns
GNUNET_OK to continue iterating, GNUNET_SYSERR to abort

Definition at line 330 of file gnunet-service-dht_datacache.c.

References GNUNET_OK, and GetRequestContext::key.

Referenced by GDS_DATACACHE_get_random_key().

338 {
339  struct GNUNET_HashCode *dest = cls;
340 
341  *dest = *key;
342  return GNUNET_OK; /* should actually not matter which we return */
343 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
A 512-bit hashcode.
struct GNUNET_HashCode key
The key used in the DHT.
Here is the caller graph for this function:

◆ GDS_DATACACHE_get_random_key()

int GDS_DATACACHE_get_random_key ( struct GNUNET_HashCode key)

Obtain a random key from the datacache.

Used by Whanau for load-balancing.

Parameters
[out]keywhere to store the key of a random element, randomized by PRNG if datacache is empty
Returns
GNUNET_OK on success, GNUNET_SYSERR if the datacache is empty

Definition at line 355 of file gnunet-service-dht_datacache.c.

References datacache_random_iterator(), GNUNET_CRYPTO_hash_create_random(), GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_DATACACHE_get_random(), GNUNET_OK, and GNUNET_SYSERR.

356 {
357  if (0 ==
360  key))
361  {
362  /* randomize key in this case */
364  key);
365  return GNUNET_SYSERR;
366  }
367  return GNUNET_OK;
368 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
void GNUNET_CRYPTO_hash_create_random(enum GNUNET_CRYPTO_Quality mode, struct GNUNET_HashCode *result)
Create a random hash code.
Definition: crypto_hash.c:144
Randomness for IVs etc.
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
static int datacache_random_iterator(void *cls, const struct GNUNET_HashCode *key, size_t data_size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute exp, unsigned int path_info_len, const struct GNUNET_PeerIdentity *path_info)
Function called with a random element from the datacache.
static struct GNUNET_DATACACHE_Handle * datacache
Handle to the datacache service (for inserting/retrieving data)
unsigned int GNUNET_DATACACHE_get_random(struct GNUNET_DATACACHE_Handle *h, GNUNET_DATACACHE_Iterator iter, void *iter_cls)
Obtain a random element from the datacache.
Definition: datacache.c:352
Here is the call graph for this function:

◆ datacache_get_successors_iterator()

static int datacache_get_successors_iterator ( void *  cls,
const struct GNUNET_HashCode key,
size_t  size,
const char *  data,
enum GNUNET_BLOCK_Type  type,
struct GNUNET_TIME_Absolute  exp,
unsigned int  put_path_length,
const struct GNUNET_PeerIdentity put_path 
)
static

Iterator for local get request results,.

Parameters
clsclosure with the struct GNUNET_HashCode * with the trail ID
keythe key this data is stored under
sizethe size of the data identified by key
datathe actual data
typethe type of the data
expwhen does this value expire?
put_path_lengthnumber of peers in put_path
put_pathpath the reply took on put
Returns
GNUNET_OK to continue iteration, anything else to stop iteration.

Definition at line 403 of file gnunet-service-dht_datacache.c.

References SuccContext::cb, SuccContext::cb_cls, GNUNET_DHT_RO_RECORD_ROUTE, GNUNET_OK, and sc.

Referenced by GDS_DATACACHE_get_successors().

411 {
412  const struct SuccContext *sc = cls;
413 
414  /* NOTE: The datacache currently does not store the RO from
415  the original 'put', so we don't know the 'correct' option
416  at this point anymore. Thus, we conservatively assume
417  that recording is desired (for now). */
418  sc->cb (sc->cb_cls,
420  key,
421  type,
422  put_path_length, put_path,
423  exp,
424  data,
425  size);
426  return GNUNET_OK;
427 }
We should keep track of the route that the message took in the P2P network.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
void * cb_cls
Closure for cb.
static unsigned int size
Size of the "table".
Definition: peer.c:67
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:37
GDS_DATACACHE_SuccessorCallback cb
Function to call on the result.
Closure for datacache_get_successors_iterator().
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
uint32_t data
The data value.
Here is the caller graph for this function:

◆ GDS_DATACACHE_get_successors()

void GDS_DATACACHE_get_successors ( const struct GNUNET_HashCode key,
GDS_DATACACHE_SuccessorCallback  cb,
void *  cb_cls 
)

Handle a request for data close to a key that we have received from another peer.

Parameters
keythe location at which the peer is looking for data that is close
cbfunction to call with the result
cb_clsclosure for cb

Definition at line 439 of file gnunet-service-dht_datacache.c.

References SuccContext::cb, SuccContext::cb_cls, datacache_get_successors_iterator(), GNUNET_DATACACHE_get_closest(), and NUM_CLOSEST.

442 {
443  struct SuccContext sc;
444 
445  sc.cb = cb;
446  sc.cb_cls = cb_cls;
448  key,
449  NUM_CLOSEST,
451  &sc);
452 }
#define NUM_CLOSEST
How many "closest" results to we return for migration when asked (at most)?
static int datacache_get_successors_iterator(void *cls, const struct GNUNET_HashCode *key, size_t size, const char *data, enum GNUNET_BLOCK_Type type, struct GNUNET_TIME_Absolute exp, unsigned int put_path_length, const struct GNUNET_PeerIdentity *put_path)
Iterator for local get request results,.
void * cb_cls
Closure for cb.
static struct GNUNET_FS_SearchContext * sc
Definition: gnunet-search.c:37
GDS_DATACACHE_SuccessorCallback cb
Function to call on the result.
Closure for datacache_get_successors_iterator().
static struct GNUNET_DATACACHE_Handle * datacache
Handle to the datacache service (for inserting/retrieving data)
unsigned int GNUNET_DATACACHE_get_closest(struct GNUNET_DATACACHE_Handle *h, 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.
Definition: datacache.c:380
Here is the call graph for this function:

◆ GDS_DATACACHE_init()

void GDS_DATACACHE_init ( void  )

Initialize datacache subsystem.

Definition at line 459 of file gnunet-service-dht_datacache.c.

References GDS_cfg, and GNUNET_DATACACHE_create().

Referenced by run().

460 {
461  datacache = GNUNET_DATACACHE_create (GDS_cfg, "dhtcache");
462 }
struct GNUNET_DATACACHE_Handle * GNUNET_DATACACHE_create(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section)
Create a data cache.
Definition: datacache.c:133
const struct GNUNET_CONFIGURATION_Handle * GDS_cfg
Configuration we use.
static struct GNUNET_DATACACHE_Handle * datacache
Handle to the datacache service (for inserting/retrieving data)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GDS_DATACACHE_done()

void GDS_DATACACHE_done ( void  )

Shutdown datacache subsystem.

Definition at line 469 of file gnunet-service-dht_datacache.c.

References GNUNET_DATACACHE_destroy().

Referenced by shutdown_task().

470 {
471  if (NULL != datacache)
472  {
474  datacache = NULL;
475  }
476 }
void GNUNET_DATACACHE_destroy(struct GNUNET_DATACACHE_Handle *h)
Destroy a data cache (and free associated resources).
Definition: datacache.c:212
static struct GNUNET_DATACACHE_Handle * datacache
Handle to the datacache service (for inserting/retrieving data)
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ datacache

struct GNUNET_DATACACHE_Handle* datacache
static

Handle to the datacache service (for inserting/retrieving data)

Definition at line 44 of file gnunet-service-dht_datacache.c.