Clone of PhatAC @ https://github.com/floaterxk/PhatAC

plugin_group_replication.h 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software Foundation,
  11. 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
  12. #ifndef MYSQL_PLUGIN_GROUP_REPLICATION_INCLUDED
  13. #define MYSQL_PLUGIN_GROUP_REPLICATION_INCLUDED
  14. /* API for Group Peplication plugin. (MYSQL_GROUP_REPLICATION_PLUGIN) */
  15. #include <mysql/plugin.h>
  16. #define MYSQL_GROUP_REPLICATION_INTERFACE_VERSION 0x0101
  17. /*
  18. Callbacks for get_connection_status_info function.
  19. context field can have NULL value, plugin will always pass it
  20. through all callbacks, independent of its value.
  21. Its value will not be used by plugin.
  22. All callbacks are mandatory.
  23. */
  24. typedef struct st_group_replication_connection_status_callbacks
  25. {
  26. void* const context;
  27. void (*set_channel_name)(void* const context, const char& value, size_t length);
  28. void (*set_group_name)(void* const context, const char& value, size_t length);
  29. void (*set_source_uuid)(void* const context, const char& value, size_t length);
  30. void (*set_service_state)(void* const context, bool state);
  31. } GROUP_REPLICATION_CONNECTION_STATUS_CALLBACKS;
  32. /*
  33. Callbacks for get_group_members_info function.
  34. context field can have NULL value, plugin will always pass it
  35. through all callbacks, independent of its value.
  36. Its value will not be used by plugin.
  37. All callbacks are mandatory.
  38. */
  39. typedef struct st_group_replication_group_members_callbacks
  40. {
  41. void* const context;
  42. void (*set_channel_name)(void* const context, const char& value, size_t length);
  43. void (*set_member_id)(void* const context, const char& value, size_t length);
  44. void (*set_member_host)(void* const context, const char& value, size_t length);
  45. void (*set_member_port)(void* const context, unsigned int value);
  46. void (*set_member_state)(void* const context, const char& value, size_t length);
  47. } GROUP_REPLICATION_GROUP_MEMBERS_CALLBACKS;
  48. /*
  49. Callbacks for get_group_member_stats_info function.
  50. context field can have NULL value, plugin will always pass it
  51. through all callbacks, independent of its value.
  52. Its value will not be used by plugin.
  53. All callbacks are mandatory.
  54. */
  55. typedef struct st_group_replication_member_stats_callbacks
  56. {
  57. void* const context;
  58. void (*set_channel_name)(void* const context, const char& value, size_t length);
  59. void (*set_view_id)(void* const context, const char& value, size_t length);
  60. void (*set_member_id)(void* const context, const char& value, size_t length);
  61. void (*set_transactions_committed)(void* const context, const char& value, size_t length);
  62. void (*set_last_conflict_free_transaction)(void* const context, const char& value, size_t length);
  63. void (*set_transactions_in_queue)(void* const context, unsigned long long int value);
  64. void (*set_transactions_certified)(void* const context, unsigned long long int value);
  65. void (*set_transactions_conflicts_detected)(void* const context, unsigned long long int value);
  66. void (*set_transactions_rows_in_validation)(void* const context, unsigned long long int value);
  67. } GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS;
  68. struct st_mysql_group_replication
  69. {
  70. int interface_version;
  71. /*
  72. This function is used to start the group replication.
  73. */
  74. int (*start)();
  75. /*
  76. This function is used to stop the group replication.
  77. */
  78. int (*stop)();
  79. /*
  80. This function is used to get the current group replication running status.
  81. */
  82. bool (*is_running)();
  83. /*
  84. This function initializes conflict checking module with info received
  85. from group on this member.
  86. @param info View_change_log_event with conflict checking info.
  87. */
  88. int (*set_retrieved_certification_info)(void* info);
  89. /*
  90. This function is used to fetch information for group replication kernel stats.
  91. @param callbacks The set of callbacks and its context used to set the
  92. information on caller.
  93. @note The caller is responsible to free memory from the info structure and
  94. from all its fields.
  95. */
  96. bool (*get_connection_status_info)
  97. (const GROUP_REPLICATION_CONNECTION_STATUS_CALLBACKS& callbacks);
  98. /*
  99. This function is used to fetch information for group replication members.
  100. @param callbacks The set of callbacks and its context used to set the
  101. information on caller.
  102. @note The caller is responsible to free memory from the info structure and
  103. from all its fields.
  104. */
  105. bool (*get_group_members_info)
  106. (unsigned int index,
  107. const GROUP_REPLICATION_GROUP_MEMBERS_CALLBACKS& callbacks);
  108. /*
  109. This function is used to fetch information for group replication members statistics.
  110. @param callbacks The set of callbacks and its context used to set the
  111. information on caller.
  112. @note The caller is responsible to free memory from the info structure and
  113. from all its fields.
  114. */
  115. bool (*get_group_member_stats_info)
  116. (const GROUP_REPLICATION_GROUP_MEMBER_STATS_CALLBACKS& callbacks);
  117. /*
  118. Get number of group replication members.
  119. */
  120. unsigned int (*get_members_number_info)();
  121. };
  122. #endif