MySQL 9.0.0
Source Code Documentation
gcs_control_event_listener.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 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_CONTROL_EVENT_LISTENER_INCLUDED
25#define GCS_CONTROL_EVENT_LISTENER_INCLUDED
26
27#include <utility>
28#include <vector>
29
32
33/**
34 Alias for the Data exchanged and delivered from all nodes.
35
36 It shall contain any entry from every member that handed out its data
37 for a joining node.
38*/
39typedef std::vector<std::pair<Gcs_member_identifier *, Gcs_message_data *>>
41
42/**
43 @class Gcs_control_event_listener
44
45 This interface is implemented by those who wish to receive Control Interface
46 notifications. Currently, it informs about View Changes, delivering the
47 underlying installed view.
48
49 For a working example, please refer to the documentation in
50 Gcs_communication_interface.
51*/
53 public:
54 /**
55 This method is called when the view is ready to be installed.
56
57 The contents of Exchanged_data will be released by MySQL GCS
58 after this handler finishes. Therefore the application MUST
59 copy the contents of exchanged_data if it needs it at a later
60 stage.
61
62 @param[in] new_view a reference to the new view.
63 @param[in] exchanged_data the data handed out by other members.
64 */
65
66 virtual void on_view_changed(const Gcs_view &new_view,
67 const Exchanged_data &exchanged_data) const = 0;
68
69 /**
70 This method is called when the Data Exchange is about to happen in order
71 for the client to provide which data it wants to exchange with the group.
72
73 @return a reference to the exchangeable data. This is a pointer that must
74 be deallocated by the caller, so please provide always a copy of
75 the data to exchange.
76 */
77
79
80 /**
81 This member function is called when the set of suspicions
82 has changed in the underlying communication infrastructure.
83
84 @param[in] members Contains the list of all members that are in the
85 current view.
86 @param[in] unreachable Contains the list of members that are
87 unreachable in the current view, i.e., a subset
88 of @c members.
89 */
90 virtual void on_suspicions(
91 const std::vector<Gcs_member_identifier> &members,
92 const std::vector<Gcs_member_identifier> &unreachable) const = 0;
93
94 virtual ~Gcs_control_event_listener() = default;
95};
96
97#endif // GCS_CONTROL_EVENT_LISTENER_INCLUDED
This interface is implemented by those who wish to receive Control Interface notifications.
Definition: gcs_control_event_listener.h:52
virtual Gcs_message_data * get_exchangeable_data() const =0
This method is called when the Data Exchange is about to happen in order for the client to provide wh...
virtual void on_suspicions(const std::vector< Gcs_member_identifier > &members, const std::vector< Gcs_member_identifier > &unreachable) const =0
This member function is called when the set of suspicions has changed in the underlying communication...
virtual void on_view_changed(const Gcs_view &new_view, const Exchanged_data &exchanged_data) const =0
This method is called when the view is ready to be installed.
virtual ~Gcs_control_event_listener()=default
This class serves as data container for information flowing in the GCS ecosystem.
Definition: gcs_message.h:48
This represents the membership view that a member has from a group.
Definition: gcs_view.h:55
std::vector< std::pair< Gcs_member_identifier *, Gcs_message_data * > > Exchanged_data
Alias for the Data exchanged and delivered from all nodes.
Definition: gcs_control_event_listener.h:40