[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13003 - gnunet/src/dht
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13003 - gnunet/src/dht |
Date: |
Thu, 16 Sep 2010 16:11:49 +0200 |
Author: nevans
Date: 2010-09-16 16:11:49 +0200 (Thu, 16 Sep 2010)
New Revision: 13003
Modified:
gnunet/src/dht/plugin_dhtlog_dummy.c
gnunet/src/dht/plugin_dhtlog_mysql.c
gnunet/src/dht/plugin_dhtlog_mysql_dump.c
gnunet/src/dht/plugin_dhtlog_mysql_dump_load.c
Log:
feature creep
Modified: gnunet/src/dht/plugin_dhtlog_dummy.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_dummy.c 2010-09-15 15:42:32 UTC (rev
13002)
+++ gnunet/src/dht/plugin_dhtlog_dummy.c 2010-09-16 14:11:49 UTC (rev
13003)
@@ -46,6 +46,19 @@
}
/*
+ * Inserts the specified round into the dhttests.rounds table
+ *
+ * @param round_type the type of round that is being started
+ * @param round_count counter for the round (if applicable)
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+int add_round (unsigned int round_type, unsigned int round_count)
+{
+ return GNUNET_OK;
+}
+
+/*
* Inserts the specified dhtkey into the dhttests.dhtkeys table,
* stores return value of dhttests.dhtkeys.dhtkeyuid into dhtkeyuid
*
@@ -282,6 +295,7 @@
GNUNET_assert(plugin->dhtlog_api == NULL);
plugin->dhtlog_api = GNUNET_malloc(sizeof(struct GNUNET_DHTLOG_Handle));
plugin->dhtlog_api->add_generic_stat = &add_generic_stat;
+ plugin->dhtlog_api->insert_round = &add_round;
plugin->dhtlog_api->insert_stat = &insert_stat;
plugin->dhtlog_api->insert_trial = &add_trial;
plugin->dhtlog_api->insert_query = &add_query;
Modified: gnunet/src/dht/plugin_dhtlog_mysql.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_mysql.c 2010-09-15 15:42:32 UTC (rev
13002)
+++ gnunet/src/dht/plugin_dhtlog_mysql.c 2010-09-16 14:11:49 UTC (rev
13003)
@@ -103,6 +103,11 @@
"VALUES (?, ?, ?)"
static struct StatementHandle *insert_node;
+#define INSERT_ROUNDS_STMT "INSERT INTO rounds (trialuid, round_type,
round_count, starttime) "\
+ "VALUES (?, ?, ?, NOW())"
+
+static struct StatementHandle *insert_round;
+
#define INSERT_TRIALS_STMT "INSERT INTO trials"\
"(starttime, other_trial_identifier, numnodes,
topology,"\
"topology_percentage, topology_probability,"\
@@ -448,6 +453,7 @@
if (PINIT (insert_query, INSERT_QUERIES_STMT) ||
PINIT (insert_route, INSERT_ROUTES_STMT) ||
PINIT (insert_trial, INSERT_TRIALS_STMT) ||
+ PINIT (insert_round, INSERT_ROUNDS_STMT) ||
PINIT (insert_stat, INSERT_STAT_STMT) ||
PINIT (insert_generic_stat, INSERT_GENERIC_STAT_STMT) ||
PINIT (insert_node, INSERT_NODES_STMT) ||
@@ -885,7 +891,32 @@
return GNUNET_OK;
}
+/*
+ * Inserts the specified round into the dhttests.rounds table
+ *
+ * @param round_type the type of round that is being started
+ * @param round_count counter for the round (if applicable)
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+int add_round (unsigned int round_type, unsigned int round_count)
+{
+ MYSQL_STMT *stmt;
+ int ret;
+
+ stmt = mysql_stmt_init(conn);
+ ret = prepared_statement_run (insert_round,
+ NULL,
+ MYSQL_TYPE_LONGLONG, ¤t_trial,
GNUNET_YES,
+ MYSQL_TYPE_LONG, &round_type, GNUNET_YES,
+ MYSQL_TYPE_LONG, &round_count, GNUNET_YES, -1);
+ mysql_stmt_close(stmt);
+ if (ret != GNUNET_OK)
+ return GNUNET_SYSERR;
+ return ret;
+}
+
/*
* Inserts the specified stats into the dhttests.node_statistics table
*
@@ -1445,12 +1476,9 @@
if (GNUNET_OK !=
(ret = prepared_statement_run (insert_topology,
NULL,
- MYSQL_TYPE_LONGLONG,
- ¤t_trial,
- GNUNET_YES,
- MYSQL_TYPE_LONG,
- &num_connections,
- GNUNET_YES, -1)))
+ MYSQL_TYPE_LONGLONG, ¤t_trial,
GNUNET_YES,
+ MYSQL_TYPE_LONG, &num_connections,
GNUNET_YES,
+ -1)))
{
if (ret == GNUNET_SYSERR)
{
@@ -1542,6 +1570,7 @@
plugin->dhtlog_api = GNUNET_malloc(sizeof(struct GNUNET_DHTLOG_Handle));
plugin->dhtlog_api->insert_trial = &add_trial;
plugin->dhtlog_api->insert_stat = &add_stat;
+ plugin->dhtlog_api->insert_round = &add_round;
plugin->dhtlog_api->add_generic_stat = &add_generic_stat;
plugin->dhtlog_api->insert_query = &add_query;
plugin->dhtlog_api->update_trial = &update_trials;
@@ -1573,6 +1602,7 @@
prepared_statement_close(insert_query);
prepared_statement_close(insert_route);
prepared_statement_close(insert_trial);
+ prepared_statement_close(insert_round);
prepared_statement_close(insert_node);
prepared_statement_close(insert_dhtkey);
prepared_statement_close(update_trial);
Modified: gnunet/src/dht/plugin_dhtlog_mysql_dump.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_mysql_dump.c 2010-09-15 15:42:32 UTC (rev
13002)
+++ gnunet/src/dht/plugin_dhtlog_mysql_dump.c 2010-09-16 14:11:49 UTC (rev
13003)
@@ -63,6 +63,8 @@
#define INSERT_TOPOLOGY_STMT "prepare insert_topology from 'INSERT INTO
topology (trialuid, date, connections) "\
"VALUES (@temp_trial, ?, ?)'"
+#define INSERT_ROUND_STMT "prepare insert_round from 'INSERT INTO rounds
(trialuid, round_type, round_count, starttime) VALUES (@temp_trial, @rtype,
@rcount, @curr_time)'"
+
#define EXTEND_TOPOLOGY_STMT "prepare extend_topology from 'INSERT INTO
extended_topology (topology_uid, uid_first, uid_second) "\
"VALUES (@temp_topology, ?, ?)'"
@@ -158,6 +160,7 @@
#define PINIT(a) (GNUNET_OK != (prepared_statement_create(a)))
if (PINIT (INSERT_QUERIES_STMT) ||
PINIT (INSERT_ROUTES_STMT) ||
+ PINIT (INSERT_ROUND_STMT) ||
PINIT (INSERT_TRIALS_STMT) ||
PINIT (SET_MALICIOUS_STMT) ||
PINIT (INSERT_GENERIC_STAT_STMT) ||
@@ -181,8 +184,31 @@
return GNUNET_OK;
}
+/*
+ * Inserts the specified round into the dhttests.rounds table
+ *
+ * @param round_type the type of round that is being started
+ * @param round_count counter for the round (if applicable)
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+int add_round (unsigned int round_type, unsigned int round_count)
+{
+ int ret;
+ if (outfile == NULL)
+ return GNUNET_SYSERR;
+ ret = fprintf(outfile, "set @curr_time = \"%s\", @rtype = \"%u\", @rcount =
\"%u\";\n", get_sql_time(), round_type, round_count);
+ if (ret < 0)
+ return GNUNET_SYSERR;
+ ret = fprintf(outfile, "execute insert_round;\n");
+
+ if (ret >= 0)
+ return GNUNET_OK;
+ return GNUNET_SYSERR;
+}
+
/*
* Records the current topology (number of connections, time, trial)
*
@@ -813,6 +839,7 @@
GNUNET_assert(plugin->dhtlog_api == NULL);
plugin->dhtlog_api = GNUNET_malloc(sizeof(struct GNUNET_DHTLOG_Handle));
plugin->dhtlog_api->insert_trial = &add_trial;
+ plugin->dhtlog_api->insert_round = &add_round;
plugin->dhtlog_api->insert_stat = &add_stat;
plugin->dhtlog_api->insert_query = &add_query;
plugin->dhtlog_api->update_trial = &update_trials;
Modified: gnunet/src/dht/plugin_dhtlog_mysql_dump_load.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_mysql_dump_load.c 2010-09-15 15:42:32 UTC
(rev 13002)
+++ gnunet/src/dht/plugin_dhtlog_mysql_dump_load.c 2010-09-16 14:11:49 UTC
(rev 13003)
@@ -110,6 +110,28 @@
}
/*
+ * Inserts the specified round into the dhttests.rounds table
+ *
+ * @param round_type the type of round that is being started
+ * @param round_count counter for the round (if applicable)
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+int add_round (unsigned int round_type, unsigned int round_count)
+{
+ int ret;
+ if (outfile == NULL)
+ return GNUNET_SYSERR;
+
+ ret = fprintf(outfile, "insert into rounds (trialuid, round_type,
round_count, starttime) values (@temp_trial, \"%u\", \"%u\", \"%s\");\n",
round_type, round_count, get_sql_time());
+
+ if (ret >= 0)
+ return GNUNET_OK;
+ return GNUNET_SYSERR;
+
+}
+
+/*
* Records a connection between two peers in the current topology
*
* @param first one side of the connection
@@ -808,6 +830,7 @@
plugin->dhtlog_api = GNUNET_malloc(sizeof(struct GNUNET_DHTLOG_Handle));
plugin->dhtlog_api->insert_trial = &add_trial;
plugin->dhtlog_api->insert_stat = &add_stat;
+ plugin->dhtlog_api->insert_round = &add_round;
plugin->dhtlog_api->insert_query = &add_query;
plugin->dhtlog_api->update_trial = &update_trials;
plugin->dhtlog_api->insert_route = &add_route;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13003 - gnunet/src/dht,
gnunet <=