gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r12880 - gnunet/src/dht


From: gnunet
Subject: [GNUnet-SVN] r12880 - gnunet/src/dht
Date: Tue, 7 Sep 2010 12:03:45 +0200

Author: nevans
Date: 2010-09-07 12:03:45 +0200 (Tue, 07 Sep 2010)
New Revision: 12880

Modified:
   gnunet/src/dht/dhtlog.h
   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:
dhtlog updates

Modified: gnunet/src/dht/dhtlog.h
===================================================================
--- gnunet/src/dht/dhtlog.h     2010-09-07 09:51:27 UTC (rev 12879)
+++ gnunet/src/dht/dhtlog.h     2010-09-07 10:03:45 UTC (rev 12880)
@@ -95,6 +95,8 @@
    * Inserts the specified trial into the dhttests.trials table
    *
    * @param trialuid return the trialuid of the newly inserted trial
+   * @param other_identifier identifier for the trial from another source
+   *        (for joining later)
    * @param num_nodes how many nodes are in the trial
    * @param topology integer representing topology for this trial
    * @param blacklist_topology integer representing blacklist topology for 
this trial
@@ -121,7 +123,7 @@
    *
    * @return GNUNET_OK on success, GNUNET_SYSERR on failure
    */
-  int (*insert_trial) (unsigned long long *trialuid, unsigned int num_nodes, 
unsigned int topology,
+  int (*insert_trial) (unsigned long long *trialuid, unsigned int 
other_identifier, unsigned int num_nodes, unsigned int topology,
                        unsigned int blacklist_topology, unsigned int 
connect_topology,
                        unsigned int connect_topology_option, float 
connect_topology_option_modifier,
                        float topology_percentage, float topology_probability,

Modified: gnunet/src/dht/plugin_dhtlog_dummy.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_dummy.c        2010-09-07 09:51:27 UTC (rev 
12879)
+++ gnunet/src/dht/plugin_dhtlog_dummy.c        2010-09-07 10:03:45 UTC (rev 
12880)
@@ -36,6 +36,8 @@
    * Inserts the specified trial into the dhttests.trials table
    *
    * @param trialuid return the trialuid of the newly inserted trial
+   * @param other_identifier identifier for the trial from another source
+   *        (for joining later)
    * @param num_nodes how many nodes are in the trial
    * @param topology integer representing topology for this trial
    * @param blacklist_topology integer representing blacklist topology for 
this trial
@@ -62,7 +64,7 @@
    *
    * @return GNUNET_OK on success, GNUNET_SYSERR on failure
    */
-int add_trial (unsigned long long *trialuid, unsigned int num_nodes, unsigned 
int topology,
+int add_trial (unsigned long long *trialuid, unsigned int other_identifier, 
unsigned int num_nodes, unsigned int topology,
                unsigned int blacklist_topology, unsigned int connect_topology,
                unsigned int connect_topology_option, float 
connect_topology_option_modifier,
                float topology_percentage, float topology_probability,
@@ -246,8 +248,58 @@
   return GNUNET_OK;
 }
 
+/*
+ * Update dhttests.nodes table setting the identified
+ * node as a malicious dropper.
+ *
+ * @param peer the peer that was set to be malicious
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure.
+ */
+int
+set_malicious (struct GNUNET_PeerIdentity *peer)
+{
+  return GNUNET_OK;
+}
 
 /*
+ * Inserts the specified stats into the dhttests.node_statistics table
+ *
+ * @param peer the peer inserting the statistic
+ * @param route_requests route requests seen
+ * @param route_forwards route requests forwarded
+ * @param result_requests route result requests seen
+ * @param client_requests client requests initiated
+ * @param result_forwards route results forwarded
+ * @param gets get requests handled
+ * @param puts put requests handle
+ * @param data_inserts data inserted at this node
+ * @param find_peer_requests find peer requests seen
+ * @param find_peers_started find peer requests initiated at this node
+ * @param gets_started get requests initiated at this node
+ * @param puts_started put requests initiated at this node
+ * @param find_peer_responses_received find peer responses received locally
+ * @param get_responses_received get responses received locally
+ * @param find_peer_responses_sent find peer responses sent from this node
+ * @param get_responses_sent get responses sent from this node
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on failure
+ */
+int insert_stat
+   (const struct GNUNET_PeerIdentity *peer, unsigned int route_requests,
+    unsigned int route_forwards, unsigned int result_requests,
+    unsigned int client_requests, unsigned int result_forwards,
+    unsigned int gets, unsigned int puts,
+    unsigned int data_inserts, unsigned int find_peer_requests,
+    unsigned int find_peers_started, unsigned int gets_started,
+    unsigned int puts_started, unsigned int find_peer_responses_received,
+    unsigned int get_responses_received, unsigned int find_peer_responses_sent,
+    unsigned int get_responses_sent)
+{
+  return GNUNET_OK;
+}
+
+/*
  * Provides the dhtlog api
  *
  * @param c the configuration to use to connect to a server
@@ -264,9 +316,11 @@
   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_stat = &insert_stat;
   plugin->dhtlog_api->insert_trial = &add_trial;
   plugin->dhtlog_api->insert_query = &add_query;
   plugin->dhtlog_api->update_trial = &update_trials;
+  plugin->dhtlog_api->set_malicious = &set_malicious;
   plugin->dhtlog_api->insert_route = &add_route;
   plugin->dhtlog_api->insert_node = &add_node;
   plugin->dhtlog_api->insert_dhtkey = &add_dhtkey;

Modified: gnunet/src/dht/plugin_dhtlog_mysql.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_mysql.c        2010-09-07 09:51:27 UTC (rev 
12879)
+++ gnunet/src/dht/plugin_dhtlog_mysql.c        2010-09-07 10:03:45 UTC (rev 
12880)
@@ -32,7 +32,7 @@
 #include <mysql/mysql.h>
 
 
-#define DEBUG_DHTLOG GNUNET_NO
+#define DEBUG_DHTLOG GNUNET_YES
 
 /**
  * Maximum number of supported parameters for a prepared
@@ -104,7 +104,7 @@
 static struct StatementHandle *insert_node;
 
 #define INSERT_TRIALS_STMT "INSERT INTO trials"\
-                            "(starttime, numnodes, topology,"\
+                            "(starttime, other_trial_identifier, numnodes, 
topology,"\
                             "topology_percentage, topology_probability,"\
                             "blacklist_topology, connect_topology, 
connect_topology_option,"\
                             "connect_topology_option_modifier, puts, gets, "\
@@ -112,7 +112,7 @@
                             "malicious_putters, malicious_droppers, 
malicious_get_frequency,"\
                             "malicious_put_frequency, stop_closest, 
stop_found, strict_kademlia, "\
                             "gets_succeeded, message) "\
-                            "VALUES (NOW(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
+                            "VALUES (NOW(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
 
 static struct StatementHandle *insert_trial;
 
@@ -243,30 +243,38 @@
     return GNUNET_SYSERR;
 
   if (MRUNS ("CREATE TABLE IF NOT EXISTS `trials` ("
-             "`trialuid` int(10) unsigned NOT NULL auto_increment,"
-             "`numnodes` int(10) unsigned NOT NULL,"
-             "`topology` int(10) NOT NULL,"
-             "`starttime` datetime NOT NULL,"
-             "`endtime` datetime NOT NULL,"
-             "`puts` int(10) unsigned NOT NULL,"
-             "`gets` int(10) unsigned NOT NULL,"
-             "`concurrent` int(10) unsigned NOT NULL,"
-             "`settle_time` int(10) unsigned NOT NULL,"
-             "`totalConnections` int(10) unsigned NOT NULL,"
-             "`message` text NOT NULL,"
-             "`num_rounds` int(10) unsigned NOT NULL,"
-             "`malicious_getters` int(10) unsigned NOT NULL,"
-             "`malicious_putters` int(10) unsigned NOT NULL,"
-             "`malicious_droppers` int(10) unsigned NOT NULL,"
-             "`totalMessagesDropped` int(10) unsigned NOT NULL,"
-             "`totalBytesDropped` int(10) unsigned NOT NULL,"
-             "`topology_modifier` double NOT NULL,"
-             "`logNMultiplier` double NOT NULL,"
-             "`maxnetbps` bigint(20) unsigned NOT NULL,"
-             "`unknownPeers` int(10) unsigned NOT NULL,"
-             "PRIMARY KEY  (`trialuid`),"
-             "UNIQUE KEY `trialuid` (`trialuid`)"
-             ") ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1"))
+              "`trialuid` int(10) unsigned NOT NULL auto_increment,"
+              "`other_trial_identifier` int(10) unsigned NOT NULL default '0',"
+              "`numnodes` int(10) unsigned NOT NULL,"
+              "`topology` int(10) NOT NULL,"
+              "`blacklist_topology` int(11) NOT NULL,"
+              "`connect_topology` int(11) NOT NULL,"
+              "`connect_topology_option` int(11) NOT NULL,"
+              "`topology_percentage` float NOT NULL,"
+              "`topology_probability` float NOT NULL,"
+              "`connect_topology_option_modifier` float NOT NULL,"
+              "`starttime` datetime NOT NULL,"
+              "`endtime` datetime NOT NULL,"
+              "`puts` int(10) unsigned NOT NULL,"
+              "`gets` int(10) unsigned NOT NULL,"
+              "`concurrent` int(10) unsigned NOT NULL,"
+              "`settle_time` int(10) unsigned NOT NULL,"
+              "`totalConnections` int(10) unsigned NOT NULL,"
+              "`message` text NOT NULL,"
+              "`num_rounds` int(10) unsigned NOT NULL,"
+              "`malicious_getters` int(10) unsigned NOT NULL,"
+              "`malicious_putters` int(10) unsigned NOT NULL,"
+              "`malicious_droppers` int(10) unsigned NOT NULL,"
+              "`topology_modifier` double NOT NULL,"
+              "`malicious_get_frequency` int(10) unsigned NOT NULL,"
+              "`malicious_put_frequency` int(10) unsigned NOT NULL,"
+              "`stop_closest` int(10) unsigned NOT NULL,"
+              "`stop_found` int(10) unsigned NOT NULL,"
+              "`strict_kademlia` int(10) unsigned NOT NULL,"
+              "`gets_succeeded` int(10) unsigned NOT NULL,"
+              "PRIMARY KEY  (`trialuid`),"
+              "UNIQUE KEY `trialuid` (`trialuid`)"
+              ") ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1"))
     return GNUNET_SYSERR;
 
   if (MRUNS ("CREATE TABLE IF NOT EXISTS `topology` ("
@@ -750,7 +758,9 @@
   rbind[0].buffer = dhtkeyuid;
   GNUNET_CRYPTO_hash_to_enc (key, &encKey);
   k_len = strlen ((char *) &encKey);
-
+#if DEBUG_DHTLOG
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Searching for dhtkey `%s' in trial 
%llu\n", GNUNET_h2s(key), current_trial);
+#endif
   if ((GNUNET_OK !=
        prepared_statement_run_select (get_dhtkeyuid,
                                       1,
@@ -818,6 +828,8 @@
  * Inserts the specified trial into the dhttests.trials table
  *
  * @param trialuid return the trialuid of the newly inserted trial
+ * @param other_identifier identifier for the trial from another source
+ *        (for joining later)
  * @param num_nodes how many nodes are in the trial
  * @param topology integer representing topology for this trial
  * @param blacklist_topology integer representing blacklist topology for this 
trial
@@ -844,7 +856,7 @@
  *
  * @return GNUNET_OK on success, GNUNET_SYSERR on failure
  */
-int add_trial (unsigned long long *trialuid, unsigned int num_nodes, unsigned 
int topology,
+int add_trial (unsigned long long *trialuid, unsigned int other_identifier, 
unsigned int num_nodes, unsigned int topology,
                unsigned int blacklist_topology, unsigned int connect_topology,
                unsigned int connect_topology_option, float 
connect_topology_option_modifier,
                float topology_percentage, float topology_probability,
@@ -863,6 +875,7 @@
   stmt = mysql_stmt_init(conn);
   if (GNUNET_OK !=
       (ret = prepared_statement_run (insert_trial, trialuid,
+                                     MYSQL_TYPE_LONG, &other_identifier, 
GNUNET_YES,
                                      MYSQL_TYPE_LONG, &num_nodes, GNUNET_YES,
                                      MYSQL_TYPE_LONG, &topology, GNUNET_YES,
                                      MYSQL_TYPE_FLOAT, &topology_percentage,
@@ -1062,7 +1075,11 @@
       return GNUNET_OK;
     }
   else if (ret == GNUNET_SYSERR)
-    return GNUNET_SYSERR;
+    {
+#if DEBUG_DHTLOG
+      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Failed to get dhtkeyuid!\n");
+#endif
+    }
 
   if (GNUNET_OK !=
       (ret = prepared_statement_run (insert_dhtkey,

Modified: gnunet/src/dht/plugin_dhtlog_mysql_dump.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_mysql_dump.c   2010-09-07 09:51:27 UTC (rev 
12879)
+++ gnunet/src/dht/plugin_dhtlog_mysql_dump.c   2010-09-07 10:03:45 UTC (rev 
12880)
@@ -71,7 +71,7 @@
 #define SET_MALICIOUS_STMT "prepare set_malicious from 'update nodes set 
malicious_dropper = 1  where trialuid = @temp_trial and nodeid = @temp_node'"
 
 #define INSERT_TRIALS_STMT "prepare insert_trial from 'INSERT INTO trials"\
-                           "(starttime, numnodes, topology,"\
+                           "(starttime, other_trial_identifier, numnodes, 
topology,"\
                            "topology_percentage, topology_probability,"\
                            "blacklist_topology, connect_topology, 
connect_topology_option,"\
                            "connect_topology_option_modifier, puts, gets, "\
@@ -79,7 +79,7 @@
                            "malicious_putters, malicious_droppers, 
malicious_get_frequency,"\
                            "malicious_put_frequency, stop_closest, stop_found, 
strict_kademlia, "\
                            "gets_succeeded, message) "\
-                           "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'"
+                           "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'"
 
 #define INSERT_GENERIC_STAT_STMT "prepare insert_generic_stat from 'INSERT 
INTO generic_stats" \
                                  "(trialuid, nodeuid, section, name, value)"\
@@ -257,6 +257,8 @@
  * Inserts the specified trial into the dhttests.trials table
  *
  * @param trialuid return the trialuid of the newly inserted trial
+ * @param other_identifier identifier for the trial from another source
+ *        (for joining later)
  * @param num_nodes how many nodes are in the trial
  * @param topology integer representing topology for this trial
  * @param blacklist_topology integer representing blacklist topology for this 
trial
@@ -283,7 +285,7 @@
  *
  * @return GNUNET_OK on success, GNUNET_SYSERR on failure
  */
-int add_trial (unsigned long long *trialuid, unsigned int num_nodes, unsigned 
int topology,
+int add_trial (unsigned long long *trialuid, unsigned int other_identifier, 
unsigned int num_nodes, unsigned int topology,
                unsigned int blacklist_topology, unsigned int connect_topology,
                unsigned int connect_topology_option, float 
connect_topology_option_modifier,
                float topology_percentage, float topology_probability,
@@ -300,14 +302,14 @@
   if (outfile == NULL)
     return GNUNET_SYSERR;
 
-  ret = fprintf(outfile, "set @date = \"%s\", @num = %u, @topology = %u, @bl = 
%u, "
+  ret = fprintf(outfile, "set @date = \"%s\", @oid = %u, @num = %u, @topology 
= %u, @bl = %u, "
                    "@connect = %u, @c_t_o = %u, @c_t_o_m = %f, @t_p = %f, "
                    "@t_pr = %f, @puts = %u, @gets = %u, "
                    "@concurrent = %u, @settle = %u, @rounds = %u, "
                    "@m_gets = %u, @m_puts = %u, @m_drops = %u, "
                    "@m_g_f = %u, @m_p_f = %u, @s_c = %u, @s_f = %u,"
                    "@s_k = %u, @g_s = %u, @message = \"%s\";\n",
-                   get_sql_time(), num_nodes, topology,
+                   get_sql_time(), other_identifier, num_nodes, topology,
                    blacklist_topology, connect_topology,
                    connect_topology_option, connect_topology_option_modifier,
                    topology_percentage, topology_probability,
@@ -319,7 +321,7 @@
   if (ret < 0)
     return GNUNET_SYSERR;
   ret = fprintf(outfile, "execute insert_trial using "
-                         "@date, @num, @topology, @t_p, @t_pr,"
+                         "@date, @oid, @num, @topology, @t_p, @t_pr,"
                          " @bl, @connect, @c_t_o,"
                          "@c_t_o_m, @puts, @gets,"
                          "@concurrent, @settle, @rounds,"

Modified: gnunet/src/dht/plugin_dhtlog_mysql_dump_load.c
===================================================================
--- gnunet/src/dht/plugin_dhtlog_mysql_dump_load.c      2010-09-07 09:51:27 UTC 
(rev 12879)
+++ gnunet/src/dht/plugin_dhtlog_mysql_dump_load.c      2010-09-07 10:03:45 UTC 
(rev 12880)
@@ -139,6 +139,8 @@
  * Inserts the specified trial into the dhttests.trials table
  *
  * @param trialuid return the trialuid of the newly inserted trial
+ * @param other_identifier identifier for the trial from another source
+ *        (for joining later)
  * @param num_nodes how many nodes are in the trial
  * @param topology integer representing topology for this trial
  * @param blacklist_topology integer representing blacklist topology for this 
trial
@@ -165,7 +167,7 @@
  *
  * @return GNUNET_OK on success, GNUNET_SYSERR on failure
  */
-int add_trial (unsigned long long *trialuid, unsigned int num_nodes, unsigned 
int topology,
+int add_trial (unsigned long long *trialuid, unsigned int other_identifier, 
unsigned int num_nodes, unsigned int topology,
                unsigned int blacklist_topology, unsigned int connect_topology,
                unsigned int connect_topology_option, float 
connect_topology_option_modifier,
                float topology_percentage, float topology_probability,
@@ -183,7 +185,7 @@
     return GNUNET_SYSERR;
 
   ret = fprintf(outfile, "INSERT INTO trials "
-                         "(starttime, numnodes, topology,"
+                         "(starttime, other_trial_identifier, numnodes, 
topology,"
                            "blacklist_topology, connect_topology, 
connect_topology_option,"
                            "connect_topology_option_modifier, 
topology_percentage, topology_probability,"
                            "puts, gets, "
@@ -191,8 +193,8 @@
                            "malicious_putters, malicious_droppers, 
malicious_get_frequency,"
                            "malicious_put_frequency, stop_closest, stop_found, 
strict_kademlia, "
                            "gets_succeeded, message) "
-                           "VALUES (\"%s\", %u, %u, %u, %u, %u, %f, %f, %f, 
%u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, \"%s\");\n",
-                           get_sql_time(), num_nodes, topology,
+                           "VALUES (\"%s\", %u, %u, %u, %u, %u, %u, %f, %f, 
%f, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, \"%s\");\n",
+                           get_sql_time(), other_identifier, num_nodes, 
topology,
                            blacklist_topology, connect_topology,
                            connect_topology_option, 
connect_topology_option_modifier,
                            topology_percentage, topology_probability,




reply via email to

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