plugin_group_replication.h 6.0 KB

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