MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rpl_info_file.h
1 /* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
2 
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.
6 
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.
11 
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 St, Fifth Floor, Boston, MA 02110-1301 USA */
15 
16 #ifndef RPL_INFO_FILE_H
17 #define RPL_INFO_FILE_H
18 
19 #include <my_global.h>
20 #include <sql_priv.h>
21 #include "rpl_info_handler.h"
22 
23 class Rpl_info_factory;
24 
28 class Rpl_info_file : public Rpl_info_handler
29 {
30  friend class Rpl_info_factory;
31 
32 public:
33  virtual ~Rpl_info_file();
34 
35 private:
44  char info_fname[FN_REFLEN + 128];
45 
50  char pattern_fname[FN_REFLEN + 128];
51 
52  /*
53  info_fd - file descriptor of the info file. set only during
54  initialization or clean up - safe to read anytime
55  */
56  File info_fd;
57 
58  /* IO_CACHE of the info file - set only during init or end */
59  IO_CACHE info_file;
60 
61  /*
62  The flag indicates whether the file name include the instance number or not.
63  */
64  bool name_indexed;
65 
66  int do_init_info();
67  int do_init_info(uint instance);
68  enum_return_check do_check_info();
69  enum_return_check do_check_info(uint instance);
70  void do_end_info();
71  int do_flush_info(const bool force);
72  int do_remove_info();
73  int do_clean_info();
86  static bool do_count_info(const int nparam,
87  const char* param_pattern_fname,
88  bool name_indexed,
89  uint* counter);
90  static int do_reset_info(int const nparam,
91  const char* param_pattern_fname,
92  bool name_indexed);
93 
94  int do_prepare_info_for_read();
95  int do_prepare_info_for_write();
96  bool do_set_info(const int pos, const char *value);
97  bool do_set_info(const int pos, const uchar *value,
98  const size_t size);
99  bool do_set_info(const int pos, const int value);
100  bool do_set_info(const int pos, const ulong value);
101  bool do_set_info(const int pos, const float value);
102  bool do_set_info(const int pos, const Dynamic_ids *value);
103  bool do_get_info(const int pos, char *value, const size_t size,
104  const char *default_value);
105  bool do_get_info(const int pos, uchar *value, const size_t size,
106  const uchar *default_value);
107  bool do_get_info(const int pos, int *value,
108  const int default_value);
109  bool do_get_info(const int pos, ulong *value,
110  const ulong default_value);
111  bool do_get_info(const int pos, float *value,
112  const float default_value);
113  bool do_get_info(const int pos, Dynamic_ids *value,
114  const Dynamic_ids *default_value);
115  char* do_get_description_info();
116  uint do_get_rpl_info_type();
117 
118  bool do_is_transactional();
119  bool do_update_is_transactional();
120 
121  Rpl_info_file(int const nparam, const char* param_pattern_fname,
122  const char* param_info_fname, bool name_indexed);
123 
124  Rpl_info_file(const Rpl_info_file& info);
125  Rpl_info_file& operator=(const Rpl_info_file& info);
126 };
127 #endif /* RPL_INFO_FILE_H */