My Project
rpl_info_file.h
00001 /* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
00015 
00016 #ifndef RPL_INFO_FILE_H
00017 #define RPL_INFO_FILE_H
00018 
00019 #include <my_global.h>
00020 #include <sql_priv.h>
00021 #include "rpl_info_handler.h"
00022 
00023 class Rpl_info_factory;
00024 
00028 class Rpl_info_file : public Rpl_info_handler
00029 {
00030   friend class Rpl_info_factory;
00031 
00032 public:
00033   virtual ~Rpl_info_file();
00034 
00035 private:
00044   char info_fname[FN_REFLEN + 128];
00045 
00050   char pattern_fname[FN_REFLEN + 128];
00051 
00052   /*
00053     info_fd - file descriptor of the info file. set only during
00054     initialization or clean up - safe to read anytime
00055   */
00056   File info_fd;
00057 
00058   /* IO_CACHE of the info file - set only during init or end */
00059   IO_CACHE info_file;
00060 
00061   /*
00062     The flag indicates whether the file name include the instance number or not.
00063   */
00064   bool name_indexed;
00065 
00066   int do_init_info();
00067   int do_init_info(uint instance);
00068   enum_return_check do_check_info();
00069   enum_return_check do_check_info(uint instance);
00070   void do_end_info();
00071   int do_flush_info(const bool force);
00072   int do_remove_info();
00073   int do_clean_info();
00086   static bool do_count_info(const int nparam,
00087                             const char* param_pattern_fname,
00088                             bool name_indexed,
00089                             uint* counter);
00090   static int do_reset_info(int const nparam,
00091                            const char* param_pattern_fname,
00092                            bool name_indexed);
00093 
00094   int do_prepare_info_for_read();
00095   int do_prepare_info_for_write();
00096   bool do_set_info(const int pos, const char *value);
00097   bool do_set_info(const int pos, const uchar *value,
00098                    const size_t size);
00099   bool do_set_info(const int pos, const int value);
00100   bool do_set_info(const int pos, const ulong value);
00101   bool do_set_info(const int pos, const float value);
00102   bool do_set_info(const int pos, const Dynamic_ids *value);
00103   bool do_get_info(const int pos, char *value, const size_t size,
00104                    const char *default_value);
00105   bool do_get_info(const int pos, uchar *value, const size_t size,
00106                    const uchar *default_value);
00107   bool do_get_info(const int pos, int *value,
00108                    const int default_value);
00109   bool do_get_info(const int pos, ulong *value,
00110                    const ulong default_value);
00111   bool do_get_info(const int pos, float *value,
00112                    const float default_value);
00113   bool do_get_info(const int pos, Dynamic_ids *value,
00114                    const Dynamic_ids *default_value);
00115   char* do_get_description_info();
00116   uint do_get_rpl_info_type();
00117 
00118   bool do_is_transactional();
00119   bool do_update_is_transactional();
00120 
00121   Rpl_info_file(int const nparam, const char* param_pattern_fname,
00122                 const char* param_info_fname, bool name_indexed);
00123 
00124   Rpl_info_file(const Rpl_info_file& info);
00125   Rpl_info_file& operator=(const Rpl_info_file& info);
00126 };
00127 #endif /* RPL_INFO_FILE_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines