mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / ndb / include / kernel / NodeInfo.hpp
blobf3f9b2c71fe1374782af116c850d4a458f61334d
1 /* Copyright (c) 2003-2005, 2007 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 #ifndef NODE_INFO_HPP
17 #define NODE_INFO_HPP
19 #include <NdbOut.hpp>
20 #include <mgmapi_config_parameters.h>
22 class NodeInfo {
23 public:
24 NodeInfo();
26 /**
27 * NodeType
29 enum NodeType {
30 DB = NODE_TYPE_DB, ///< Database node
31 API = NODE_TYPE_API, ///< NDB API node
32 MGM = NODE_TYPE_MGM, ///< Management node (incl. NDB API)
33 INVALID = 255 ///< Invalid type
35 NodeType getType() const;
37 Uint32 m_version; ///< Node version
38 Uint32 m_signalVersion; ///< Signal version
39 Uint32 m_type; ///< Node type
40 Uint32 m_connectCount; ///< No of times connected
41 bool m_connected; ///< Node is connected
42 Uint32 m_heartbeat_cnt; ///< Missed heartbeats
44 friend NdbOut & operator<<(NdbOut&, const NodeInfo&);
48 inline
49 NodeInfo::NodeInfo(){
50 m_version = 0;
51 m_signalVersion = 0;
52 m_type = INVALID;
53 m_connectCount = 0;
54 m_heartbeat_cnt= 0;
57 inline
58 NodeInfo::NodeType
59 NodeInfo::getType() const {
60 return (NodeType)m_type;
63 inline
64 NdbOut &
65 operator<<(NdbOut& ndbout, const NodeInfo & info){
66 ndbout << "[NodeInfo: ";
67 switch(info.m_type){
68 case NodeInfo::DB:
69 ndbout << "DB";
70 break;
71 case NodeInfo::API:
72 ndbout << "API";
73 break;
74 case NodeInfo::MGM:
75 ndbout << "MGM";
76 break;
77 case NodeInfo::INVALID:
78 ndbout << "INVALID";
79 break;
80 default:
81 ndbout << "<Unknown: " << info.m_type << ">";
82 break;
85 ndbout << " version: " << info.m_version
86 << " sig. version; " << info.m_signalVersion
87 << " connect count: " << info.m_connectCount
88 << "]";
89 return ndbout;
92 struct NodeVersionInfo
94 STATIC_CONST( DataLength = 6 );
95 struct
97 Uint32 m_min_version;
98 Uint32 m_max_version;
99 } m_type [3]; // Indexed as NodeInfo::Type
102 #endif