diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-04-30 07:56:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-04-30 07:56:00 +0000 |
commit | 786745c969589eae2aa069885b40eba0f3989507 (patch) | |
tree | 6f5c8573b021ba628b4f135f3fb964728b3e1724 /src/datacache/plugin_datacache_heap.c | |
parent | a49b0f351926cf4376a58937a94e37426e3ae167 (diff) | |
download | gnunet-786745c969589eae2aa069885b40eba0f3989507.tar.gz gnunet-786745c969589eae2aa069885b40eba0f3989507.zip |
implementing 'get_closest' API for sqlite and postgres datacache plugins
Diffstat (limited to 'src/datacache/plugin_datacache_heap.c')
-rw-r--r-- | src/datacache/plugin_datacache_heap.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/datacache/plugin_datacache_heap.c b/src/datacache/plugin_datacache_heap.c index 32e762e23..5492a8ec5 100644 --- a/src/datacache/plugin_datacache_heap.c +++ b/src/datacache/plugin_datacache_heap.c | |||
@@ -413,6 +413,31 @@ heap_plugin_get_random (void *cls, | |||
413 | 413 | ||
414 | 414 | ||
415 | /** | 415 | /** |
416 | * Iterate over the results that are "close" to a particular key in | ||
417 | * the datacache. "close" is defined as numerically larger than @a | ||
418 | * key (when interpreted as a circular address space), with small | ||
419 | * distance. | ||
420 | * | ||
421 | * @param cls closure (internal context for the plugin) | ||
422 | * @param key area of the keyspace to look into | ||
423 | * @param num_results number of results that should be returned to @a iter | ||
424 | * @param iter maybe NULL (to just count) | ||
425 | * @param iter_cls closure for @a iter | ||
426 | * @return the number of results found | ||
427 | */ | ||
428 | static unsigned int | ||
429 | heap_plugin_get_closest (void *cls, | ||
430 | const struct GNUNET_HashCode *key, | ||
431 | unsigned int num_results, | ||
432 | GNUNET_DATACACHE_Iterator iter, | ||
433 | void *iter_cls) | ||
434 | { | ||
435 | GNUNET_break (0); // not implemented! | ||
436 | return 0; | ||
437 | } | ||
438 | |||
439 | |||
440 | /** | ||
416 | * Entry point for the plugin. | 441 | * Entry point for the plugin. |
417 | * | 442 | * |
418 | * @param cls closure (the `struct GNUNET_DATACACHE_PluginEnvironmnet`) | 443 | * @param cls closure (the `struct GNUNET_DATACACHE_PluginEnvironmnet`) |
@@ -436,6 +461,7 @@ libgnunet_plugin_datacache_heap_init (void *cls) | |||
436 | api->put = &heap_plugin_put; | 461 | api->put = &heap_plugin_put; |
437 | api->del = &heap_plugin_del; | 462 | api->del = &heap_plugin_del; |
438 | api->get_random = &heap_plugin_get_random; | 463 | api->get_random = &heap_plugin_get_random; |
464 | api->get_closest = &heap_plugin_get_closest; | ||
439 | LOG (GNUNET_ERROR_TYPE_INFO, | 465 | LOG (GNUNET_ERROR_TYPE_INFO, |
440 | _("Heap datacache running\n")); | 466 | _("Heap datacache running\n")); |
441 | return api; | 467 | return api; |