MySQL 8.0.40
Source Code Documentation
member_actions_handler_configuration.h
Go to the documentation of this file.
1/* Copyright (c) 2021, 2024, Oracle and/or its affiliates.
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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef MEMBER_ACTIONS_HANDLER_CONFIGURATION_INCLUDED
25#define MEMBER_ACTIONS_HANDLER_CONFIGURATION_INCLUDED
26
27#include "plugin/group_replication/generated/protobuf_lite/replication_group_member_actions.pb.h"
30
31/**
32 @class Member_actions_handler_configuration
33
34 The member actions table configuration abstraction layer.
35*/
37 public:
38 /**
39 Constructor.
40
41 @param[in] configuration_propagation
42 the object to call to propagate configuration
43 */
45 Configuration_propagation *configuration_propagation);
46
48
49 /**
50 Enable/disable a member action.
51
52 @param[in] name the action name
53 @param[in] event the action event
54 @param[in] enable true to enable the action, false to disable
55
56 @return std::pair<bool, std::string> where each element has the
57 following meaning:
58 first element of the pair is the function error value:
59 false Successful
60 true Error
61 second element of the pair is the error message.
62 */
63 std::pair<bool, std::string> enable_disable_action(const std::string &name,
64 const std::string &event,
65 bool enable);
66
67 /**
68 Retrieve member actions configured to trigger on a given event.
69
70 @param[out] action_list member actions list
71 @param[in] event the event to filter the actions
72
73 @return Operation status
74 @retval false Successful
75 @retval true Error
76 */
79 const std::string &event);
80
81 /**
82 Retrieve member actions configuration in the serialized
83 format.
84
85 @param[out] serialized_configuration
86 the serialized configuration
87 @param[in] set_force_update
88 if true enables the force_update flag, which will
89 make the sent configuration to override other
90 members configuration
91
92 @return Operation status
93 @retval false Successful
94 @retval true Error
95 */
96 bool get_all_actions(std::string &serialized_configuration,
97 bool set_force_update);
98
99 /**
100 Update member actions configuration with a given configuration.
101 If the given configuration has a version lower than the local
102 configuration, the update is skipped.
103
104 @param[in] action_list member actions list
105
106 @return Operation status
107 @retval false Successful
108 @retval true Error
109 */
112
113 /**
114 Replace member actions configuration with a given configuration,
115 even if the given configuration has a version lower than the local
116 configuration.
117
118 @param[in] action_list member actions list
119
120 @return Operation status
121 @retval false Successful
122 @retval true Error
123 */
126
127 /**
128 Reset member actions to the default configuration.
129
130 @return Operation status
131 @retval false Successful
132 @retval true Error
133 */
135
136 private:
137 void field_store(Field *field, const std::string &value);
138 void field_store(Field *field, uint value);
139
140 /**
141 Commit and propagate the local member actions configuration.
142
143 @param[in] table_op the table that persists the configuration
144
145 @return Operation status
146 @retval false Successful
147 @retval true Error
148 */
149 std::pair<bool, std::string> commit_and_propagate_changes(
150 Rpl_sys_table_access &table_op);
151
152 /**
153 Retrieve member actions configuration in the serialized
154 format.
155
156 @param[in] table_op the table that persists the configuration
157 @param[out] action_list member actions list
158
159 @return Operation status
160 @retval false Successful
161 @retval true Error
162 */
164 Rpl_sys_table_access &table_op,
166
167 /**
168 Update member actions configuration with a given configuration.
169 If the given configuration has a version lower than the local
170 configuration, the update is skipped.
171
172 @param[in] action_list member actions list
173 @param[in] ignore_version
174 if false, the local configuration is updated
175 if the version of the given configuration
176 is higher than the local one
177 true, there is no version checking
178 @param[in] ignore_global_read_lock
179 if true, global_read_lock is ignored on commit
180 false, otherwise
181
182 @return Operation status
183 @retval false Successful
184 @retval true Error
185 */
188 bool ignore_version, bool ignore_global_read_lock);
189
190 const std::string s_schema_name{"mysql"};
191 const std::string s_table_name{"replication_group_member_actions"};
193
194 /**
195 The pointer to the object to call to propagate configuration.
196 */
198};
199
200#endif /* MEMBER_ACTIONS_HANDLER_CONFIGURATION_INCLUDED */
Interface for configuration propagation through Member_actions_handler.
Definition: configuration_propagation.h:33
Definition: field.h:575
The member actions table configuration abstraction layer.
Definition: member_actions_handler_configuration.h:36
virtual ~Member_actions_handler_configuration()
Definition: member_actions_handler_configuration.cc:44
Member_actions_handler_configuration(Configuration_propagation *configuration_propagation)
Constructor.
Definition: member_actions_handler_configuration.cc:40
const std::string s_table_name
Definition: member_actions_handler_configuration.h:191
std::pair< bool, std::string > commit_and_propagate_changes(Rpl_sys_table_access &table_op)
Commit and propagate the local member actions configuration.
Definition: member_actions_handler_configuration.cc:132
bool reset_to_default_actions_configuration()
Reset member actions to the default configuration.
Definition: member_actions_handler_configuration.cc:439
bool get_all_actions(std::string &serialized_configuration, bool set_force_update)
Retrieve member actions configuration in the serialized format.
Definition: member_actions_handler_configuration.cc:222
void field_store(Field *field, const std::string &value)
Definition: member_actions_handler_configuration.cc:28
bool replace_all_actions(const protobuf_replication_group_member_actions::ActionList &action_list)
Replace member actions configuration with a given configuration, even if the given configuration has ...
Definition: member_actions_handler_configuration.cc:306
bool get_actions_for_event(protobuf_replication_group_member_actions::ActionList &action_list, const std::string &event)
Retrieve member actions configured to trigger on a given event.
Definition: member_actions_handler_configuration.cc:164
Configuration_propagation * m_configuration_propagation
The pointer to the object to call to propagate configuration.
Definition: member_actions_handler_configuration.h:197
const std::string s_schema_name
Definition: member_actions_handler_configuration.h:190
bool get_all_actions_internal(Rpl_sys_table_access &table_op, protobuf_replication_group_member_actions::ActionList &action_list)
Retrieve member actions configuration in the serialized format.
Definition: member_actions_handler_configuration.cc:247
bool update_all_actions_internal(const protobuf_replication_group_member_actions::ActionList &action_list, bool ignore_version, bool ignore_global_read_lock)
Update member actions configuration with a given configuration.
Definition: member_actions_handler_configuration.cc:312
bool update_all_actions(const protobuf_replication_group_member_actions::ActionList &action_list)
Update member actions configuration with a given configuration.
Definition: member_actions_handler_configuration.cc:300
std::pair< bool, std::string > enable_disable_action(const std::string &name, const std::string &event, bool enable)
Enable/disable a member action.
Definition: member_actions_handler_configuration.cc:47
const uint s_fields_number
Definition: member_actions_handler_configuration.h:192
The class are wrappers for handler index and random scan functions to simplify their usage.
Definition: rpl_sys_table_access.h:43
message ActionList
Definition: replication_group_member_actions.proto:39
required string event
Definition: replication_group_member_actions.proto:32
case opt name
Definition: sslopt-case.h:33
unsigned int uint
Definition: uca9-dump.cc:75