gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r14850 - in gnunet/src: datastore include
Date: Mon, 4 Apr 2011 18:33:35 +0200

Author: grothoff
Date: 2011-04-04 18:33:35 +0200 (Mon, 04 Apr 2011)
New Revision: 14850

Modified:
   gnunet/src/datastore/perf_plugin_datastore.c
   gnunet/src/datastore/plugin_datastore_mysql.c
   gnunet/src/datastore/plugin_datastore_postgres.c
   gnunet/src/datastore/plugin_datastore_sqlite.c
   gnunet/src/datastore/plugin_datastore_template.c
   gnunet/src/include/gnunet_datastore_plugin.h
Log:
removing dead API calls

Modified: gnunet/src/datastore/perf_plugin_datastore.c
===================================================================
--- gnunet/src/datastore/perf_plugin_datastore.c        2011-04-04 16:29:35 UTC 
(rev 14849)
+++ gnunet/src/datastore/perf_plugin_datastore.c        2011-04-04 16:33:35 UTC 
(rev 14850)
@@ -61,8 +61,7 @@
     RP_PUT,
     RP_LP_GET,
     RP_AE_GET,
-    RP_ZA_GET,
-    RP_AN_GET
+    RP_ZA_GET
   };
 
 
@@ -171,7 +170,7 @@
              crc->i,
              (unsigned long long) (crc->end.abs_value - crc->start.abs_value),
              crc->cnt);
-      if (crc->phase != RP_AN_GET)
+      if (crc->phase != RP_ZA_GET)
        {
          crc->phase++;
        }
@@ -324,12 +323,6 @@
                                     &iterateDummy,
                                     crc);
       break;
-    case RP_AN_GET:
-      crc->msg = "%3u all now iteration took %20llums for %u\n";
-      crc->api->iter_all_now (crc->api->cls, 0,
-                             &iterateDummy,
-                             crc);
-      break;
     case RP_DONE:
       crc->api->drop (crc->api->cls);
       GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,

Modified: gnunet/src/datastore/plugin_datastore_mysql.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_mysql.c       2011-04-04 16:29:35 UTC 
(rev 14849)
+++ gnunet/src/datastore/plugin_datastore_mysql.c       2011-04-04 16:33:35 UTC 
(rev 14850)
@@ -1818,28 +1818,6 @@
 
 
 /**
- * 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,
-                          void *iter_cls)
-{
-  struct Plugin *plugin = cls;
-  iterateHelper (plugin, 0, GNUNET_YES, 0, iter, iter_cls);
-}
-
-
-/**
  * Drop database.
  */
 static void 
@@ -1941,7 +1919,6 @@
   api->expiration_get = &mysql_plugin_expiration_get;
   api->update = &mysql_plugin_update;
   api->iter_zero_anonymity = &mysql_plugin_iter_zero_anonymity;
-  api->iter_all_now = &mysql_plugin_iter_all_now;
   api->drop = &mysql_plugin_drop;
   GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
                    "mysql", _("Mysql database running\n"));

Modified: gnunet/src/datastore/plugin_datastore_postgres.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_postgres.c    2011-04-04 16:29:35 UTC 
(rev 14849)
+++ gnunet/src/datastore/plugin_datastore_postgres.c    2011-04-04 16:33:35 UTC 
(rev 14850)
@@ -1263,31 +1263,6 @@
 
 
 /**
- * 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,
-                             void *iter_cls)
-{
-  struct Plugin *plugin = cls;
-
-  postgres_iterate (plugin, 
-                   0, GNUNET_YES, 0, 
-                   iter, iter_cls);
-}
-
-
-/**
  * Drop database.
  */
 static void 
@@ -1329,7 +1304,6 @@
   api->expiration_get = &postgres_plugin_expiration_get;
   api->update = &postgres_plugin_update;
   api->iter_zero_anonymity = &postgres_plugin_iter_zero_anonymity;
-  api->iter_all_now = &postgres_plugin_iter_all_now;
   api->drop = &postgres_plugin_drop;
   GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
                    "datastore-postgres",

