1 /* 2 Copyright (c) 2010, 2011, 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, version 2.0, 6 as published by the Free Software Foundation. 7 8 This program is also distributed with certain software (including 9 but not limited to OpenSSL) that is licensed under separate terms, 10 as designated in a particular file or component or in included license 11 documentation. The authors of MySQL hereby grant you an additional 12 permission to link the program and your derivative works with the 13 separately licensed software that they have included with MySQL. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License, version 2.0, for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with this program; if not, write to the Free Software 22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 23 */ 24 25 #ifndef trp_node_hpp 26 #define trp_node_hpp 27 28 #include <ndb_global.h> 29 #include <kernel/NodeInfo.hpp> 30 #include <kernel/NodeState.hpp> 31 32 class NdbOut; 33 NdbOut& operator<<(NdbOut&, const struct trp_node&); 34 35 struct trp_node 36 { 37 trp_node(); 38 39 NodeInfo m_info; 40 NodeState m_state; 41 42 Uint32 minDbVersion; 43 bool defined; 44 bool compatible; // Version is compatible 45 bool nfCompleteRep; // NF Complete Rep has arrived 46 bool m_alive; // Node is alive 47 bool m_node_fail_rep;// NodeFailRep has arrived 48 private: 49 bool m_connected; // Transporter connected 50 bool m_api_reg_conf;// API_REGCONF has arrived 51 public: 52 set_connectedtrp_node53 void set_connected(bool connected) { 54 assert(defined); 55 m_connected = connected; 56 } is_connectedtrp_node57 bool is_connected(void) const { 58 const bool connected = m_connected; 59 // Must be defined if connected 60 assert(!connected || 61 (connected && defined)); 62 return connected; 63 } 64 set_confirmedtrp_node65 void set_confirmed(bool confirmed) { 66 if (confirmed) 67 assert(is_connected()); 68 m_api_reg_conf = confirmed; 69 } 70 is_confirmedtrp_node71 bool is_confirmed(void) const { 72 const bool confirmed = m_api_reg_conf; 73 assert(!confirmed || 74 (confirmed && is_connected())); 75 return confirmed; 76 } 77 78 bool operator==(const trp_node& other) const; 79 80 private: 81 82 friend NdbOut& operator<<(NdbOut&, const trp_node&); 83 }; 84 85 #endif 86