00001 /* Copyright (C) 2003 MySQL AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; either version 2 of the License, or 00006 (at your option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00016 00017 #ifndef ConfigRetriever_H 00018 #define ConfigRetriever_H 00019 00020 #include <ndb_types.h> 00021 #include <mgmapi.h> 00022 #include <BaseString.hpp> 00023 00028 class ConfigRetriever { 00029 public: 00030 ConfigRetriever(const char * _connect_string, 00031 Uint32 version, Uint32 nodeType); 00032 ~ConfigRetriever(); 00033 00034 int do_connect(int no_retries, int retry_delay_in_seconds, int verbose); 00035 int disconnect(); 00036 00048 struct ndb_mgm_configuration * getConfig(); 00049 00050 void resetError(); 00051 int hasError(); 00052 const char * getErrorString(); 00053 00057 Uint32 allocNodeId(int no_retries, int retry_delay_in_seconds); 00058 00059 int setNodeId(Uint32 nodeid); 00060 00064 struct ndb_mgm_configuration * getConfig(NdbMgmHandle handle); 00065 00069 struct ndb_mgm_configuration * getConfig(const char * file); 00070 00074 bool verifyConfig(const struct ndb_mgm_configuration *, Uint32 nodeid); 00075 00076 Uint32 get_mgmd_port() const; 00077 const char *get_mgmd_host() const; 00078 const char *get_connectstring(char *buf, int buf_sz) const; 00079 NdbMgmHandle get_mgmHandle() { return m_handle; }; 00080 NdbMgmHandle* get_mgmHandlePtr() { return &m_handle; }; 00081 void end_session(bool end) { m_end_session= end; }; 00082 00083 Uint32 get_configuration_nodeid() const; 00084 private: 00085 BaseString errorString; 00086 enum ErrorType { 00087 CR_NO_ERROR = 0, 00088 CR_ERROR = 1, 00089 CR_RETRY = 2 00090 }; 00091 ErrorType latestErrorType; 00092 00093 void setError(ErrorType, const char * errorMsg); 00094 00095 Uint32 _ownNodeId; 00096 bool m_end_session; 00097 00098 /* 00099 Uint32 m_mgmd_port; 00100 const char *m_mgmd_host; 00101 */ 00102 00103 Uint32 m_version; 00104 Uint32 m_node_type; 00105 NdbMgmHandle m_handle; 00106 }; 00107 00108 #endif 00109 00110
1.4.7