Modified: gnunet/src/datastore/plugin_datastore_sqlite.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_sqlite.c      2011-04-04 16:29:35 UTC 
(rev 14849)
+++ gnunet/src/datastore/plugin_datastore_sqlite.c      2011-04-04 16:33:35 UTC 
(rev 14850)
@@ -1079,141 +1079,6 @@
 
 
 /**
- * Closure for 'all_next_prepare'.
- */
-struct IterateAllContext
-{
-
-  /**
-   * Offset for the current result.
-   */
-  unsigned int off;
-
-  /**
-   * Requested block type.
-   */
-  enum GNUNET_BLOCK_Type type;
-
-  /**
-   * Our prepared statement.
-   */
-  sqlite3_stmt *stmt;
-};
-
-
-/**
- * Call sqlite using the already prepared query to get
- * the next result.
- *
- * @param cls context with the prepared query (of type 'struct 
IterateAllContext')
- * @param nc generic context with the prepared query
- * @return GNUNET_OK on success, GNUNET_SYSERR on error, GNUNET_NO if
- *        there are no more results 
- */
-static int
-all_next_prepare (void *cls,
-                 struct NextContext *nc)
-{
-  struct IterateAllContext *iac = cls;
-  struct Plugin *plugin;
-  int ret;  
-  unsigned int sqoff;
-
-  if (nc == NULL)
-    {
-#if DEBUG_SQLITE
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                 "Asked to clean up iterator state.\n");
-#endif
-      if (NULL != iac->stmt)
-       {
-         sqlite3_finalize (iac->stmt);
-         iac->stmt = NULL;
-       }
-      return GNUNET_SYSERR;
-    }
-  plugin = nc->plugin;
-  sqoff = 1;
-  ret = SQLITE_OK;
-  if (iac->type != 0)
-    ret = sqlite3_bind_int (nc->stmt, sqoff++, iac->type);
-  if (SQLITE_OK == ret)
-    ret = sqlite3_bind_int64 (nc->stmt, sqoff++, iac->off++);
-  if (ret != SQLITE_OK)
-    {
-      LOG_SQLITE (plugin, NULL,
-                  GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 
"sqlite3_bind_XXXX");
-      return GNUNET_SYSERR;
-    }
-  ret = sqlite3_step (nc->stmt);
-  switch (ret)
-    {
-    case SQLITE_ROW:
-      return GNUNET_OK;  
-    case SQLITE_DONE:
-      return GNUNET_NO;
-    default:
-      LOG_SQLITE (plugin, NULL,
-                 GNUNET_ERROR_TYPE_ERROR |
-                 GNUNET_ERROR_TYPE_BULK,
-                 "sqlite3_step");
-      return GNUNET_SYSERR;
-    }
-}
-
-
-/**
- * Select a subset of the items in the datastore and call
- * the given iterator for each of them.
- *
- * @param cls our plugin context
- * @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
-sqlite_plugin_iter_all_now (void *cls,
-                           enum GNUNET_BLOCK_Type type,
-                           PluginIterator iter,
-                           void *iter_cls)
-{
-  struct Plugin *plugin = cls;
-  struct NextContext *nc;
-  struct IterateAllContext *iac;
-  sqlite3_stmt *stmt;
-  const char *q;
-
-  if (type == 0)
-    q = "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ FROM gn090 ORDER 
BY _ROWID_ ASC LIMIT 1 OFFSET ?";
-  else
-    q = "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ FROM gn090 WHERE 
type=? ORDER BY _ROWID_ ASC LIMIT 1 OFFSET ?";
-  if (sq_prepare (plugin->dbh, q, &stmt) != SQLITE_OK)
-    {
-      LOG_SQLITE (plugin, NULL,
-                  GNUNET_ERROR_TYPE_ERROR |
-                  GNUNET_ERROR_TYPE_BULK, "sqlite3_prepare_v2");
-      iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 
0);
-      return;
-    }
-  nc = GNUNET_malloc (sizeof(struct NextContext) + 
-                     sizeof(struct IterateAllContext));
-  iac = (struct IterateAllContext*) &nc[1];
-  nc->plugin = plugin;
-  nc->iter = iter;
-  nc->iter_cls = iter_cls;
-  nc->stmt = stmt;
-  nc->prep = &all_next_prepare;
-  nc->prep_cls = iac;
-  iac->off = 0;
-  iac->type = type;
-  iac->stmt = stmt; /* alias used for freeing at the end */
-  sqlite_next_request (nc, GNUNET_NO);
-}
-
-
-/**
  * Context for get_next_prepare.
  */
 struct GetNextContext
@@ -1732,7 +1597,6 @@
   api->expiration_get = &sqlite_plugin_expiration_get;
   api->update = &sqlite_plugin_update;
   api->iter_zero_anonymity = &sqlite_plugin_iter_zero_anonymity;
-  api->iter_all_now = &sqlite_plugin_iter_all_now;
   api->drop = &sqlite_plugin_drop;
   GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
                    "sqlite", _("Sqlite database running\n"));

Modified: gnunet/src/datastore/plugin_datastore_template.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_template.c    2011-04-04 16:29:35 UTC 
(rev 14849)
+++ gnunet/src/datastore/plugin_datastore_template.c    2011-04-04 16:33:35 UTC 
(rev 14850)
@@ -227,27 +227,6 @@
 
 
 /**
- * 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
-template_plugin_iter_all_now (void *cls,
-                             enum GNUNET_BLOCK_Type type,
-                             PluginIterator iter,
-                             void *iter_cls)
-{
-  GNUNET_break (0);
-}
-
-
-/**
  * Drop database.
  */
 static void 
@@ -282,7 +261,6 @@
   api->expiration_get = &template_plugin_expiration_get;
   api->update = &template_plugin_update;
   api->iter_zero_anonymity = &template_plugin_iter_zero_anonymity;
-  api->iter_all_now = &template_plugin_iter_all_now;
   api->drop = &template_plugin_drop;
   GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
                    "template", _("Template database running\n"));

Modified: gnunet/src/include/gnunet_datastore_plugin.h
===================================================================
--- gnunet/src/include/gnunet_datastore_plugin.h        2011-04-04 16:29:35 UTC 
(rev 14849)
+++ gnunet/src/include/gnunet_datastore_plugin.h        2011-04-04 16:33:35 UTC 
(rev 14850)
@@ -338,14 +338,6 @@
   PluginSelector iter_zero_anonymity;
 
   /**
-   * Iterate over all the items in the datastore
-   * as fast as possible in a single transaction
-   * (can lock datastore while this happens, focus
-   * is on doing it fast).
-   */
-  PluginSelector iter_all_now;
-
-  /**
    * Delete the database.  The next operation is
    * guaranteed to be unloading of the module.
    */




reply via email to

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