|
19 | 19 | /* API for Group Peplication plugin. (MYSQL_GROUP_REPLICATION_PLUGIN) */
|
20 | 20 |
|
21 | 21 | #include <mysql/plugin.h>
|
22 |
| -#define MYSQL_GROUP_REPLICATION_INTERFACE_VERSION 0x0100 |
| 22 | +#define MYSQL_GROUP_REPLICATION_INTERFACE_VERSION 0x0101 |
23 | 23 |
|
24 |
| -enum enum_member_state { |
25 |
| - MEMBER_STATE_ONLINE= 1, |
26 |
| - MEMBER_STATE_OFFLINE, |
27 |
| - MEMBER_STATE_RECOVERING |
28 |
| -}; |
| 24 | +/* |
| 25 | + Callbacks for get_connection_status_info function. |
29 | 26 |
|
30 |
| -typedef struct st_group_replication_connection_status_info |
31 |
| -{ |
32 |
| - char* channel_name; |
33 |
| - char* group_name; |
34 |
| - bool service_state; |
35 |
| -} GROUP_REPLICATION_CONNECTION_STATUS_INFO; |
| 27 | + context field can have NULL value, plugin will always pass it |
| 28 | + through all callbacks, independent of its value. |
| 29 | + Its value will not be used by plugin. |
36 | 30 |
|
37 |
| -typedef struct st_group_replication_group_members_info |
| 31 | + All callbacks are mandatory. |
| 32 | +*/ |
| 33 | +typedef struct st_group_replication_connection_status_callbacks |
| 34 | +{ |
| 35 | + void* const context; |
| 36 | + void (*set_channel_name)(void* const context, const char& value, size_t length); |
| 37 | + void (*set_group_name)(void* const context, const char& value, size_t length); |
| 38 | + void (*set_source_uuid)(void* const context, const char& value, size_t length); |
| 39 | + void (*set_service_state)(void* const context, bool state); |
| 40 | +} GROUP_REPLICATION_CONNECTION_STATUS_CALLBACKS; |
| 41 | + |
| 42 | +/* |
| 43 | + Callbacks for get_group_members_info function. |
| 44 | +
|
| 45 | + context field can have NULL value, plugin will always pass it |
| 46 | + through all callbacks, independent of its value. |
| 47 | + Its value will not be used by plugin. |
| 48 | +
|
| 49 | + All callbacks are mandatory. |
| 50 | +*/ |
| 51 | +typedef struct st_group_replication_group_members_callbacks |
38 | 52 | {
|
39 |
| - char* channel_name; |
40 |
| - char* member_id; |
41 |
| - char* member_host; |
42 |
| - unsigned int member_port; |
43 |
| - enum enum_member_state member_state; |
44 |
| -} GROUP_REPLICATION_GROUP_MEMBERS_INFO; |
45 |
| - |
46 |
| -typedef struct st_group_replication_member_stats_info |
| 53 | + void* const context; |
| 54 | + void (*set_channel_name)(void* const context, const char& value, size_t length); |
| 55 | + void (*set_member_id)(void* const context, const char& value, size_t length); |
| 56 | + void (*set_member_host)(void* const context, const char& value, size_t length); |
| 57 | + void (*set_member_port)(void* const context, unsigned int value); |
| 58 | + void (*set_member_state)(void* const context, const char& value, size_t length); |
| 59 | +} GROUP_REPLICATION_GROUP_MEMBERS_CALLBACKS; |
| 60 | + |
| 61 | +/* |
| 62 | + Callbacks for get_group_member_stats_info function. |
| 63 | +
|
| 64 | + context field can have NULL value, plugin will always pass it |
| 65 | + through all callbacks, independent of its value. |
| 66 | + Its value will not be used by plugin. |
| 67 | +
|
| 68 | + All callbacks are mandatory. |
| 69 | +*/ |
| 70 | +typedef struct st_group_replication_member_stats_callbacks |
47 | 71 | {
|
48 |
| - char* channel_name; |
49 |
| - char* view_id; |
50 |
| - char* member_id; |
51 |
| - unsigned long long int transaction_in_queue; |
52 |
| - unsigned long long int transaction_certified; |
53 |
| - unsigned long long int transaction_conflicts_detected; |
54 |
| - unsigned long long int transactions_in_validation; |
55 |
| - char* committed_transactions; |
56 |
| - char* last_conflict_free_transaction; |
57 |
| -} GROUP_REPLICATION_GROUP_MEMBER_STATS_INFO; |
| 72 | + void* const context; |
| 73 | + void (*set_channel_name)(void* const context, const char& value, size_t length); |
| 74 | + void (*set_view_id)(void* const context, const char& value, size_t length); |
| 75 | + void (*set_member_id)(void* const context, const char& value, size_t length); |
| 76 | + void (*set_transactions_committed)(void* const context, const char& value, size_t length); |
| 77 | + void (*set_last_conflict_free_transaction)(void* const context, const char& value, size_t length); |
| 78 | + void (*set_transactions_in_queue)(void* const context, unsigned long long int value); |
| 79 | + void (*set_transactions_certified)(void* const context, unsigned long long int value); |
| 80 | + void (*set_transactions_conflicts_detected)(void* const context, unsigned long long int value); |
| 81 | + void (*set_transactions_in_validation)(void* const context, unsigned long long int value); |
| 82 | +} GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS; |
58 | 83 |
|
59 | 84 | struct st_mysql_group_replication
|
60 | 85 | {
|
@@ -83,32 +108,39 @@ struct st_mysql_group_replication
|
83 | 108 | /*
|
84 | 109 | This function is used to fetch information for group replication kernel stats.
|
85 | 110 |
|
86 |
| - @param info[out] The retrieved information |
| 111 | + @param callbacks The set of callbacks and its context used to set the |
| 112 | + information on caller. |
87 | 113 |
|
88 | 114 | @note The caller is responsible to free memory from the info structure and
|
89 | 115 | from all its fields.
|
90 | 116 | */
|
91 |
| - bool (*get_connection_status_info)(GROUP_REPLICATION_CONNECTION_STATUS_INFO *info); |
| 117 | + bool (*get_connection_status_info) |
| 118 | + (const GROUP_REPLICATION_CONNECTION_STATUS_CALLBACKS& callbacks); |
92 | 119 |
|
93 | 120 | /*
|
94 | 121 | This function is used to fetch information for group replication members.
|
95 | 122 |
|
96 |
| - @param info[out] The retrieved information |
| 123 | + @param callbacks The set of callbacks and its context used to set the |
| 124 | + information on caller. |
97 | 125 |
|
98 | 126 | @note The caller is responsible to free memory from the info structure and
|
99 | 127 | from all its fields.
|
100 | 128 | */
|
101 |
| - bool (*get_group_members_info)(unsigned int index, GROUP_REPLICATION_GROUP_MEMBERS_INFO *info); |
| 129 | + bool (*get_group_members_info) |
| 130 | + (unsigned int index, |
| 131 | + const GROUP_REPLICATION_GROUP_MEMBERS_CALLBACKS& callbacks); |
102 | 132 |
|
103 | 133 | /*
|
104 | 134 | This function is used to fetch information for group replication members statistics.
|
105 | 135 |
|
106 |
| - @param info[out] The retrieved information |
| 136 | + @param callbacks The set of callbacks and its context used to set the |
| 137 | + information on caller. |
107 | 138 |
|
108 | 139 | @note The caller is responsible to free memory from the info structure and
|
109 | 140 | from all its fields.
|
110 | 141 | */
|
111 |
| - bool (*get_group_member_stats_info)(GROUP_REPLICATION_GROUP_MEMBER_STATS_INFO* info); |
| 142 | + bool (*get_group_member_stats_info) |
| 143 | + (const GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS& callbacks); |
112 | 144 |
|
113 | 145 | /*
|
114 | 146 | Get number of group replication members.
|
|
0 commit comments