aboutsummaryrefslogtreecommitdiff
path: root/src/datacache/plugin_datacache_heap.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/plugin_datacache_heap.c
parenta49b0f351926cf4376a58937a94e37426e3ae167 (diff)
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.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/datacache/plugin_datacache_heap.c b/src/datacache/plugin_datacache_heap.c
index 32e762e23f..5492a8ec59 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,
/**
+ * Iterate over the results that are "close" to a particular key in
+ * the datacache. "close" is defined as numerically larger than @a
+ * key (when interpreted as a circular address space), with small
+ * distance.
+ *
+ * @param cls closure (internal context for the plugin)
+ * @param key area of the keyspace to look into
+ * @param num_results number of results that should be returned to @a iter
+ * @param iter maybe NULL (to just count)
+ * @param iter_cls closure for @a iter
+ * @return the number of results found
+ */
+static unsigned int
+heap_plugin_get_closest (void *cls,
+ const struct GNUNET_HashCode *key,
+ unsigned int num_results,
+ GNUNET_DATACACHE_Iterator iter,
+ void *iter_cls)
+{
+ GNUNET_break (0); // not implemented!
+ return 0;
+}
+
+
+/**
* Entry point for the plugin.
*
* @param cls closure (the `struct GNUNET_DATACACHE_PluginEnvironmnet`)
@@ -436,6 +461,7 @@ libgnunet_plugin_datacache_heap_init (void *cls)
api->put = &heap_plugin_put;
api->del = &heap_plugin_del;
api->get_random = &heap_plugin_get_random;
+ api->get_closest = &heap_plugin_get_closest;
LOG (GNUNET_ERROR_TYPE_INFO,
_("Heap datacache running\n"));
return api;