16 #ifndef RPL_INFO_HANDLER_H
17 #define RPL_INFO_HANDLER_H
19 #include <my_global.h>
20 #include <dynamic_ids.h>
21 #include "rpl_info_values.h"
23 enum enum_info_repository
25 INFO_REPOSITORY_FILE= 0,
26 INFO_REPOSITORY_TABLE,
27 INFO_REPOSITORY_DUMMY,
32 INVALID_INFO_REPOSITORY
38 enum enum_return_check { REPOSITORY_DOES_NOT_EXIST= 1, REPOSITORY_EXISTS, ERROR_CHECKING_REPOSITORY };
40 class Rpl_info_handler
42 friend class Rpl_info_factory;
56 return do_init_info();
69 enum_return_check check_info()
71 return do_check_info();
90 int flush_info(
const bool force)
92 return do_flush_info(force);
105 return do_remove_info();
117 return do_clean_info();
138 int prepare_info_for_read()
140 return (do_prepare_info_for_read());
150 int prepare_info_for_write()
152 return (do_prepare_info_for_write());
160 uint get_rpl_info_type()
162 return (do_get_rpl_info_type());
167 const char* get_rpl_info_type_str();
180 template <
class TypeHandler>
181 bool set_info(TypeHandler
const value)
183 if (
cursor >= ninfo || prv_error)
186 if (!(prv_error= do_set_info(
cursor, value)))
192 template <
class TypeHandler>
193 bool set_info(TypeHandler
const value,
const size_t size)
195 if (
cursor >= ninfo || prv_error)
198 if (!(prv_error= do_set_info(
cursor, value, size)))
217 template <
class TypeHandlerPo
inter,
class TypeHandler>
218 bool get_info(TypeHandlerPointer value,
219 TypeHandler
const default_value)
221 if (
cursor >= ninfo || prv_error)
224 if (!(prv_error= do_get_info(
cursor, value, default_value)))
245 template <
class TypeHandler>
246 bool get_info(TypeHandler value,
const size_t size,
247 TypeHandler
const default_value)
249 if (
cursor >= ninfo || prv_error)
252 if (!(prv_error= do_get_info(
cursor, value, size, default_value)))
274 if (
cursor >= ninfo || prv_error)
277 if (!(prv_error= do_get_info(
cursor, value, default_value)))
288 int get_number_info() {
return ninfo; }
297 void set_sync_period(uint period);
306 char *get_description_info()
308 return (do_get_description_info());
319 bool is_transactional() {
return do_is_transactional(); }
334 bool update_is_transactional() {
return do_update_is_transactional(); }
343 virtual ~Rpl_info_handler();
367 Rpl_info_handler(
const int nparam);
370 virtual int do_init_info()= 0;
371 virtual int do_init_info(uint instance)= 0;
372 virtual enum_return_check do_check_info()= 0;
373 virtual enum_return_check do_check_info(uint instance)= 0;
374 virtual int do_flush_info(
const bool force)= 0;
375 virtual int do_remove_info()= 0;
376 virtual int do_clean_info()= 0;
377 virtual void do_end_info()= 0;
378 virtual int do_prepare_info_for_read()= 0;
379 virtual int do_prepare_info_for_write()= 0;
381 virtual bool do_set_info(
const int pos,
const char *value)= 0;
382 virtual bool do_set_info(
const int pos,
const uchar *value,
383 const size_t size)= 0;
384 virtual bool do_set_info(
const int pos,
const ulong value)= 0;
385 virtual bool do_set_info(
const int pos,
const int value)= 0;
386 virtual bool do_set_info(
const int pos,
const float value)= 0;
387 virtual bool do_set_info(
const int pos,
const Dynamic_ids *value)= 0;
388 virtual bool do_get_info(
const int pos,
char *value,
390 const char *default_value)= 0;
391 virtual bool do_get_info(
const int pos, uchar *value,
393 const uchar *default_value)= 0;
394 virtual bool do_get_info(
const int pos, ulong *value,
395 const ulong default_value)= 0;
396 virtual bool do_get_info(
const int pos,
int *value,
397 const int default_value)= 0;
398 virtual bool do_get_info(
const int pos,
float *value,
399 const float default_value)= 0;
400 virtual bool do_get_info(
const int pos,
Dynamic_ids *value,
402 virtual char* do_get_description_info()= 0;
403 virtual bool do_is_transactional()= 0;
404 virtual bool do_update_is_transactional()= 0;
405 virtual uint do_get_rpl_info_type()= 0;
407 Rpl_info_handler(
const Rpl_info_handler&
handler);
409 Rpl_info_handler& operator=(
const Rpl_info_handler&
handler);
413 extern uint mts_debug_concurrent_access;