MySQL 9.0.0
Source Code Documentation
gcs_xcom_proxy.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 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 GCS_XCOM_PROXY_INCLUDED
25#define GCS_XCOM_PROXY_INCLUDED
26
27#include <string>
28#include <unordered_set> // std::unordered_set
30
42#include "plugin/group_replication/libmysqlgcs/xdr_gen/xcom_vp.h"
43
44#define XCOM_COMM_STATUS_UNDEFINED -1
45
46/**
47 @class gcs_xcom_control_proxy
48
49 This class is an abstraction layer between xcom and the actual
50 implementation. The purpose of this is to allow Gcs_xcom_control_interface
51 to be unit testable by creating mock classes on top of it.
52*/
54 public:
55 explicit Gcs_xcom_proxy() = default;
56
57 /**
58 The destructor.
59 */
60 virtual ~Gcs_xcom_proxy() = default;
61
62 /**
63 This is an utility member function that is used to call into XCom for
64 creating list with node's addresses and their associated UUIDs. Note
65 that callers must provide the UUID.
66
67 @param n The number of elements in the list
68 @param names The names to be put on the list
69 @param uuids The UUIDs to be put on the list
70 @return a pointer to the list containing all the elements needed. The
71 caller is responsible to reclaim memory once he is done with this data
72 @c delete_node_address
73 */
74
75 virtual node_address *new_node_address_uuid(unsigned int n,
76 char const *names[],
77 blob uuids[]) = 0;
78
79 /**
80 This function is responsible to delete the list of nodes that had been
81 previously created by @c new_node_address.
82
83 @param n the length of the list
84 @param na the list to delete
85 */
86
87 virtual void delete_node_address(unsigned int n, node_address *na) = 0;
88
89 /**
90 This member function is responsible to call into XCom consensus and add a
91 node to the group. The caller is responsible for ensuring that the session
92 has been opened before @c open_session and also that the node is not yet
93 in the configuration.
94
95 The callee must have opened an XCom connection before calling this
96 function. @c xcom_client_open_connection.
97
98 @param fd the file descriptor to the XCom connection established earlier
99 @param nl The node list containing the list of peers to add
100 @param group_id the identifier of the group to which the nodes should
101 be added
102 @returns true (false) on success (failure). Success means that XCom will
103 process our request, failure means it won't. There could be errors
104 later in the process of adding a node. Since this is basically an
105 asynchronous function, one needs to wait for the actual view change
106 to validate that the node was added to the configuration.
107 */
108
109 virtual bool xcom_client_add_node(connection_descriptor *fd, node_list *nl,
110 uint32_t group_id) = 0;
111
112 /**
113 This member function is responsible for triggering the removal of a node
114 from the XCom configuration. This function is asynchronous, so you need to
115 wait for the view change to actually validate that the removal was
116 successful.
117
118 The caller is responsible for making sure that the server to be removed is
119 in the group.
120
121 This function MUST be called after opening the local XCom session
122 @c xcom_input_connect.
123
124 @param nl The list of nodes to remove from the group
125 @param group_id The identifier of the group from which the nodes will
126 be removed
127 @returns true (false) on success (failure). Success means that XCom will
128 process our request, failure means it won't. There could be errors
129 later in the process of removing a node. Since this is basically an
130 asynchronous function, one needs to wait for the actual view change
131 to validate that the nodes were removed from the configuration.
132 */
133
134 virtual bool xcom_client_remove_node(node_list *nl, uint32_t group_id) = 0;
135
136 /**
137 This member function is responsible for triggering the removal of a node
138 from the XCom configuration. This function is asynchronous, so you need to
139 wait for the view change to actually validate that the removal was
140 successful.
141
142 The caller is responsible for making sure that the server to be removed is
143 in the group.
144
145 The callee must have opened an XCom connection before calling this
146 function. @c xcom_client_open_connection.
147
148 @param fd the file descriptor to the XCom connection established earlier
149 @param nl The list of nodes to remove from the group
150 @param group_id The identifier of the group from which the nodes will
151 be removed
152 @returns true (false) on success (failure). Success means that XCom will
153 process our request, failure means it won't. There could be errors
154 later in the process of removing a node. Since this is basically an
155 asynchronous function, one needs to wait for the actual view change
156 to validate that the nodes were removed from the configuration.
157 */
158
159 virtual bool xcom_client_remove_node(connection_descriptor *fd, node_list *nl,
160 uint32_t group_id) = 0;
161
162 /**
163 This member function is responsible for retrieving the event horizon of the
164 XCom configuration.
165
166 This function REQUIRES a prior call to @c xcom_open_handlers to establish a
167 connection to XCom.
168
169 @param[in] group_id The identifier of the group from which the event horizon
170 will be retrieved
171 @param[out] event_horizon A reference to where the group's event horizon
172 value will be written to
173 @retval true if successful and @c event_horizon was written to
174 @retval false otherwise
175
176 */
178 uint32_t group_id, xcom_event_horizon &event_horizon) = 0;
179
180 /**
181 This member function is responsible for triggering the reconfiguration of
182 the event horizon of the XCom configuration. This function is asynchronous,
183 so you need to poll @c xcom_get_event_horizon to actually validate that the
184 reconfiguration was successful.
185
186 This function REQUIRES a prior call to @c xcom_open_handlers to establish a
187 connection to XCom.
188
189 @param event_horizon The desired event horizon value
190 @param group_id The identifier of the group from which the nodes will
191 be removed
192 @returns true (false) on success (failure). Success means that XCom will
193 process our request, failure means it won't. There could be errors
194 later in the process of setting the event horizon. Since this is
195 basically an asynchronous function, one needs to busy-wait on
196 @c xcom_client_get_event_horizon to validate that the event horizon
197 was modified.
198 */
200 uint32_t group_id, xcom_event_horizon event_horizon) = 0;
201
202 /**
203 This member function is responsible for triggering the reconfiguration of
204 the leaders of the XCom configuration. This function is asynchronous, so you
205 need to poll @c xcom_get_leaders to actually validate that the
206 reconfiguration was successful.
207
208 @param group_id The identifier of the group
209 @param nr_preferred_leaders Number of preferred leaders, i.e. elements in
210 @c preferred_leaders
211 @param preferred_leaders The "host:port" of the preferred leaders
212 @param max_nr_leaders Maximum number of active leaders
213 @returns true (false) on success (failure). Success means that XCom will
214 process our request, failure means it won't. There could be errors
215 later in the process of setting the leaders. Since this is
216 basically an asynchronous function, one needs to busy-wait on
217 @c xcom_client_get_leaders to validate that the leaders were
218 modified.
219 */
220 virtual bool xcom_client_set_leaders(uint32_t group_id,
221 u_int nr_preferred_leaders,
222 char const *preferred_leaders[],
223 node_no max_nr_leaders) = 0;
224
225 /**
226 This member function is responsible for retrieving the leaders of the
227 XCom configuration.
228
229 @param[in] group_id The identifier of the group
230 @param[out] leaders A reference to where the group's leaders will be written
231 to
232 @retval true if successful and @c leaders was written to
233 @retval false otherwise
234 */
235 virtual bool xcom_client_get_leaders(uint32_t group_id,
236 leader_info_data &leaders) = 0;
237
238 /**
239 This member function is responsible for retrieving the application payloads
240 decided in the synodes in @c synodes, from the XCom instance connected to
241 via @c fd.
242
243 @param[in] fd The file descriptor to the XCom connection established
244 earlier
245 @param[in] group_id The identifier of the group from which the payloads
246 will be retrieved
247 @param[in] synodes The desired synodes
248 @param[out] reply Where the requested payloads will be written to
249 @returns true (false) on success (failure). Success means that XCom had the
250 requested payloads, which were written to @c reply.
251 */
253 connection_descriptor *fd, uint32_t group_id, synode_no_array &synodes,
254 synode_app_data_array &reply) = 0;
255
256 /**
257 This member function is responsible for setting a new value for the maximum
258 size of the XCom cache.
259
260 This function is asynchronous, so the return value indicates only whether
261 the request to change the value was successfully pushed to XCom or not.
262 However, since the cache size is set only for the local node, and makes no
263 further verifications on the value, if XCom processes the request, it will
264 accept the new value. The callers of this function must validate that the
265 value set is within the limits set to the maximum size of the XCom cache.
266
267 This function REQUIRES a prior call to @c xcom_open_handlers to establish a
268 connection to XCom.
269
270 @param size The new value for the maximum size of the XCom cache.
271 @returns true (false) on success (failure). Success means that XCom will
272 process our request, failure means it won't.
273 */
274 virtual bool xcom_client_set_cache_size(uint64_t size) = 0;
275
276 /**
277 This member function is responsible for pushing data into consensus on
278 XCom. The caller is responsible to making sure that there is an open XCom
279 session @c xcom_input_connect and also that the server is part of the XCom
280 configuration before sending data to it.
281
282 @c data must have been allocated by one of the functions of the malloc
283 family, because @c data will be passed on to XCom. XCom is implemented in
284 C and will use @c free to dispose of @c data when it is finished with @c
285 data.
286
287 This function takes ownership of @c data. This means that this
288 function becomes responsible for the lifetime of @c data. Since this
289 function takes ownership of @c data, the caller must not interact with @c
290 data after passing it to this function.
291
292 @param size the size of the payload
293 @param data the payload
294 @returns true (false) on success (failure). Success means that XCom will
295 process our request, failure means it won't.
296 */
297
298 virtual bool xcom_client_send_data(unsigned long long size, char *data) = 0;
299
300 /**
301 This member function initializes XCom. This function must be called before
302 anything else and from within the XCom thread. It will eventually call
303 the main loop inside XCom.
304
305 @param listen_port the port that the local XCom is to be listening on.
306 */
307
308 virtual void xcom_init(xcom_port listen_port) = 0;
309
310 /**
311 This member function finishes the XCom thread. This function must be
312 called when the XCOM thread was started but the node has not joined
313 a group.
314
315 There could be errors later in the process of exiting XCom. Since this is
316 basically an asynchronous function, one needs to wait for the XCom thread to
317 to ensure that XCom terminated.
318 */
319
320 virtual void xcom_exit() = 0;
321
322 /*
323 Return the operation mode as an integer from an operation mode provided
324 as a string. Note that the string must be provided in upper case letters
325 and the possible values are: "DISABLED", "PREFERRED", "REQUIRED",
326 "VERIFY_CA" or "VERIFY_IDENTITY".
327
328 If a different value is provide, INVALID_SSL_MODE (-1) is returned.
329 */
330
331 virtual int xcom_get_ssl_mode(const char *mode) = 0;
332
333 /*
334 Set the operation mode which might be the following:
335
336 . SSL_DISABLED (1): The SSL mode will be disabled and this is the default
337 value.
338
339 . SSL_PREFERRED (2): The SSL mode will be always disabled if this value is
340 provided and is only allowed to keep the solution compatibility with
341 MySQL server.
342
343 . SSL_REQUIRED (4): The SSL mode will be enabled but the verifications
344 described in the next modes are not performed.
345
346 . SSL_VERIFY_CA (4) - Verify the server TLS certificate against the
347 configured Certificate Authority (CA) certificates. The connection attempt
348 fails if no valid matching CA certificates are found.
349
350 . SSL_VERIFY_IDENTITY (5): Like VERIFY_CA, but additionally verify that the
351 server certificate matches the host to which the connection is attempted.
352
353 If a different value is provide, INVALID_SSL_MODE (-1) is returned.
354 */
355
356 virtual int xcom_set_ssl_mode(int mode) = 0;
357
358 /*
359 Return the operation fips mode as an integer from an operation fips mode
360 provided as a string. Note that the string must be provided in upper case
361 letters and the possible values are: "OFF", "ON", "STRICT",
362
363 If a different value is provide, INVALID_SSL_MODE (-1) is returned.
364 */
365
366 virtual int xcom_get_ssl_fips_mode(const char *mode) = 0;
367
368 /*
369 Set the operation fips mode which might be the following:
370
371 . SSL_FIPS_MODE_OFF (0): This will set openssl fips mode value to 0
372
373 . SSL_FIPS_MODE_ON (1): This will set openssl fips mode value to 1
374
375 . SSL_FIPS_MODE_STRICT (2): This will set openssl fips mode value to 2
376
377 If a different value is provide, INVALID_SSL_FIPS_MODE (-1) is returned.
378 */
379
380 virtual int xcom_set_ssl_fips_mode(int mode) = 0;
381
382 /**
383 Initialize the SSL.
384
385 @returns true on error. False otherwise.
386 */
387
388 virtual bool xcom_init_ssl() = 0;
389
390 /*
391 Destroy the SSL Configuration freeing allocated memory.
392 */
393
394 virtual void xcom_destroy_ssl() = 0;
395
396 /**
397 Return whether the SSL will be used to encrypt data or not.
398
399 @returns true (false) if XCom will (not) use SSL
400 */
401
402 virtual bool xcom_use_ssl() = 0;
403
405 tls_parameters tls) = 0;
406
407 virtual site_def const *find_site_def(synode_no synode) = 0;
408
409 /**
410 This member function boots XCom.
411
412 @param nl List with a single member - the one that boots the group
413 @param group_id the Group identifier to which the member belongs to
414 @returns true (false) on success (failure). Success means that XCom will
415 process our request, failure means it won't. There could be errors
416 later in the process of booting. Since this is basically an
417 asynchronous function, one needs to wait for XCom to signal it is
418 ready to validate whether it booted.
419 */
420
421 virtual bool xcom_client_boot(node_list *nl, uint32_t group_id) = 0;
422
423 /**
424 This member function opens a connection to an XCom instance.
425
426 @param addr The XCom instance address
427 @param port The XCom instance port
428 @return a valid file descriptor on success, -1 otherwise
429 */
430
432 std::string addr, xcom_port port) = 0;
433
434 /**
435 This member function closes the connection to an XCom instance.
436
437 @param fd The connection file descriptor
438 @returns true (false) on success (failure)
439 */
440
442
443 /**
444 This member waits for XCom to be initialized.
445 */
446
448
449 /*
450 This member retrieves the value of XCom initialized
451 */
452 virtual bool xcom_is_ready() = 0;
453
454 /*
455 This member sets the value of XCom initialized
456 */
457 virtual void xcom_set_ready(bool value) = 0;
458
459 /*
460 This member signals that XCom has initialized.
461 */
462 virtual void xcom_signal_ready() = 0;
463
464 /**
465 @brief Call this method to wait for XCom communications to be initialized.
466
467 Call this method to wait for XCom communications to be initialized. It will
468 block until XCom communications are either OK or error out. The value of
469 the status (XCOM_COMMS_OK or XCOM_COMMS_ERROR) is written into the status
470 out parameters.
471
472 @param [out] status value of the XCom communication layer status.
473 It can be either XCOM_COMMS_OK or XCOM_COMMS_ERROR
474 */
476
477 /*
478 This verifies if the communication status callback from XCom has been called
479 and if the internal cached status is different from
480 XCOM_COMM_STATUS_UNDEFINED
481 */
483
484 /*
485 This sets the status value of communication status callback from XCom.
486 Its main purpose is to reset the internal cached status to
487 XCOM_COMM_STATUS_UNDEFINED
488
489 @param status the new status value
490 */
491 virtual void xcom_set_comms_status(int status) = 0;
492
493 /*
494 This modifies the internal cached status to whatever value is delivered
495 by the XCom communication status callback. Then, it signals all threads
496 that might be waiting on xcom_wait_for_xcom_comms_status_change.
497
498 @param status the new status value
499 */
501
502 /**
503 @brief Call this method to wait for XCom to exit.
504
505 Call this method to wait for XCom to exit. It will block until XCom has
506 exit or an error occurs.
507
508 @return GCS_OK if success, otherwise GCS_NOK.
509 */
510
512
513 /**
514 This verifies if XCom has finished or not.
515 */
516
517 virtual bool xcom_is_exit() = 0;
518
519 /**
520 This sets whether XCom has finished or not.
521 */
522
523 virtual void xcom_set_exit(bool value) = 0;
524
525 /**
526 Clean up variables used to notify states in the XCOM's state
527 machine.
528 */
529 virtual void xcom_set_cleanup() = 0;
530
531 /**
532 This modifies the internal cached status and signals all threads
533 that might be waiting on xcom_wait_exit.
534 */
535
536 virtual void xcom_signal_exit() = 0;
537
538 /**
539 This method forces XCom to inject a new configuration in the group,
540 even if it does not contain a majority of members.
541
542 @param nl The list of nodes that will belong to this new configuration
543 @param group_id The identifier of the group from which the nodes will
544 belong
545 @returns true (false) on success (failure). Success means that XCom will
546 process our request, failure means it won't. There could be errors
547 later in the process of forcing the configuration. Since this is
548 basically an asynchronous function, one needs to wait for the
549 actual view change to validate that the configuration was forced.
550 */
551 virtual bool xcom_client_force_config(node_list *nl, uint32_t group_id) = 0;
552
553 /**
554 Function used to boot a node in XCOM.
555
556 @param node Node information.
557 @param group_id_hash Hash of group identifier.
558 @returns true (false) on success (failure). Success means that XCom will
559 process our request, failure means it won't. There could be errors
560 later in the process of booting. Since this is basically an
561 asynchronous function, one needs to wait for XCom to signal it is
562 ready to validate whether it booted.
563 */
565 uint32_t group_id_hash) = 0;
566
567 /**
568 Function to remove a set of nodes from XCOM.
569
570 @param nodes Set of nodes.
571 @param group_id_hash Hash of group identifier.
572 @returns true (false) on success (failure). Success means that XCom will
573 process our request, failure means it won't. There could be errors
574 later in the process of removing a node. Since this is basically an
575 asynchronous function, one needs to wait for the actual view change
576 to validate that the nodes were removed from the configuration.
577 */
578
580 uint32_t group_id_hash) = 0;
581
582 /**
583 Function to remove a set of nodes from XCOM.
584
585 @param con Connection to a node that will carry on the request.
586 @param nodes Set of nodes to remove.
587 @param group_id_hash Hash of group identifier.
588 @returns true (false) on success (failure). Success means that XCom will
589 process our request, failure means it won't. There could be errors
590 later in the process of removing a node. Since this is basically an
591 asynchronous function, one needs to wait for the actual view change
592 to validate that the nodes were removed from the configuration.
593 */
594
596 Gcs_xcom_nodes &nodes,
597 uint32_t group_id_hash) = 0;
598
599 /**
600 Function to remove a node from XCOM.
601
602 @param node Node information.
603 @param group_id_hash Hash of group identifier.
604 @returns true (false) on success (failure). Success means that XCom will
605 process our request, failure means it won't. There could be errors
606 later in the process of removing a node. Since this is basically an
607 asynchronous function, one needs to wait for the actual view change
608 to validate that the node was removed from the configuration.
609 */
610
612 uint32_t group_id_hash) = 0;
613
614 /**
615 Function to add a set of nodes to XCOM.
616
617 @param con Connection to a node that will carry on the request.
618 @param nodes Set of nodes.
619 @param group_id_hash Hash of group identifier.
620 @returns true (false) on success (failure). Success means that XCom will
621 process our request, failure means it won't. There could be errors
622 later in the process of adding a node. Since this is basically an
623 asynchronous function, one needs to wait for the actual view change
624 to validate that the nodes were added to the configuration.
625 */
626
628 uint32_t group_id_hash) = 0;
629
630 /**
631 Function to add a node to XCOM.
632
633 @param con Connection to a node that will carry on the request.
634 @param node Node information.
635 @param group_id_hash Hash of group identifier.
636 @returns true (false) on success (failure). Success means that XCom will
637 process our request, failure means it won't. There could be errors
638 later in the process of adding a node. Since this is basically an
639 asynchronous function, one needs to wait for the actual view change
640 to validate that the node was added to the configuration.
641 */
642
644 const Gcs_xcom_node_information &node,
645 uint32_t group_id_hash) = 0;
646
647 /**
648 Function to retrieve XCOM's minimum supported event horizon value.
649 */
650 virtual xcom_event_horizon xcom_get_minimum_event_horizon() = 0;
651
652 /**
653 Function to retrieve XCOM's maximum supported event horizon value.
654 */
655 virtual xcom_event_horizon xcom_get_maximum_event_horizon() = 0;
656
657 /**
658 Function to retrieve XCOM's event horizon.
659
660 @param[in] group_id_hash Hash of group identifier.
661 @param[out] event_horizon A reference to where the group's event horizon
662 value will be written to
663
664 @return true if successful, false otherwise
665 */
666 virtual bool xcom_get_event_horizon(uint32_t group_id_hash,
667 xcom_event_horizon &event_horizon) = 0;
668
669 /**
670 Function to retrieve the application payloads decided on a set of synodes.
671
672 @param[in] xcom_instance The XCom instance to connect to
673 @param[in] group_id_hash Hash of group identifier.
674 @param[in] synode_set The desired synodes
675 @param[out] reply Where the requested payloads will be written to
676 @returns true (false) on success (failure). Success means that XCom had the
677 requested payloads, which were written to @c reply.
678 */
680 Gcs_xcom_node_information const &xcom_instance, uint32_t group_id_hash,
681 const std::unordered_set<Gcs_xcom_synode> &synode_set,
682 synode_app_data_array &reply) = 0;
683
684 /**
685 Function to reconfigure XCOM's event horizon.
686
687 @param group_id_hash Hash of group identifier.
688 @param event_horizon Desired event horizon value.
689
690 @return true if successful, false otherwise
691 */
692 virtual bool xcom_set_event_horizon(uint32_t group_id_hash,
693 xcom_event_horizon event_horizon) = 0;
694
695 virtual bool xcom_set_leaders(uint32_t group_id_hash,
696 u_int nr_preferred_leaders,
697 char const *preferred_leaders[],
698 node_no max_nr_leaders) = 0;
699 virtual bool xcom_get_leaders(uint32_t group_id_hash,
700 leader_info_data &leaders) = 0;
701
702 /**
703 Function to reconfigure the maximum size of the XCom cache.
704
705 @param size Cache size limit.
706 @return true if the operation is successfully pushed to XCom's queue,
707 false otherwise
708 */
709 virtual bool xcom_set_cache_size(uint64_t size) = 0;
710
711 /**
712 Function to force the set of nodes in XCOM's configuration.
713
714 @param nodes Set of nodes.
715 @param group_id_hash Hash of group identifier.
716 @returns true (false) on success (failure). Success means that XCom will
717 process our request, failure means it won't. There could be errors
718 later in the process of forcing the configuration. Since this is
719 basically an asynchronous function, one needs to wait for the
720 actual view change to validate that the configuration was forced.
721 */
722
723 virtual bool xcom_force_nodes(Gcs_xcom_nodes &nodes,
724 unsigned int group_id_hash) = 0;
725
726 /**
727 Function that retrieves the value that signals that XCom
728 must be forcefully stopped.
729
730 @return 1 if XCom needs to forcefully exit. 0 otherwise.
731 */
732 virtual bool get_should_exit() = 0;
733
734 /**
735 Function that sets the value that signals that XCom
736 must be forcefully stopped.
737 */
738 virtual void set_should_exit(bool should_exit) = 0;
739
740 /**
741 * Opens the input channel to XCom.
742 *
743 * @param address address to connect to
744 * @param port port to connect to
745 * @retval true if successful
746 * @retval false otherwise
747 */
748 virtual bool xcom_input_connect(std::string const &address,
749 xcom_port port) = 0;
750
751 /**
752 * Closes the input channel to XCom.
753 */
754 virtual void xcom_input_disconnect() = 0;
755
756 /**
757 * Attempts to send the command @c data to XCom. (Called by GCS.)
758 *
759 * The function takes ownership of @c data.
760 *
761 * @pre The input channel to XCom is open, i.e. @c xcom_input_connect
762 * @param data the command to send to XCom
763 * @retval true if the command was sent to XCom
764 * @retval false if the command was not sent to XCom
765 */
766 virtual bool xcom_input_try_push(app_data_ptr data) = 0;
767
768 /**
769 * Attempts to send the command @c data to XCom, and returns a future to
770 * XCom's reply. (Called by GCS.)
771 *
772 * The function takes ownership of @c data.
773 *
774 * @pre The input channel to XCom is open, i.e. @c xcom_input_connect
775 * @param data the command to send to XCom
776 * @returns a future pointer to a Reply object if successful, a future pointer
777 * to nullptr otherwise
778 */
780 app_data_ptr data) = 0;
781
782 /**
783 * Attempts to retrieve incoming commands. (Called by XCom.)
784 *
785 * @pre The input channel to XCom is open, i.e. @c xcom_input_connect
786 * @retval app_data_ptr linked list of the queued commands if the queue is
787 * not empty
788 * @retval nullptr if the queue is empty
789 */
791
792 /**
793 * Performs a test connection to the given XCom instance via TCP.
794 *
795 * @param host the XCom instance's host
796 * @param port the XCom instance's port
797 * @returns true if we were able to successfully connect, false otherwise.
798 */
799 virtual bool test_xcom_tcp_connection(std::string &host, xcom_port port) = 0;
800
801 /**
802 * @brief Initializes XCom's Network Manager. This must be called to ensure
803 * that we have client connection abilities since the start of GCS.
804 *
805 * @return true in case of error, false otherwise.
806 */
807 virtual bool initialize_network_manager() = 0;
808
809 /**
810 * @brief Finalizes XCom's Network Manager. This cleans up everythins
811 * regarding network.
812 *
813 * @return true in case of error, false otherwise.
814 */
815 virtual bool finalize_network_manager() = 0;
816
817 /**
818 * @brief Set XCom's network manager active provider
819 *
820 * @param new_value the value of the Communication Stack to use.
821 *
822 * @return true in case of error, false otherwise.
823 */
825 enum_transport_protocol new_value) = 0;
826};
827
828/*
829 Virtual class that contains implementation of methods used to
830 map a node representation into XCOM's representation.
831 This layer becomes necessary to avoid duplicating code in test
832 cases.
833*/
835 public:
836 explicit Gcs_xcom_proxy_base() = default;
837 ~Gcs_xcom_proxy_base() override = default;
838
840 uint32_t group_id_hash) override;
842 uint32_t group_id_hash) override;
844 uint32_t group_id_hash) override;
846 uint32_t group_id_hash) override;
848 uint32_t group_id_hash) override;
850 const Gcs_xcom_node_information &node,
851 uint32_t group_id_hash) override;
852 xcom_event_horizon xcom_get_minimum_event_horizon() override;
853 xcom_event_horizon xcom_get_maximum_event_horizon() override;
854 bool xcom_get_event_horizon(uint32_t group_id_hash,
855 xcom_event_horizon &event_horizon) override;
856 bool xcom_set_event_horizon(uint32_t group_id_hash,
857 xcom_event_horizon event_horizon) override;
858 bool xcom_set_leaders(uint32_t group_id_hash, u_int nr_preferred_leaders,
859 char const *preferred_leaders[],
860 node_no max_nr_leaders) override;
861 bool xcom_get_leaders(uint32_t group_id_hash,
862 leader_info_data &leaders) override;
864 Gcs_xcom_node_information const &xcom_instance, uint32_t group_id_hash,
865 const std::unordered_set<Gcs_xcom_synode> &synode_set,
866 synode_app_data_array &reply) override;
867 bool xcom_set_cache_size(uint64_t size) override;
868 bool xcom_force_nodes(Gcs_xcom_nodes &nodes, uint32_t group_id_hash) override;
869
870 bool initialize_network_manager() override;
871 bool finalize_network_manager() override;
873 enum_transport_protocol new_value) override;
874
875 private:
876 /* Serialize information on nodes to be sent to XCOM */
877 bool serialize_nodes_information(Gcs_xcom_nodes &nodes, node_list &nl);
878
879 /* Free information on nodes sent to XCOM */
880 void free_nodes_information(node_list &nl);
881 bool test_xcom_tcp_connection(std::string &host, xcom_port port) override;
882};
883
884/**
885 @class gcs_xcom_control_proxy_impl
886
887 Implementation of gcs_xcom_control_proxy to be used by whom
888 instantiates Gcs_xcom_control_interface to be used in a real
889 scenario.
890*/
892 public:
893 explicit Gcs_xcom_proxy_impl();
894 Gcs_xcom_proxy_impl(unsigned int wt);
895 ~Gcs_xcom_proxy_impl() override;
896
897 node_address *new_node_address_uuid(unsigned int n, char const *names[],
898 blob uuids[]) override;
899 void delete_node_address(unsigned int n, node_address *na) override;
900 bool xcom_client_add_node(connection_descriptor *fd, node_list *nl,
901 uint32_t group_id) override;
902 bool xcom_client_remove_node(node_list *nl, uint32_t group_id) override;
903 bool xcom_client_remove_node(connection_descriptor *fd, node_list *nl,
904 uint32_t group_id) override;
906 uint32_t group_id, xcom_event_horizon &event_horizon) override;
907 bool xcom_client_set_event_horizon(uint32_t group_id,
908 xcom_event_horizon event_horizon) override;
909 bool xcom_client_set_leaders(uint32_t gid, u_int nr_preferred_leaders,
910 char const *preferred_leaders[],
911 node_no max_nr_leaders) override;
912 bool xcom_client_get_leaders(uint32_t gid,
913 leader_info_data &leaders) override;
914
916 uint32_t group_id_hash,
917 synode_no_array &synodes,
918 synode_app_data_array &reply) override;
919
920 bool xcom_client_set_cache_size(uint64_t size) override;
921 bool xcom_client_boot(node_list *nl, uint32_t group_id) override;
923 xcom_port port) override;
925 bool xcom_client_send_data(unsigned long long size, char *data) override;
926 void xcom_init(xcom_port listen_port) override;
927 void xcom_exit() override;
928 int xcom_get_ssl_mode(const char *mode) override;
929 int xcom_get_ssl_fips_mode(const char *mode) override;
930 int xcom_set_ssl_fips_mode(int mode) override;
931 int xcom_set_ssl_mode(int mode) override;
932 bool xcom_init_ssl() override;
933 void xcom_destroy_ssl() override;
934 bool xcom_use_ssl() override;
936 site_def const *find_site_def(synode_no synode) override;
937
939 bool xcom_is_ready() override;
940 void xcom_set_ready(bool value) override;
941 void xcom_signal_ready() override;
942
944 bool xcom_has_comms_status_changed() override;
945 void xcom_set_comms_status(int status) override;
946 void xcom_signal_comms_status_changed(int status) override;
947
949 bool xcom_is_exit() override;
950 void xcom_set_exit(bool value) override;
951 void xcom_signal_exit() override;
952
953 void xcom_set_cleanup() override;
954
955 bool xcom_client_force_config(node_list *nl, uint32_t group_id) override;
956 bool get_should_exit() override;
957 void set_should_exit(bool should_exit) override;
958
959 bool xcom_input_connect(std::string const &address, xcom_port port) override;
960 void xcom_input_disconnect() override;
961 bool xcom_input_try_push(app_data_ptr data) override;
963 app_data_ptr data) override;
965
966 private:
967 /*
968 Maximum waiting time used by timed_waits in xcom_wait_ready and
969 xcom_wait_for_xcom_comms_status_change.
970 */
971 unsigned int m_wait_time;
972
973 // For synchronization between XCom and MySQL GCS infrastructure at startup.
977
981
985
987
988 // Stores SSL parameters
990 const char *m_server_key_file;
992 const char *m_client_key_file;
994 const char *m_ca_file;
995 const char *m_ca_path;
996 const char *m_crl_file;
997 const char *m_crl_path;
998 const char *m_cipher;
999 const char *m_tls_version;
1001
1002 std::atomic_bool m_should_exit;
1003
1004 /* Input channel to XCom */
1006
1007 /*
1008 Auxiliary function for the "xcom_wait_*" functions. Executes the actual
1009 timed wait for the variable associated with the condition to be changed
1010 and performs error checking.
1011
1012 The function will lock @c condition_lock, so it must be unlocked when the
1013 function is called.
1014
1015 @param condition Cond variable on which we want to wait.
1016 @param condition_lock Lock to access the @c condition variable.
1017 @param need_to_wait A function implemented by the caller that verifies if
1018 the wait shall be executed. The function must return
1019 true when the wait must be executed, false otherwise.
1020 @param condition_event A function that returns the string identifying the
1021 event associated with the cond. The string will be
1022 printed as a suffix to the error messages:
1023 "<error code> while waiting for <cond_event string>"
1024 The function receives the error code of the timed
1025 wait as an argument.
1026
1027 @retval GCS_OK if the wait is successful;
1028 GCS_NOK if the timed wait terminates with an error.
1029 */
1031 My_xp_cond_impl &condition, My_xp_mutex_impl &condition_lock,
1032 std::function<bool(void)> need_to_wait,
1033 std::function<const std::string(int res)> condition_event);
1034
1035 /*
1036 Disabling the copy constructor and assignment operator.
1037 */
1040};
1041
1042/**
1043 A Gcs_xcom_interface needs to have an instance of this class
1044 initialized before engaging XCom.
1045 */
1047 public:
1048 explicit Gcs_xcom_app_cfg() = default;
1049
1050 virtual ~Gcs_xcom_app_cfg() = default;
1051
1052 /**
1053 Initializes the data structures to communicate with
1054 XCom the application injected configuration options.
1055 */
1056 void init();
1057
1058 /**
1059 Configures how many loops to spin before blocking on
1060 the poll system call.
1061 @param loops the number of spins.
1062 */
1063 void set_poll_spin_loops(unsigned int loops);
1064
1065 /**
1066 Configures the maximum size of the xcom cache.
1067 @param size the maximum size of the cache.
1068 */
1069 void set_xcom_cache_size(uint64_t size);
1070
1071 /**
1072 Configures XCom with its unique instance identifier, i.e. its (address,
1073 incarnation) pair.
1074
1075 Takes ownership of @c identity.
1076
1077 @param identity the unique identifier
1078 @retval true if there was an error configuring XCom
1079 @retval false if configuration was successful
1080 */
1081 bool set_identity(node_address *identity);
1082
1083 /**
1084 * @brief Sets the network namespace manager
1085 *
1086 * @param ns_mgr a reference to a Network_namespace_manager implementation
1087 */
1089
1090 /**
1091 * @brief Set XCom's.
1092 * statists storage implementation
1093 */
1095 Xcom_statistics_storage_interface *stats_storage);
1096
1097 /**
1098 Must be called when XCom is not engaged anymore.
1099 */
1100 void deinit();
1101};
1102
1105 unsigned int port;
1106};
1107
1108#endif /* GCS_XCOM_PROXY_INCLUDED */
A Gcs_xcom_interface needs to have an instance of this class initialized before engaging XCom.
Definition: gcs_xcom_proxy.h:1046
void set_poll_spin_loops(unsigned int loops)
Configures how many loops to spin before blocking on the poll system call.
Definition: gcs_xcom_proxy.cc:626
bool set_identity(node_address *identity)
Configures XCom with its unique instance identifier, i.e.
Definition: gcs_xcom_proxy.cc:644
void init()
Initializes the data structures to communicate with XCom the application injected configuration optio...
Definition: gcs_xcom_proxy.cc:622
virtual ~Gcs_xcom_app_cfg()=default
void deinit()
Must be called when XCom is not engaged anymore.
Definition: gcs_xcom_proxy.cc:624
void set_statists_storage_implementation(Xcom_statistics_storage_interface *stats_storage)
Set XCom's.
Definition: gcs_xcom_proxy.cc:639
void set_xcom_cache_size(uint64_t size)
Configures the maximum size of the xcom cache.
Definition: gcs_xcom_proxy.cc:630
Gcs_xcom_app_cfg()=default
void set_network_namespace_manager(Network_namespace_manager *ns_mgr)
Sets the network namespace manager.
Definition: gcs_xcom_proxy.cc:634
MPSC queue with FIFO semantics used to send commands to XCom.
Definition: gcs_xcom_input_queue.h:57
std::future< std::unique_ptr< Reply > > future_reply
Definition: gcs_xcom_input_queue.h:60
It represents a node within a group and is identified by the member identifier, unique identifier and...
Definition: gcs_xcom_group_member_information.h:193
This class contains information on the configuration, i.e set of nodes or simply site definition.
Definition: gcs_xcom_group_member_information.h:391
Definition: gcs_xcom_proxy.h:834
bool xcom_force_nodes(Gcs_xcom_nodes &nodes, uint32_t group_id_hash) override
Definition: gcs_xcom_proxy.cc:816
xcom_event_horizon xcom_get_minimum_event_horizon() override
Function to retrieve XCOM's minimum supported event horizon value.
Definition: gcs_xcom_proxy.cc:715
bool xcom_add_node(connection_descriptor &con, const Gcs_xcom_node_information &node, uint32_t group_id_hash) override
Function to add a node to XCOM.
Definition: gcs_xcom_proxy.cc:896
bool xcom_get_synode_app_data(Gcs_xcom_node_information const &xcom_instance, uint32_t group_id_hash, const std::unordered_set< Gcs_xcom_synode > &synode_set, synode_app_data_array &reply) override
Function to retrieve the application payloads decided on a set of synodes.
Definition: gcs_xcom_proxy.cc:780
xcom_event_horizon xcom_get_maximum_event_horizon() override
Function to retrieve XCOM's maximum supported event horizon value.
Definition: gcs_xcom_proxy.cc:719
bool test_xcom_tcp_connection(std::string &host, xcom_port port) override
Performs a test connection to the given XCom instance via TCP.
Definition: gcs_xcom_proxy.cc:905
bool serialize_nodes_information(Gcs_xcom_nodes &nodes, node_list &nl)
Definition: gcs_xcom_proxy.cc:831
bool xcom_get_leaders(uint32_t group_id_hash, leader_info_data &leaders) override
Definition: gcs_xcom_proxy.cc:748
~Gcs_xcom_proxy_base() override=default
bool xcom_add_nodes(connection_descriptor &con, Gcs_xcom_nodes &nodes, uint32_t group_id_hash) override
Function to add a set of nodes to XCOM.
Definition: gcs_xcom_proxy.cc:880
Gcs_xcom_proxy_base()=default
bool set_network_manager_active_provider(enum_transport_protocol new_value) override
Set XCom's network manager active provider.
Definition: gcs_xcom_proxy.cc:918
bool xcom_remove_nodes(Gcs_xcom_nodes &nodes, uint32_t group_id_hash) override
Function to remove a set of nodes from XCOM.
Definition: gcs_xcom_proxy.cc:678
void free_nodes_information(node_list &nl)
Definition: gcs_xcom_proxy.cc:857
bool xcom_boot_node(Gcs_xcom_node_information &node, uint32_t group_id_hash) override
Function used to boot a node in XCOM.
Definition: gcs_xcom_proxy.cc:863
bool xcom_set_event_horizon(uint32_t group_id_hash, xcom_event_horizon event_horizon) override
Function to reconfigure XCOM's event horizon.
Definition: gcs_xcom_proxy.cc:729
bool xcom_set_cache_size(uint64_t size) override
Function to reconfigure the maximum size of the XCom cache.
Definition: gcs_xcom_proxy.cc:811
bool xcom_set_leaders(uint32_t group_id_hash, u_int nr_preferred_leaders, char const *preferred_leaders[], node_no max_nr_leaders) override
Definition: gcs_xcom_proxy.cc:735
bool xcom_remove_node(const Gcs_xcom_node_information &node, uint32_t group_id_hash) override
Function to remove a node from XCOM.
Definition: gcs_xcom_proxy.cc:707
bool initialize_network_manager() override
Initializes XCom's Network Manager.
Definition: gcs_xcom_proxy.cc:910
bool xcom_get_event_horizon(uint32_t group_id_hash, xcom_event_horizon &event_horizon) override
Function to retrieve XCOM's event horizon.
Definition: gcs_xcom_proxy.cc:723
bool finalize_network_manager() override
Finalizes XCom's Network Manager.
Definition: gcs_xcom_proxy.cc:914
Definition: gcs_xcom_proxy.h:891
void xcom_signal_exit() override
This modifies the internal cached status and signals all threads that might be waiting on xcom_wait_e...
Definition: gcs_xcom_proxy.cc:526
bool get_should_exit() override
Function that retrieves the value that signals that XCom must be forcefully stopped.
Definition: gcs_xcom_proxy.cc:577
int m_ssl_mode
Definition: gcs_xcom_proxy.h:989
void xcom_exit() override
This member function finishes the XCom thread.
Definition: gcs_xcom_proxy.cc:251
const char * m_server_cert_file
Definition: gcs_xcom_proxy.h:991
void xcom_destroy_ssl() override
Definition: gcs_xcom_proxy.cc:299
enum_gcs_error xcom_wait_ready() override
This member waits for XCom to be initialized.
Definition: gcs_xcom_proxy.cc:465
void xcom_set_comms_status(int status) override
Definition: gcs_xcom_proxy.cc:564
bool xcom_client_set_leaders(uint32_t gid, u_int nr_preferred_leaders, char const *preferred_leaders[], node_no max_nr_leaders) override
This member function is responsible for triggering the reconfiguration of the leaders of the XCom con...
Definition: gcs_xcom_proxy.cc:129
const char * m_client_cert_file
Definition: gcs_xcom_proxy.h:993
node_address * new_node_address_uuid(unsigned int n, char const *names[], blob uuids[]) override
This is an utility member function that is used to call into XCom for creating list with node's addre...
Definition: gcs_xcom_proxy.cc:421
int xcom_get_ssl_fips_mode(const char *mode) override
Definition: gcs_xcom_proxy.cc:263
const char * m_tls_version
Definition: gcs_xcom_proxy.h:999
Gcs_xcom_proxy_impl(Gcs_xcom_proxy_impl const &)
bool xcom_is_exit() override
This verifies if XCom has finished or not.
Definition: gcs_xcom_proxy.cc:510
const char * m_crl_file
Definition: gcs_xcom_proxy.h:996
void set_should_exit(bool should_exit) override
Function that sets the value that signals that XCom must be forcefully stopped.
Definition: gcs_xcom_proxy.cc:581
enum_gcs_error xcom_wait_exit() override
Call this method to wait for XCom to exit.
Definition: gcs_xcom_proxy.cc:497
void xcom_set_cleanup() override
Clean up variables used to notify states in the XCOM's state machine.
Definition: gcs_xcom_proxy.cc:253
bool xcom_input_connect(std::string const &address, xcom_port port) override
Opens the input channel to XCom.
Definition: gcs_xcom_proxy.cc:585
bool xcom_client_close_connection(connection_descriptor *fd) override
This member function closes the connection to an XCom instance.
Definition: gcs_xcom_proxy.cc:46
My_xp_mutex_impl m_lock_xcom_comms_status
Definition: gcs_xcom_proxy.h:978
bool xcom_client_boot(node_list *nl, uint32_t group_id) override
This member function boots XCom.
Definition: gcs_xcom_proxy.cc:205
bool xcom_client_force_config(node_list *nl, uint32_t group_id) override
This method forces XCom to inject a new configuration in the group, even if it does not contain a maj...
Definition: gcs_xcom_proxy.cc:654
const char * m_ca_file
Definition: gcs_xcom_proxy.h:994
void xcom_wait_for_xcom_comms_status_change(int &status) override
Call this method to wait for XCom communications to be initialized.
Definition: gcs_xcom_proxy.cc:533
Gcs_xcom_input_queue m_xcom_input_queue
Definition: gcs_xcom_proxy.h:1005
site_def const * find_site_def(synode_no synode) override
Definition: gcs_xcom_proxy.cc:417
connection_descriptor * xcom_client_open_connection(std::string, xcom_port port) override
This member function opens a connection to an XCom instance.
Definition: gcs_xcom_proxy.cc:51
bool xcom_input_try_push(app_data_ptr data) override
Attempts to send the command data to XCom.
Definition: gcs_xcom_proxy.cc:599
bool xcom_client_add_node(connection_descriptor *fd, node_list *nl, uint32_t group_id) override
This member function is responsible to call into XCom consensus and add a node to the group.
Definition: gcs_xcom_proxy.cc:57
void xcom_set_ssl_parameters(ssl_parameters ssl, tls_parameters tls) override
Definition: gcs_xcom_proxy.cc:309
My_xp_cond_impl m_cond_xcom_ready
Definition: gcs_xcom_proxy.h:975
void xcom_set_ready(bool value) override
Definition: gcs_xcom_proxy.cc:484
void xcom_set_exit(bool value) override
This sets whether XCom has finished or not.
Definition: gcs_xcom_proxy.cc:520
bool xcom_use_ssl() override
Return whether the SSL will be used to encrypt data or not.
Definition: gcs_xcom_proxy.cc:303
int xcom_get_ssl_mode(const char *mode) override
Definition: gcs_xcom_proxy.cc:259
void xcom_input_disconnect() override
Closes the input channel to XCom.
Definition: gcs_xcom_proxy.cc:595
xcom_input_request_ptr xcom_input_try_pop() override
Attempts to retrieve incoming commands.
Definition: gcs_xcom_proxy.cc:618
const char * m_cipher
Definition: gcs_xcom_proxy.h:998
unsigned int m_wait_time
Definition: gcs_xcom_proxy.h:971
bool xcom_init_ssl() override
Initialize the SSL.
Definition: gcs_xcom_proxy.cc:276
const char * m_client_key_file
Definition: gcs_xcom_proxy.h:992
My_xp_cond_impl m_cond_xcom_exit
Definition: gcs_xcom_proxy.h:983
My_xp_socket_util * m_socket_util
Definition: gcs_xcom_proxy.h:986
Gcs_xcom_input_queue::future_reply xcom_input_try_push_and_get_reply(app_data_ptr data) override
Attempts to send the command data to XCom, and returns a future to XCom's reply.
Definition: gcs_xcom_proxy.cc:609
const char * m_crl_path
Definition: gcs_xcom_proxy.h:997
bool m_is_xcom_ready
Definition: gcs_xcom_proxy.h:976
void xcom_signal_ready() override
Definition: gcs_xcom_proxy.cc:490
~Gcs_xcom_proxy_impl() override
Definition: gcs_xcom_proxy.cc:404
int m_xcom_comms_status
Definition: gcs_xcom_proxy.h:980
My_xp_cond_impl m_cond_xcom_comms_status
Definition: gcs_xcom_proxy.h:979
bool xcom_client_remove_node(node_list *nl, uint32_t group_id) override
This member function is responsible for triggering the removal of a node from the XCom configuration.
Definition: gcs_xcom_proxy.cc:67
const char * m_server_key_file
Definition: gcs_xcom_proxy.h:990
Gcs_xcom_proxy_impl()
Definition: gcs_xcom_proxy.cc:326
bool xcom_client_set_cache_size(uint64_t size) override
This member function is responsible for setting a new value for the maximum size of the XCom cache.
Definition: gcs_xcom_proxy.cc:193
int xcom_set_ssl_mode(int mode) override
Definition: gcs_xcom_proxy.cc:268
const char * m_tls_ciphersuites
Definition: gcs_xcom_proxy.h:1000
void xcom_init(xcom_port listen_port) override
This member function initializes XCom.
Definition: gcs_xcom_proxy.cc:244
void xcom_signal_comms_status_changed(int status) override
Definition: gcs_xcom_proxy.cc:570
const char * m_ca_path
Definition: gcs_xcom_proxy.h:995
My_xp_mutex_impl m_lock_xcom_ready
Definition: gcs_xcom_proxy.h:974
void delete_node_address(unsigned int n, node_address *na) override
This function is responsible to delete the list of nodes that had been previously created by new_node...
Definition: gcs_xcom_proxy.cc:41
bool xcom_is_ready() override
Definition: gcs_xcom_proxy.cc:474
Gcs_xcom_proxy_impl & operator=(Gcs_xcom_proxy_impl const &)
std::atomic_bool m_should_exit
Definition: gcs_xcom_proxy.h:1002
bool xcom_client_send_data(unsigned long long size, char *data) override
This member function is responsible for pushing data into consensus on XCom.
Definition: gcs_xcom_proxy.cc:216
bool xcom_client_get_leaders(uint32_t gid, leader_info_data &leaders) override
This member function is responsible for retrieving the leaders of the XCom configuration.
Definition: gcs_xcom_proxy.cc:154
My_xp_mutex_impl m_lock_xcom_exit
Definition: gcs_xcom_proxy.h:982
bool xcom_client_get_event_horizon(uint32_t group_id, xcom_event_horizon &event_horizon) override
This member function is responsible for retrieving the event horizon of the XCom configuration.
Definition: gcs_xcom_proxy.cc:87
enum_gcs_error xcom_wait_for_condition(My_xp_cond_impl &condition, My_xp_mutex_impl &condition_lock, std::function< bool(void)> need_to_wait, std::function< const std::string(int res)> condition_event)
Definition: gcs_xcom_proxy.cc:427
bool m_is_xcom_exit
Definition: gcs_xcom_proxy.h:984
bool xcom_has_comms_status_changed() override
Definition: gcs_xcom_proxy.cc:554
int xcom_set_ssl_fips_mode(int mode) override
Definition: gcs_xcom_proxy.cc:272
bool xcom_client_set_event_horizon(uint32_t group_id, xcom_event_horizon event_horizon) override
This member function is responsible for triggering the reconfiguration of the event horizon of the XC...
Definition: gcs_xcom_proxy.cc:116
bool xcom_client_get_synode_app_data(connection_descriptor *con, uint32_t group_id_hash, synode_no_array &synodes, synode_app_data_array &reply) override
This member function is responsible for retrieving the application payloads decided in the synodes in...
Definition: gcs_xcom_proxy.cc:183
Definition: gcs_xcom_proxy.h:53
virtual enum_gcs_error xcom_wait_exit()=0
Call this method to wait for XCom to exit.
virtual bool xcom_client_add_node(connection_descriptor *fd, node_list *nl, uint32_t group_id)=0
This member function is responsible to call into XCom consensus and add a node to the group.
virtual void xcom_set_cleanup()=0
Clean up variables used to notify states in the XCOM's state machine.
virtual void xcom_set_ready(bool value)=0
virtual bool xcom_add_nodes(connection_descriptor &con, Gcs_xcom_nodes &nodes, uint32_t group_id_hash)=0
Function to add a set of nodes to XCOM.
virtual bool xcom_add_node(connection_descriptor &con, const Gcs_xcom_node_information &node, uint32_t group_id_hash)=0
Function to add a node to XCOM.
virtual xcom_event_horizon xcom_get_maximum_event_horizon()=0
Function to retrieve XCOM's maximum supported event horizon value.
virtual node_address * new_node_address_uuid(unsigned int n, char const *names[], blob uuids[])=0
This is an utility member function that is used to call into XCom for creating list with node's addre...
virtual site_def const * find_site_def(synode_no synode)=0
virtual void xcom_signal_exit()=0
This modifies the internal cached status and signals all threads that might be waiting on xcom_wait_e...
virtual bool xcom_has_comms_status_changed()=0
virtual void xcom_wait_for_xcom_comms_status_change(int &status)=0
Call this method to wait for XCom communications to be initialized.
virtual bool xcom_client_get_synode_app_data(connection_descriptor *fd, uint32_t group_id, synode_no_array &synodes, synode_app_data_array &reply)=0
This member function is responsible for retrieving the application payloads decided in the synodes in...
virtual bool xcom_is_exit()=0
This verifies if XCom has finished or not.
virtual bool xcom_client_get_event_horizon(uint32_t group_id, xcom_event_horizon &event_horizon)=0
This member function is responsible for retrieving the event horizon of the XCom configuration.
virtual int xcom_set_ssl_mode(int mode)=0
virtual bool xcom_boot_node(Gcs_xcom_node_information &node, uint32_t group_id_hash)=0
Function used to boot a node in XCOM.
virtual bool test_xcom_tcp_connection(std::string &host, xcom_port port)=0
Performs a test connection to the given XCom instance via TCP.
virtual bool xcom_get_event_horizon(uint32_t group_id_hash, xcom_event_horizon &event_horizon)=0
Function to retrieve XCOM's event horizon.
virtual int xcom_get_ssl_mode(const char *mode)=0
virtual void xcom_destroy_ssl()=0
virtual void xcom_exit()=0
This member function finishes the XCom thread.
virtual bool xcom_set_event_horizon(uint32_t group_id_hash, xcom_event_horizon event_horizon)=0
Function to reconfigure XCOM's event horizon.
virtual xcom_event_horizon xcom_get_minimum_event_horizon()=0
Function to retrieve XCOM's minimum supported event horizon value.
virtual void set_should_exit(bool should_exit)=0
Function that sets the value that signals that XCom must be forcefully stopped.
virtual bool xcom_get_synode_app_data(Gcs_xcom_node_information const &xcom_instance, uint32_t group_id_hash, const std::unordered_set< Gcs_xcom_synode > &synode_set, synode_app_data_array &reply)=0
Function to retrieve the application payloads decided on a set of synodes.
virtual bool xcom_client_close_connection(connection_descriptor *fd)=0
This member function closes the connection to an XCom instance.
virtual connection_descriptor * xcom_client_open_connection(std::string addr, xcom_port port)=0
This member function opens a connection to an XCom instance.
virtual bool xcom_client_remove_node(connection_descriptor *fd, node_list *nl, uint32_t group_id)=0
This member function is responsible for triggering the removal of a node from the XCom configuration.
virtual bool xcom_get_leaders(uint32_t group_id_hash, leader_info_data &leaders)=0
virtual bool xcom_remove_nodes(Gcs_xcom_nodes &nodes, uint32_t group_id_hash)=0
Function to remove a set of nodes from XCOM.
virtual bool xcom_remove_nodes(connection_descriptor &con, Gcs_xcom_nodes &nodes, uint32_t group_id_hash)=0
Function to remove a set of nodes from XCOM.
virtual bool xcom_init_ssl()=0
Initialize the SSL.
virtual bool xcom_client_force_config(node_list *nl, uint32_t group_id)=0
This method forces XCom to inject a new configuration in the group, even if it does not contain a maj...
virtual void xcom_signal_ready()=0
virtual void xcom_input_disconnect()=0
Closes the input channel to XCom.
virtual bool initialize_network_manager()=0
Initializes XCom's Network Manager.
virtual bool xcom_force_nodes(Gcs_xcom_nodes &nodes, unsigned int group_id_hash)=0
Function to force the set of nodes in XCOM's configuration.
virtual enum_gcs_error xcom_wait_ready()=0
This member waits for XCom to be initialized.
virtual bool finalize_network_manager()=0
Finalizes XCom's Network Manager.
virtual bool xcom_client_set_event_horizon(uint32_t group_id, xcom_event_horizon event_horizon)=0
This member function is responsible for triggering the reconfiguration of the event horizon of the XC...
virtual void xcom_set_comms_status(int status)=0
virtual int xcom_set_ssl_fips_mode(int mode)=0
virtual bool xcom_client_set_cache_size(uint64_t size)=0
This member function is responsible for setting a new value for the maximum size of the XCom cache.
virtual bool xcom_set_leaders(uint32_t group_id_hash, u_int nr_preferred_leaders, char const *preferred_leaders[], node_no max_nr_leaders)=0
virtual bool xcom_input_try_push(app_data_ptr data)=0
Attempts to send the command data to XCom.
virtual void xcom_signal_comms_status_changed(int status)=0
virtual void xcom_set_ssl_parameters(ssl_parameters ssl, tls_parameters tls)=0
virtual bool get_should_exit()=0
Function that retrieves the value that signals that XCom must be forcefully stopped.
virtual int xcom_get_ssl_fips_mode(const char *mode)=0
virtual bool xcom_set_cache_size(uint64_t size)=0
Function to reconfigure the maximum size of the XCom cache.
virtual bool xcom_remove_node(const Gcs_xcom_node_information &node, uint32_t group_id_hash)=0
Function to remove a node from XCOM.
virtual xcom_input_request_ptr xcom_input_try_pop()=0
Attempts to retrieve incoming commands.
virtual bool xcom_input_connect(std::string const &address, xcom_port port)=0
Opens the input channel to XCom.
Gcs_xcom_proxy()=default
virtual bool xcom_client_set_leaders(uint32_t group_id, u_int nr_preferred_leaders, char const *preferred_leaders[], node_no max_nr_leaders)=0
This member function is responsible for triggering the reconfiguration of the leaders of the XCom con...
virtual void delete_node_address(unsigned int n, node_address *na)=0
This function is responsible to delete the list of nodes that had been previously created by new_node...
virtual bool xcom_is_ready()=0
virtual bool set_network_manager_active_provider(enum_transport_protocol new_value)=0
Set XCom's network manager active provider.
virtual bool xcom_client_remove_node(node_list *nl, uint32_t group_id)=0
This member function is responsible for triggering the removal of a node from the XCom configuration.
virtual ~Gcs_xcom_proxy()=default
The destructor.
virtual void xcom_set_exit(bool value)=0
This sets whether XCom has finished or not.
virtual void xcom_init(xcom_port listen_port)=0
This member function initializes XCom.
virtual bool xcom_client_boot(node_list *nl, uint32_t group_id)=0
This member function boots XCom.
virtual bool xcom_client_send_data(unsigned long long size, char *data)=0
This member function is responsible for pushing data into consensus on XCom.
virtual bool xcom_use_ssl()=0
Return whether the SSL will be used to encrypt data or not.
virtual bool xcom_client_get_leaders(uint32_t group_id, leader_info_data &leaders)=0
This member function is responsible for retrieving the leaders of the XCom configuration.
virtual Gcs_xcom_input_queue::future_reply xcom_input_try_push_and_get_reply(app_data_ptr data)=0
Attempts to send the command data to XCom, and returns a future to XCom's reply.
Definition: my_xp_cond.h:136
Definition: my_xp_mutex.h:123
Interface for socket utility methods.
Definition: my_xp_util.h:154
Class that provides Network Namespace services.
Definition: network_provider.h:242
Interface class for all statistics that XCom will provide.
Definition: statistics_storage_interface.h:33
enum_gcs_error
This enumeration describes errors which can occur during group communication operations.
Definition: gcs_types.h:41
const char * host
Definition: mysqladmin.cc:65
constexpr value_type ssl
Definition: classic_protocol_constants.h:49
constexpr value_type blob
Definition: classic_protocol_constants.h:272
size_t size(const char *const c)
Definition: base64.h:46
mode
Definition: file_handle.h:61
Definition: tls_keylog_dumper.h:32
enum_transport_protocol
Enum that describes the available XCom Communication Stacks.
Definition: network_provider.h:45
required uint64 port
Definition: replication_asynchronous_connection_failover.proto:33
required uint32 status
Definition: replication_asynchronous_connection_failover.proto:61
Definition: gcs_xcom_proxy.h:1103
Gcs_xcom_proxy * proxy
Definition: gcs_xcom_proxy.h:1104
unsigned int port
Definition: gcs_xcom_proxy.h:1105
Definition: node_connection.h:47
Definition: site_struct.h:43
Definition: network_provider.h:171
Definition: network_provider.h:183
Definition: xcom_input_request.cc:31
__u_int u_int
Definition: types.h:73
int n
Definition: xcom_base.cc:509
unsigned short xcom_port
Definition: xcom_common.h:46