List:Commits« Previous MessageNext Message »
From:Jonas Oreland Date:December 21 2010 11:43am
Subject:bzr commit into mysql-5.1-telco-7.0 branch (jonas:4071)
View as plain text  
#At file:///home/jonas/src/telco-7.0/ based on revid:jonas@stripped

 4071 Jonas Oreland	2010-12-21
      ndb - add operator== and operator<< to trp_node

    modified:
      storage/ndb/src/ndbapi/trp_node.cpp
      storage/ndb/src/ndbapi/trp_node.hpp
=== modified file 'storage/ndb/src/ndbapi/trp_node.cpp'
--- a/storage/ndb/src/ndbapi/trp_node.cpp	2010-10-13 06:15:20 +0000
+++ b/storage/ndb/src/ndbapi/trp_node.cpp	2010-12-21 11:43:32 +0000
@@ -16,12 +16,46 @@
 */
 
 #include "trp_node.hpp"
+#include <NdbOut.hpp>
 
 trp_node::trp_node()
-  : m_state(NodeState::SL_NOTHING)
 {
   compatible = nfCompleteRep = true;
   m_connected = defined = m_alive = m_api_reg_conf = false;
-  m_state.m_connected_nodes.clear();
+  bzero(&m_state, sizeof(m_state));
+  m_state.init();
+  m_state.startLevel = NodeState::SL_NOTHING;
   minDbVersion = 0;
 }
+
+bool
+trp_node::operator==(const trp_node& other) const
+{
+  return (compatible == other.compatible &&
+          nfCompleteRep == other.nfCompleteRep &&
+          m_connected == other.m_connected &&
+          defined == other.defined &&
+          m_alive == other.m_alive &&
+          m_api_reg_conf == other.m_api_reg_conf &&
+          minDbVersion == other.minDbVersion &&
+          memcmp(&m_state, &other.m_state, sizeof(m_state)) == 0);
+}
+
+NdbOut&
+operator<<(NdbOut& out, const trp_node& n)
+{
+  out << "[ "
+      << "defined: " << n.defined
+      << ", compatible: " << n.compatible
+      << ", connected: " << n.m_connected
+      << ", api_reg_conf: " << n.m_api_reg_conf
+      << ", alive: " << n.m_alive
+      << ", nfCompleteRep: " << n.nfCompleteRep
+      << ", minDbVersion: " << n.minDbVersion
+      << ", state: " << n.m_state
+      << ", connected: "
+      << BaseString::getPrettyTextShort(n.m_state.m_connected_nodes).c_str()
+      << "]";
+
+  return out;
+}

=== modified file 'storage/ndb/src/ndbapi/trp_node.hpp'
--- a/storage/ndb/src/ndbapi/trp_node.hpp	2010-10-13 06:15:20 +0000
+++ b/storage/ndb/src/ndbapi/trp_node.hpp	2010-12-21 11:43:32 +0000
@@ -22,6 +22,9 @@
 #include <kernel/NodeInfo.hpp>
 #include <kernel/NodeState.hpp>
 
+class NdbOut;
+NdbOut& operator<<(NdbOut&, const struct trp_node&);
+
 struct trp_node
 {
   trp_node();
@@ -58,9 +61,13 @@ struct trp_node
     return confirmed;
   }
 
+  bool operator==(const trp_node& other) const;
+
 private:
   bool m_connected;     // Transporter connected
   bool m_api_reg_conf;// API_REGCONF has arrived
+
+  friend NdbOut& operator<<(NdbOut&, const trp_node&);
 };
 
 #endif


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20101221114332-356uxk9dosjtkuzk.bundle
Thread
bzr commit into mysql-5.1-telco-7.0 branch (jonas:4071) Jonas Oreland21 Dec