aboutsummaryrefslogtreecommitdiff
path: root/src/datacache/datacache.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-04-30 07:56:00 +0000
committerChristian Grothoff <christian@grothoff.org>2015-04-30 07:56:00 +0000
commit786745c969589eae2aa069885b40eba0f3989507 (patch)
tree6f5c8573b021ba628b4f135f3fb964728b3e1724 /src/datacache/datacache.c
parenta49b0f351926cf4376a58937a94e37426e3ae167 (diff)
downloadgnunet-786745c969589eae2aa069885b40eba0f3989507.tar.gz
gnunet-786745c969589eae2aa069885b40eba0f3989507.zip
implementing 'get_closest' API for sqlite and postgres datacache plugins
Diffstat (limited to 'src/datacache/datacache.c')
-rw-r--r--src/datacache/datacache.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/datacache/datacache.c b/src/datacache/datacache.c
index 426841bc8..6c8d2b8cc 100644
--- a/src/datacache/datacache.c
+++ b/src/datacache/datacache.c
@@ -375,4 +375,39 @@ GNUNET_DATACACHE_get_random (struct GNUNET_DATACACHE_Handle *h,
375} 375}
376 376
377 377
378/**
379 * Iterate over the results that are "close" to a particular key in
380 * the datacache. "close" is defined as numerically larger than @a
381 * key (when interpreted as a circular address space), with small
382 * distance.
383 *
384 * @param h handle to the datacache
385 * @param key area of the keyspace to look into
386 * @param num_results number of results that should be returned to @a iter
387 * @param iter maybe NULL (to just count)
388 * @param iter_cls closure for @a iter
389 * @return the number of results found
390 */
391unsigned int
392GNUNET_DATACACHE_get_closest (struct GNUNET_DATACACHE_Handle *h,
393 const struct GNUNET_HashCode *key,
394 unsigned int num_results,
395 GNUNET_DATACACHE_Iterator iter,
396 void *iter_cls)
397{
398 GNUNET_STATISTICS_update (h->stats,
399 gettext_noop ("# proximity search requests received"),
400 1,
401 GNUNET_NO);
402 LOG (GNUNET_ERROR_TYPE_DEBUG,
403 "Processing proximity search at `%s'\n",
404 GNUNET_h2s (key));
405 return h->api->get_closest (h->api->cls,
406 key,
407 num_results,
408 iter,
409 iter_cls);
410}
411
412
378/* end of datacache.c */ 413/* end of datacache.c */