summaryrefslogtreecommitdiff
path: root/server-tools/instance-manager/mysql_connection.h
diff options
context:
space:
mode:
Diffstat (limited to 'server-tools/instance-manager/mysql_connection.h')
-rw-r--r--server-tools/instance-manager/mysql_connection.h59
1 files changed, 43 insertions, 16 deletions
diff --git a/server-tools/instance-manager/mysql_connection.h b/server-tools/instance-manager/mysql_connection.h
index 3496cc05815..aceb2d62736 100644
--- a/server-tools/instance-manager/mysql_connection.h
+++ b/server-tools/instance-manager/mysql_connection.h
@@ -16,33 +16,60 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-#include <my_global.h>
-#include <my_pthread.h>
+#include "thread_registry.h"
+#include <mysql_com.h>
#if defined(__GNUC__) && defined(USE_PRAGMA_INTERFACE)
#pragma interface
#endif
-pthread_handler_t mysql_connection(void *arg);
-
-class Thread_registry;
-class User_map;
-class Instance_map;
struct st_vio;
+class User_map;
-struct Mysql_connection_thread_args
+/*
+ MySQL connection - handle one connection with mysql command line client
+ See also comments in mysqlmanager.cc to picture general Instance Manager
+ architecture.
+ We use conventional technique to work with classes without exceptions:
+ class acquires all vital resource in init(); Thus if init() succeed,
+ a user must call cleanup(). All other methods are valid only between
+ init() and cleanup().
+*/
+
+class Mysql_connection: public Thread
{
+public:
+ Mysql_connection(Thread_registry *thread_registry_arg,
+ User_map *user_map_arg,
+ struct st_vio *vio_arg,
+ ulong connection_id_arg);
+ virtual ~Mysql_connection();
+
+protected:
+ virtual void run();
+
+private:
struct st_vio *vio;
- Thread_registry &thread_registry;
- const User_map &user_map;
ulong connection_id;
- Instance_map &instance_map;
+ Thread_info thread_info;
+ Thread_registry *thread_registry;
+ User_map *user_map;
+ NET net;
+ struct rand_struct rand_st;
+ char scramble[SCRAMBLE_LENGTH + 1];
+ uint status;
+ ulong client_capabilities;
+private:
+ /* The main loop implementation triad */
+ int init();
+ void main();
+ void cleanup();
- Mysql_connection_thread_args(struct st_vio *vio_arg,
- Thread_registry &thread_registry_arg,
- const User_map &user_map_arg,
- ulong connection_id_arg,
- Instance_map &instance_map_arg);
+ /* Names are conventionally the same as in mysqld */
+ int check_connection();
+ int do_command();
+ int dispatch_command(enum enum_server_command command,
+ const char *text, uint len);
};
#endif // INCLUDES_MYSQL_INSTANCE_MANAGER_MYSQL_CONNECTION_H