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