Merge branch 'credentials' of git+ssh://gnunet.org/gnunet into credentials
[oweals/gnunet.git] / src / datacache / plugin_datacache_template.c
index 16d0189954bea3679f17ab3df560ab7fe9b32ce9..b9baa64d34844852be71536c92da94eed86fed22 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     Copyright (C) 2006, 2009, 2015 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2006, 2009, 2015 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -124,6 +124,32 @@ template_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
+template_plugin_get_closest (void *cls,
+                             const struct GNUNET_HashCode *key,
+                             unsigned int num_results,
+                             GNUNET_DATACACHE_Iterator iter,
+                             void *iter_cls)
+{
+  GNUNET_break (0);
+  return 0;
+}
+
+
 /**
  * Entry point for the plugin.
  *
@@ -145,6 +171,7 @@ libgnunet_plugin_datacache_template_init (void *cls)
   api->put = &template_plugin_put;
   api->del = &template_plugin_del;
   api->get_random = &template_plugin_get_random;
+  api->get_closest = &template_plugin_get_closest;
   GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
                    "template",
                    "Template datacache running\n");