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)
+{
+ return GNUNET_OK;
+}
+
/*
* Inserts the specified dhtkey into the dhttests.dhtkeys table,
* stores return value of dhttests.dhtkeys.dhtkeyuid into dhtkeyuid
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;
"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,"\
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) ||
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
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)
{
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;
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);
#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, ?, ?)'"
#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) ||
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)
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;
return GNUNET_SYSERR;
}
+/*
+ * 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
*
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;