ConfigRetriever.hpp

Go to the documentation of this file.
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   
00047   struct ndb_mgm_configuration * getConfig();
00048   
00049   void resetError();
00050   int hasError();
00051   const char * getErrorString();
00052 
00056   Uint32 allocNodeId(int no_retries, int retry_delay_in_seconds);
00057 
00058   int setNodeId(Uint32 nodeid);
00059 
00063   struct ndb_mgm_configuration * getConfig(NdbMgmHandle handle);
00064   
00068   struct ndb_mgm_configuration * getConfig(const char * file);
00069 
00073   bool verifyConfig(const struct ndb_mgm_configuration *, Uint32 nodeid);
00074 
00075   Uint32 get_mgmd_port() const;
00076   const char *get_mgmd_host() const;
00077   const char *get_connectstring(char *buf, int buf_sz) const;
00078   NdbMgmHandle get_mgmHandle() { return m_handle; };
00079   NdbMgmHandle* get_mgmHandlePtr() { return &m_handle; };
00080 
00081   Uint32 get_configuration_nodeid() const;
00082 private:
00083   BaseString errorString;
00084   enum ErrorType {
00085     CR_NO_ERROR = 0,
00086     CR_ERROR = 1,
00087     CR_RETRY = 2
00088   };
00089   ErrorType latestErrorType;
00090   
00091   void setError(ErrorType, const char * errorMsg);
00092   
00093   Uint32      _ownNodeId;
00094   /*
00095   Uint32      m_mgmd_port;
00096   const char *m_mgmd_host;
00097   */
00098 
00099   Uint32 m_version;
00100   Uint32 m_node_type;
00101   NdbMgmHandle m_handle;
00102 };
00103 
00104 #endif
00105 
00106 

Generated on Wed Jul 20 21:05:07 2005 for MySQL 5.0.9 Beta by  doxygen 1.4.3