MySQL 8.0.31
Source Code Documentation
group_replication_status_service.h
Go to the documentation of this file.
1/* Copyright (c) 2021, 2022, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef GROUP_REPLICATION_STATUS_SERVICE_H
24#define GROUP_REPLICATION_STATUS_SERVICE_H
25
27#include <stddef.h>
28
29/**
30 @ingroup group_components_services_inventory
31
32 A service to get the status of a member of Group Replication.
33
34 This is only available if the component is on a server with Group
35 Replication plugin installed.
36
37 @code
38 SERVICE_TYPE(registry) *plugin_registry = mysql_plugin_registry_acquire();
39 my_service<SERVICE_TYPE(group_replication_status_service_v1)> svc(
40 "group_replication_status_service_v1", plugin_registry);
41
42 if (svc.is_valid()) {
43 bool error = svc->...
44 }
45 @endcode
46*/
47BEGIN_SERVICE_DEFINITION(group_replication_status_service_v1)
48
49/**
50 Checks if this member is part of a group in single-primary mode.
51
52 @return status
53 @retval true this member is part of a group in single-primary mode
54 @retval false otherwise (including case where member is even not running
55 Group Replication)
56*/
57DECLARE_BOOL_METHOD(is_group_in_single_primary_mode, ());
58
59/**
60 Checks if this member is part of a group in single-primary mode and if
61 this member is the primary.
62
63 @return status
64 @retval true this member is part of a group in single-primary mode
65 and is the primary
66 @retval false otherwise
67*/
68DECLARE_BOOL_METHOD(is_group_in_single_primary_mode_and_im_the_primary, ());
69
70/**
71 Checks if this member is part of a group in single-primary mode and if
72 this member is a secondary.
73
74 @return status
75 @retval true this member is part of a group in single-primary mode
76 and is a secondary
77 @retval false otherwise
78*/
79DECLARE_BOOL_METHOD(is_group_in_single_primary_mode_and_im_a_secondary, ());
80
81/**
82 Checks if this member is ONLINE and part of the group majority.
83
84 @return status
85 @retval true this member is ONLINE and part of the group majority
86 @retval false otherwise
87*/
88DECLARE_BOOL_METHOD(is_member_online_with_group_majority, ());
89
90END_SERVICE_DEFINITION(group_replication_status_service_v1)
91
92#endif /* GROUP_REPLICATION_STATUS_SERVICE_H */
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:90
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:85
#define DECLARE_BOOL_METHOD(name, args)
Declares a method that returns bool as a part of the Service definition.
Definition: service.h:111