mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / ndb / src / ndbapi / ndb_cluster_connection_impl.hpp
blobe71c91d5aacdcdfb6f5f70b1cb879f529d05fbb2
1 /* Copyright (c) 2003-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 */
17 #ifndef CLUSTER_CONNECTION_IMPL_HPP
18 #define CLUSTER_CONNECTION_IMPL_HPP
20 #include <ndb_cluster_connection.hpp>
21 #include <Vector.hpp>
22 #include <NdbMutex.h>
24 extern NdbMutex *g_ndb_connection_mutex;
26 class TransporterFacade;
27 class ConfigRetriever;
28 class NdbThread;
29 class ndb_mgm_configuration;
31 extern "C" {
32 void* run_ndb_cluster_connection_connect_thread(void*);
35 class Ndb_cluster_connection_impl : public Ndb_cluster_connection
37 Ndb_cluster_connection_impl(const char *connectstring);
38 ~Ndb_cluster_connection_impl();
40 void do_test();
42 void init_get_next_node(Ndb_cluster_connection_node_iter &iter);
43 Uint32 get_next_node(Ndb_cluster_connection_node_iter &iter);
45 inline unsigned get_connect_count() const;
46 public:
47 inline Uint64 *get_latest_trans_gci() { return &m_latest_trans_gci; }
49 private:
50 friend class Ndb;
51 friend class NdbImpl;
52 friend void* run_ndb_cluster_connection_connect_thread(void*);
53 friend class Ndb_cluster_connection;
54 friend class NdbEventBuffer;
56 struct Node
58 Node(Uint32 _g= 0, Uint32 _id= 0) : this_group(0),
59 next_group(0),
60 group(_g),
61 id(_id) {};
62 Uint32 this_group;
63 Uint32 next_group;
64 Uint32 group;
65 Uint32 id;
68 Vector<Node> m_all_nodes;
69 int init_nodes_vector(Uint32 nodeid, const ndb_mgm_configuration &config);
70 void connect_thread();
71 void set_name(const char *name);
73 TransporterFacade *m_transporter_facade;
74 ConfigRetriever *m_config_retriever;
75 NdbThread *m_connect_thread;
76 int (*m_connect_callback)(void);
78 int m_optimized_node_selection;
79 char *m_name;
80 int m_run_connect_thread;
81 NdbMutex *m_event_add_drop_mutex;
82 Uint64 m_latest_trans_gci;
85 #endif