From 70ec14559f335b5d433fb39ebefcbefdb659194a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 4 Apr 2011 16:33:35 +0000 Subject: removing dead API calls --- src/datastore/perf_plugin_datastore.c | 11 +-- src/datastore/plugin_datastore_mysql.c | 23 ----- src/datastore/plugin_datastore_postgres.c | 26 ------ src/datastore/plugin_datastore_sqlite.c | 136 ------------------------------ src/datastore/plugin_datastore_template.c | 22 ----- 5 files changed, 2 insertions(+), 216 deletions(-) (limited to 'src/datastore') diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c index 676fa8d9d..c21d9551b 100644 --- a/src/datastore/perf_plugin_datastore.c +++ b/src/datastore/perf_plugin_datastore.c @@ -61,8 +61,7 @@ enum RunPhase RP_PUT, RP_LP_GET, RP_AE_GET, - RP_ZA_GET, - RP_AN_GET + RP_ZA_GET }; @@ -171,7 +170,7 @@ iterateDummy (void *cls, 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 @@ test (void *cls, &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, diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index b56e142fb..773a40ba3 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c @@ -1817,28 +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_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. */ @@ -1941,7 +1919,6 @@ libgnunet_plugin_datastore_mysql_init (void *cls) 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")); diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index cdd8e405e..1ff56da31 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c @@ -1262,31 +1262,6 @@ postgres_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 -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. */ @@ -1329,7 +1304,6 @@ libgnunet_plugin_datastore_postgres_init (void *cls) 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", diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index f14855219..501c9f292 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c @@ -1078,141 +1078,6 @@ sqlite_plugin_iter_zero_anonymity (void *cls, } -/** - * 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. */ @@ -1732,7 +1597,6 @@ libgnunet_plugin_datastore_sqlite_init (void *cls) 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")); diff --git a/src/datastore/plugin_datastore_template.c b/src/datastore/plugin_datastore_template.c index 41d92a117..40b191538 100644 --- a/src/datastore/plugin_datastore_template.c +++ b/src/datastore/plugin_datastore_template.c @@ -226,27 +226,6 @@ template_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 -template_plugin_iter_all_now (void *cls, - enum GNUNET_BLOCK_Type type, - PluginIterator iter, - void *iter_cls) -{ - GNUNET_break (0); -} - - /** * Drop database. */ @@ -282,7 +261,6 @@ libgnunet_plugin_datastore_template_init (void *cls) 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")); -- cgit v1.2.3