00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
00096
00097
00098
00099 Uint32 m_version;
00100 Uint32 m_node_type;
00101 NdbMgmHandle m_handle;
00102 };
00103
00104 #endif
00105
00106