MySQL  8.0.19
Source Code Documentation
compatibility_module.h
Go to the documentation of this file.
1 /* Copyright (c) 2015, 2019, 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, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef COMPATIBILITY_MODULE_INCLUDED
24 #define COMPATIBILITY_MODULE_INCLUDED
25 
26 #include <map>
27 
29 
30 /* Possible outcomes when checking inter version compatibility */
31 typedef enum st_compatibility_types {
32  INCOMPATIBLE = 0, // Versions not compatible
33  INCOMPATIBLE_LOWER_VERSION, // Versions not compatible, member has lower
34  // version
35  COMPATIBLE, // Versions compatible
36  READ_COMPATIBLE // Member can read but not write
38 
40  public:
43 
44  /**
45  Returns this member version
46  */
48 
49  /**
50  Set the module local version
51  @param local_version the new local version to be set
52  */
54 
55  /**
56  Add a incompatibility between the given members.
57  @param from The member that is not compatible with 'to'
58  @param to The member with which 'from' is not compatible with
59  */
61 
62  /**
63  Add a incompatibility between a range of member versions.
64  @param from The member that is not compatible with 'to'
65  @param to_min The minimum version with which 'from' is not compatible with
66  @param to_max The maximum version with which 'from' is not compatible with
67  */
69  Member_version &to_max);
70 
71  /**
72  Checks if the given version is incompatible with another version.
73  @param from The member that may be not compatible with 'to'
74  @param to The member with which 'from' may be not compatible with
75  @param do_version_check If version compatibility check is needed
76  @return the compatibility status
77  @retval INCOMPATIBLE The versions are not compatible with each other
78  @retval COMPATIBLE The versions are compatible with each other
79  @retval READ_COMPATIBLE The version 'from' can only read from 'to'
80  */
82  Member_version &to,
83  bool do_version_check);
84 
85  /**
86  Checks if the given version is incompatible with another version.
87  @param from The member that may be not compatible with 'to'
88  @param to The member with which 'from' may be not compatible with
89  @return the compatibility status
90  @retval INCOMPATIBLE The versions are not compatible with each other
91  @retval COMPATIBLE The versions are compatible with each other
92  @retval READ_COMPATIBLE The version 'from' can only read from 'to'
93  */
95  Member_version to);
96  /**
97  Checks if the given version is incompatible with another version.
98  @param from The member that may be not compatible with 'to'
99  @param to_min The minimum version with which 'from' is not compatible with
100  @param to_max The maximum version with which 'from' is not compatible with
101 
102  @return the compatibility status
103  @retval true The version is in the range of the incompatible versions
104  @retval false The version is not in the range of the incompatible
105  versions
106  */
108  unsigned int to_min,
109  unsigned int to_max);
110  /**
111  Checks if the given version is compatible with this member local version.
112  @param to The member with which 'from' may be not compatible with
113  @param is_lowest_version If to version is lowest in the group
114  @return the compatibility status
115  @retval INCOMPATIBLE The versions are not compatible with each other
116  @retval COMPATIBLE The versions are compatible with each other
117  @retval READ_COMPATIBLE The version 'from' can only read from 'to'
118  */
120  bool is_lowest_version);
121 
122  virtual ~Compatibility_module();
123 
124  private:
125  /*The configured local version*/
127  /*
128  The incompatibility matrix: <version V, version incompatible with Vmin to
129  Vmax>
130  */
131  std::multimap<unsigned int, std::pair<unsigned int, unsigned int>>
133 };
134 
135 #endif /* COMPATIBILITY_MODULE_INCLUDED */
INCOMPATIBLE_LOWER_VERSION
@ INCOMPATIBLE_LOWER_VERSION
Definition: compatibility_module.h:33
READ_COMPATIBLE
@ READ_COMPATIBLE
Definition: compatibility_module.h:36
Compatibility_module
Definition: compatibility_module.h:39
Compatibility_module::get_local_version
Member_version & get_local_version()
Returns this member version.
Definition: compatibility_module.cc:35
Compatibility_module::check_local_incompatibility
Compatibility_type check_local_incompatibility(Member_version &to, bool is_lowest_version)
Checks if the given version is compatible with this member local version.
Definition: compatibility_module.cc:59
Compatibility_module::incompatibilities
std::multimap< unsigned int, std::pair< unsigned int, unsigned int > > incompatibilities
Definition: compatibility_module.h:132
INCOMPATIBLE
@ INCOMPATIBLE
Definition: compatibility_module.h:32
member_version.h
Compatibility_module::local_version
Member_version * local_version
Definition: compatibility_module.h:126
st_compatibility_types
st_compatibility_types
Definition: compatibility_module.h:31
Compatibility_module::Compatibility_module
Compatibility_module()
Definition: compatibility_module.cc:29
Compatibility_module::check_incompatibility
Compatibility_type check_incompatibility(Member_version &from, Member_version &to, bool do_version_check)
Checks if the given version is incompatible with another version.
Definition: compatibility_module.cc:90
Compatibility_module::check_version_incompatibility
static Compatibility_type check_version_incompatibility(Member_version from, Member_version to)
Checks if the given version is incompatible with another version.
Definition: compatibility_module.cc:127
Compatibility_type
enum st_compatibility_types Compatibility_type
Compatibility_module::~Compatibility_module
virtual ~Compatibility_module()
Definition: compatibility_module.cc:134
Compatibility_module::add_incompatibility
void add_incompatibility(Member_version &from, Member_version &to)
Add a incompatibility between the given members.
Definition: compatibility_module.cc:44
COMPATIBLE
@ COMPATIBLE
Definition: compatibility_module.h:35
Compatibility_module::check_version_range_incompatibility
bool check_version_range_incompatibility(Member_version &from, unsigned int to_min, unsigned int to_max)
Checks if the given version is incompatible with another version.
Definition: compatibility_module.cc:64
Compatibility_module::set_local_version
void set_local_version(Member_version &local_version)
Set the module local version.
Definition: compatibility_module.cc:39
Member_version
Definition: member_version.h:30