gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r14836 - in gnunet: . src/datastore src/include


From: gnunet
Subject: [GNUnet-SVN] r14836 - in gnunet: . src/datastore src/include
Date: Mon, 4 Apr 2011 10:22:39 +0200

Author: grothoff
Date: 2011-04-04 10:22:39 +0200 (Mon, 04 Apr 2011)
New Revision: 14836

Modified:
   gnunet/TODO
   gnunet/src/datastore/plugin_datastore_mysql.c
   gnunet/src/datastore/plugin_datastore_postgres.c
   gnunet/src/include/gnunet_datastore_plugin.h
   gnunet/src/include/gnunet_datastore_service.h
Log:
make compile

Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2011-04-03 20:00:42 UTC (rev 14835)
+++ gnunet/TODO 2011-04-04 08:22:39 UTC (rev 14836)
@@ -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

Modified: gnunet/src/datastore/plugin_datastore_mysql.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_mysql.c       2011-04-03 20:00:42 UTC 
(rev 14835)
+++ gnunet/src/datastore/plugin_datastore_mysql.c       2011-04-04 08:22:39 UTC 
(rev 14836)
@@ -1709,7 +1709,26 @@
 }
 
 
+
 /**
+ * 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
  * the datastore, the higher value should be kept.  For the
@@ -1810,50 +1829,6 @@
  * @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.
- *
- * @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_all_now (void *cls,
                           enum GNUNET_BLOCK_Type type,
                           PluginIterator iter,
@@ -1963,11 +1938,9 @@
   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,

Modified: gnunet/src/datastore/plugin_datastore_postgres.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_postgres.c    2011-04-03 20:00:42 UTC 
(rev 14835)
+++ gnunet/src/datastore/plugin_datastore_postgres.c    2011-04-04 08:22:39 UTC 
(rev 14836)
@@ -1220,27 +1220,20 @@
 
 
 /**
- * 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_zero_anonymity (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_NO, 1,
-                   iter, iter_cls);
+  /* FIXME: not implemented! */
+  iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, 
+       GNUNET_TIME_UNIT_ZERO_ABS, 0);
 }
 
 
@@ -1256,14 +1249,15 @@
  * @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_iter_zero_anonymity (void *cls,
+                                    enum GNUNET_BLOCK_Type type,
+                                    PluginIterator iter,
+                                    void *iter_cls)
 {
   struct Plugin *plugin = cls;
 
-  postgres_iterate (plugin, type, GNUNET_YES, 2,
+  postgres_iterate (plugin, 
+                   type, GNUNET_NO, 1,
                    iter, iter_cls);
 }
 
@@ -1280,30 +1274,6 @@
  * @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)
-{
-  struct Plugin *plugin = cls;
-
-  postgres_iterate (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.
- *
- * @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_all_now (void *cls,
                              enum GNUNET_BLOCK_Type type,
                              PluginIterator iter,
@@ -1356,11 +1326,9 @@
   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,

Modified: gnunet/src/include/gnunet_datastore_plugin.h
===================================================================
--- gnunet/src/include/gnunet_datastore_plugin.h        2011-04-03 20:00:42 UTC 
(rev 14835)
+++ gnunet/src/include/gnunet_datastore_plugin.h        2011-04-04 08:22:39 UTC 
(rev 14836)
@@ -149,8 +149,7 @@
  * @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,

Modified: gnunet/src/include/gnunet_datastore_service.h
===================================================================
--- gnunet/src/include/gnunet_datastore_service.h       2011-04-03 20:00:42 UTC 
(rev 14835)
+++ gnunet/src/include/gnunet_datastore_service.h       2011-04-04 08:22:39 UTC 
(rev 14836)
@@ -80,8 +80,8 @@
  * 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
  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]