make compile
authorChristian Grothoff <christian@grothoff.org>
Mon, 4 Apr 2011 08:22:39 +0000 (08:22 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 4 Apr 2011 08:22:39 +0000 (08:22 +0000)
TODO
src/datastore/plugin_datastore_mysql.c
src/datastore/plugin_datastore_postgres.c
src/include/gnunet_datastore_plugin.h
src/include/gnunet_datastore_service.h

diff --git a/TODO b/TODO
index f751dab169f5c88b6bf9e17d1fab1cf7ae03460b..5faf100830c00644bcdf3e1c5a0c9e44ebccd06b 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,7 @@
 0.9.0pre3: [2'11]
+* DATASTORE:
+  - get_random seems to not just return a SINGLE value, but an entire
+    sequence of values... => migration queue overflows!
 * NAT/UPNP: [Milan / Ayush / MW]
   - [#1609] code clean up
   - testing
index fb1b1397800a22961e9c5258f923741126600e7a..b56e142fb148c49825cc2eaa0ed6f0de9b962704 100644 (file)
@@ -1709,6 +1709,25 @@ mysql_plugin_replication_get (void *cls,
 }
 
 
+
+/**
+ * Get a random item for expiration.
+ * Call 'iter' with all values ZERO or NULL if the datastore is empty.
+ *
+ * @param cls closure
+ * @param iter function to call the value (once only).
+ * @param iter_cls closure for iter
+ */
+static void
+mysql_plugin_expiration_get (void *cls,
+                            PluginIterator iter, void *iter_cls)
+{
+  /* FIXME: not implemented! */
+  iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, 
+       GNUNET_TIME_UNIT_ZERO_ABS, 0);
+}
+
+
 /**
  * Update the priority for a particular key in the datastore.  If
  * the expiration time in value is different than the time found in
@@ -1798,50 +1817,6 @@ mysql_plugin_iter_zero_anonymity (void *cls,
 }
 
 
-/**
- * Select a subset of the items in the datastore and call
- * the given iterator for each of them.
- *
- * @param cls our "struct Plugin*"
- * @param type entries of which type should be considered?
- *        Use 0 for any type.
- * @param iter function to call on each matching value;
- *        will be called once with a NULL value at the end
- * @param iter_cls closure for iter
- */
-static void
-mysql_plugin_iter_ascending_expiration (void *cls,
-                                       enum GNUNET_BLOCK_Type type,
-                                       PluginIterator iter,
-                                       void *iter_cls)
-{
-  struct Plugin *plugin = cls;
-  iterateHelper (plugin, type, GNUNET_YES, 2, iter, iter_cls);
-}
-
-
-/**
- * Select a subset of the items in the datastore and call
- * the given iterator for each of them.
- *
- * @param cls our "struct Plugin*"
- * @param type entries of which type should be considered?
- *        Use 0 for any type.
- * @param iter function to call on each matching value;
- *        will be called once with a NULL value at the end
- * @param iter_cls closure for iter
- */
-static void
-mysql_plugin_iter_migration_order (void *cls,
-                                     enum GNUNET_BLOCK_Type type,
-                                     PluginIterator iter,
-                                     void *iter_cls)
-{
-  struct Plugin *plugin = cls;
-  iterateHelper (plugin, 0, GNUNET_NO, 3, iter, iter_cls);
-}
-
-
 /**
  * Select a subset of the items in the datastore and call
  * the given iterator for each of them.
@@ -1963,11 +1938,9 @@ libgnunet_plugin_datastore_mysql_init (void *cls)
   api->next_request = &mysql_plugin_next_request;
   api->get = &mysql_plugin_get;
   api->replication_get = &mysql_plugin_replication_get;
+  api->expiration_get = &mysql_plugin_expiration_get;
   api->update = &mysql_plugin_update;
-  api->iter_low_priority = &mysql_plugin_iter_low_priority;
   api->iter_zero_anonymity = &mysql_plugin_iter_zero_anonymity;
-  api->iter_ascending_expiration = &mysql_plugin_iter_ascending_expiration;
-  api->iter_migration_order = &mysql_plugin_iter_migration_order;
   api->iter_all_now = &mysql_plugin_iter_all_now;
   api->drop = &mysql_plugin_drop;
   GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
index c004cd59f7df8411f1dac1fed7875155d522a87a..cdd8e405e700bdded7d15c9192a3c32cbdfea1b8 100644 (file)
@@ -1220,51 +1220,20 @@ postgres_plugin_replication_get (void *cls,
 
 
 /**
- * Select a subset of the items in the datastore and call
- * the given iterator for each of them.
- *
- * @param cls our "struct Plugin*"
- * @param type entries of which type should be considered?
- *        Use 0 for any type.
- * @param iter function to call on each matching value;
- *        will be called once with a NULL value at the end
- * @param iter_cls closure for iter
- */
-static void
-postgres_plugin_iter_zero_anonymity (void *cls,
-                                    enum GNUNET_BLOCK_Type type,
-                                    PluginIterator iter,
-                                    void *iter_cls)
-{
-  struct Plugin *plugin = cls;
-
-  postgres_iterate (plugin, 
-                   type, GNUNET_NO, 1,
-                   iter, iter_cls);
-}
-
-
-/**
- * Select a subset of the items in the datastore and call
- * the given iterator for each of them.
+ * Get a random item for expiration.
+ * Call 'iter' with all values ZERO or NULL if the datastore is empty.
  *
- * @param cls our "struct Plugin*"
- * @param type entries of which type should be considered?
- *        Use 0 for any type.
- * @param iter function to call on each matching value;
- *        will be called once with a NULL value at the end
+ * @param cls closure
+ * @param iter function to call the value (once only).
  * @param iter_cls closure for iter
  */
 static void
-postgres_plugin_iter_ascending_expiration (void *cls,
-                                          enum GNUNET_BLOCK_Type type,
-                                          PluginIterator iter,
-                                          void *iter_cls)
+postgres_plugin_expiration_get (void *cls,
+                               PluginIterator iter, void *iter_cls)
 {
-  struct Plugin *plugin = cls;
-
-  postgres_iterate (plugin, type, GNUNET_YES, 2,
-                   iter, iter_cls);
+  /* FIXME: not implemented! */
+  iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, 
+       GNUNET_TIME_UNIT_ZERO_ABS, 0);
 }
 
 
@@ -1280,14 +1249,15 @@ postgres_plugin_iter_ascending_expiration (void *cls,
  * @param iter_cls closure for iter
  */
 static void
-postgres_plugin_iter_migration_order (void *cls,
-                                     enum GNUNET_BLOCK_Type type,
-                                     PluginIterator iter,
-                                     void *iter_cls)
+postgres_plugin_iter_zero_anonymity (void *cls,
+                                    enum GNUNET_BLOCK_Type type,
+                                    PluginIterator iter,
+                                    void *iter_cls)
 {
   struct Plugin *plugin = cls;
 
-  postgres_iterate (plugin, 0, GNUNET_NO, 3, 
+  postgres_iterate (plugin, 
+                   type, GNUNET_NO, 1,
                    iter, iter_cls);
 }
 
@@ -1356,11 +1326,9 @@ libgnunet_plugin_datastore_postgres_init (void *cls)
   api->next_request = &postgres_plugin_next_request;
   api->get = &postgres_plugin_get;
   api->replication_get = &postgres_plugin_replication_get;
+  api->expiration_get = &postgres_plugin_expiration_get;
   api->update = &postgres_plugin_update;
-  api->iter_low_priority = &postgres_plugin_iter_low_priority;
   api->iter_zero_anonymity = &postgres_plugin_iter_zero_anonymity;
-  api->iter_ascending_expiration = &postgres_plugin_iter_ascending_expiration;
-  api->iter_migration_order = &postgres_plugin_iter_migration_order;
   api->iter_all_now = &postgres_plugin_iter_all_now;
   api->drop = &postgres_plugin_drop;
   GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
index 34a6591636481088873ac8e9f6f79c8caf6ba748..a3f8b5f3be5638125bab6e028259ee6aa05eca13 100644 (file)
@@ -149,8 +149,7 @@ typedef unsigned long long (*PluginGetSize) (void *cls);
  * @param replication replication-level for the content
  * @param expiration expiration time for the content
  * @param msg set to an error message (on failure)
- * @return GNUNET_OK on success, GNUNET_NO if the content
- *         was already present (and may have been updated);
+ * @return GNUNET_OK on success,
  *         GNUNET_SYSERR on failure
  */
 typedef int (*PluginPut) (void *cls,
index 284d544f58cd410fbc434c0c06a502a31a8b3fb8..756d2f3be48f55e50164ba9f05cba11a0f75345b 100644 (file)
@@ -80,8 +80,8 @@ void GNUNET_DATASTORE_disconnect (struct GNUNET_DATASTORE_Handle *h,
  * operation.
  *
  * @param cls closure
- * @param success GNUNET_SYSERR on failure
- *                GNUNET_NO on timeout/queue drop
+ * @param success GNUNET_SYSERR on failure (including timeout/queue drop)
+ *                GNUNET_NO if content was already there
  *                GNUNET_YES (or other positive value) on success
  * @param msg NULL on success, otherwise an error message
  */