MySQL 9.0.0
Source Code Documentation
group_member_status_listener.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 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 GROUP_MEMBER_STATUS_LISTENER_H
25#define GROUP_MEMBER_STATUS_LISTENER_H
26
28
29/**
30 A service that listens for notifications about member state
31 or member role updates.
32*/
33BEGIN_SERVICE_DEFINITION(group_member_status_listener)
34/**
35 This function SHALL be called whenever the role of a member
36 changes.
37
38 The implementation SHALL consume the notification and
39 return false on success, true on failure.
40
41 The implementation MUST NOT block the caller. It MUST
42 handle the notification quickly or enqueue it and deal
43 with it asynchronously.
44
45 Currently the server can have one of two roles in group
46 replication, when setup in single primary mode: PRIMARY
47 or SECONDARY.
48
49 @param view_id The view identifier. This must be copied
50 if the string must outlive the notification
51 lifecycle.
52
53 @return false success, true on failure.
54*/
55DECLARE_BOOL_METHOD(notify_member_role_change, (const char *view_id));
56
57/**
58 This function SHALL be called whenever the state of a member
59 changes.
60
61 The implementation SHALL consume the notification and
62 return false on success, true on failure.
63
64 The implementation MUST NOT block the caller. It MUST
65 handle the notification quickly or enqueue it and deal
66 with it asynchronously.
67
68 A state is one of OFFLINE, ONLINE, RECOVERING, UNREACHABLE,
69 ERROR.
70
71 @param view_id The view identifier. This must be copied
72 if the string must outlive the notification
73 lifecycle.
74
75 @return false success, true on failure.
76*/
77DECLARE_BOOL_METHOD(notify_member_state_change, (const char *view_id));
78END_SERVICE_DEFINITION(group_member_status_listener)
79
80#endif /* GROUP_MEMBER_STATUS_LISTENER_H */
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:91
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:86
#define DECLARE_BOOL_METHOD(name, args)
Declares a method that returns bool as a part of the Service definition.
Definition: service.h:112