MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
trp_node.cpp
1 /*
2  Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #include "trp_node.hpp"
19 #include <NdbOut.hpp>
20 
21 trp_node::trp_node()
22 {
23  compatible = nfCompleteRep = true;
24  m_connected = defined = m_alive = m_api_reg_conf = m_node_fail_rep = false;
25  bzero(&m_state, sizeof(m_state));
26  m_state.init();
28  minDbVersion = 0;
29 }
30 
31 bool
32 trp_node::operator==(const trp_node& other) const
33 {
34  return (compatible == other.compatible &&
35  nfCompleteRep == other.nfCompleteRep &&
36  m_connected == other.m_connected &&
37  defined == other.defined &&
38  m_alive == other.m_alive &&
39  m_api_reg_conf == other.m_api_reg_conf &&
40  m_node_fail_rep == other.m_node_fail_rep &&
41  minDbVersion == other.minDbVersion &&
42  memcmp(&m_state, &other.m_state, sizeof(m_state)) == 0);
43 }
44 
45 NdbOut&
46 operator<<(NdbOut& out, const trp_node& n)
47 {
48  out << "[ "
49  << "defined: " << n.defined
50  << ", compatible: " << n.compatible
51  << ", connected: " << n.m_connected
52  << ", api_reg_conf: " << n.m_api_reg_conf
53  << ", alive: " << n.m_alive
54  << ", nodefailrep: " << n.m_node_fail_rep
55  << ", nfCompleteRep: " << n.nfCompleteRep
56  << ", minDbVersion: " << n.minDbVersion
57  << ", state: " << n.m_state
58  << ", connected: "
59  << BaseString::getPrettyTextShort(n.m_state.m_connected_nodes).c_str()
60  << "]";
61 
62  return out;
63 }