quorum_model_initialize.3.in 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. .\"/*
  2. .\" * Copyright (c) 2012-2020 Red Hat, Inc.
  3. .\" *
  4. .\" * All rights reserved.
  5. .\" *
  6. .\" * Authors: Jan Friesse <jfriesse@redhat.com>
  7. .\" * Fabio M. Di Nitto <fdinitto@redhat.com>
  8. .\" *
  9. .\" * This software licensed under BSD license, the text of which follows:
  10. .\" *
  11. .\" * Redistribution and use in source and binary forms, with or without
  12. .\" * modification, are permitted provided that the following conditions are met:
  13. .\" *
  14. .\" * - Redistributions of source code must retain the above copyright notice,
  15. .\" * this list of conditions and the following disclaimer.
  16. .\" * - Redistributions in binary form must reproduce the above copyright notice,
  17. .\" * this list of conditions and the following disclaimer in the documentation
  18. .\" * and/or other materials provided with the distribution.
  19. .\" * - Neither the name of the MontaVista Software, Inc. nor the names of its
  20. .\" * contributors may be used to endorse or promote products derived from this
  21. .\" * software without specific prior written permission.
  22. .\" *
  23. .\" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  24. .\" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25. .\" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26. .\" * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  27. .\" * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  28. .\" * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29. .\" * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  30. .\" * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  31. .\" * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  32. .\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  33. .\" * THE POSSIBILITY OF SUCH DAMAGE.
  34. .\" */
  35. .TH QUORUM_MODEL_INITIALIZE 3 @BUILDDATE@ "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
  36. .SH NAME
  37. quorum_model_initialize \- Create a new connection to the Quorum service
  38. .SH SYNOPSIS
  39. .B #include <corosync/quorum.h>
  40. .sp
  41. .BI "cs_error_t quorum_model_initialize(quorum_handle_t *" handle ", quorum_model_t " model ", quorum_model_data_t *" model_data ", uint32_t *" quorum_type ",void *" context ");"
  42. .SH DESCRIPTION
  43. The
  44. .B quorum_model_initialize
  45. function is an enhanced way to initialize a connection to the quorum API.
  46. .PP
  47. Each application may have several connections to the quorum API. Each application
  48. uses the
  49. .I handle
  50. argument to uniquely identify the connection. The
  51. .I handle
  52. argument is then used in other function calls to identify the connection to be used
  53. for communication with the quorum service.
  54. .PP
  55. The
  56. .I model
  57. is used to explicitly choose set of callbacks and internal parameters. Currently two models
  58. .I QUORUM_MODEL_V0
  59. and
  60. .I QUORUM_MODEL_V1
  61. are defined.
  62. .I QUORUM_MODEL_V0
  63. exists only for compatibility reasons with
  64. .B quorum_initialize(3)
  65. function and it is not recommended to be used as an argument for
  66. .B quorum_model_initialize(3).
  67. The Following description is focused only on
  68. .I QUORUM_MODEL_V1
  69. model.
  70. .PP
  71. Every time the voting configuration changes (eg a node joins or leave the cluster) or the quorum status changes
  72. the quorum callback is called.
  73. The quorum callback function is described by the following type definitions:
  74. .nf
  75. typedef void (*quorum_v1_quorum_notification_fn_t) (
  76. quorum_handle_t handle,
  77. uint32_t quorate,
  78. struct quorum_ring_id ring_id,
  79. uint32_t member_list_entries,
  80. const uint32_t *member_list
  81. );
  82. .fi
  83. .PP
  84. Also every time when membership configuration changes (eg a node joins or leave the cluster) the node list change
  85. callback is called before the quorum callback.
  86. The node list change callback function is described by the following type definitions:
  87. .nf
  88. typedef void (*quorum_v1_nodelist_notification_fn_t) (
  89. quorum_handle_t handle,
  90. struct quorum_ring_id ring_id,
  91. uint32_t member_list_entries,
  92. const uint32_t *member_list,
  93. uint32_t joined_list_entries,
  94. const uint32_t *joined_list,
  95. uint32_t left_list_entries,
  96. const uint32_t *left_list
  97. );
  98. .fi
  99. .PP
  100. The
  101. .I model_data
  102. argument for
  103. .I QUORUM_MODEL_V1
  104. is of the type:
  105. .nf
  106. typedef struct {
  107. quorum_model_t model;
  108. quorum_v1_quorum_notification_fn_t quorum_notify_fn;
  109. quorum_v1_nodelist_notification_fn_t nodelist_notify_fn;
  110. } quorum_model_v1_data_t;
  111. .fi
  112. It's not required (nor recommended) to set
  113. .I model
  114. field in the structure. It is also fine if only some of notification callbacks are
  115. used (only these events will be delivered then).
  116. .PP
  117. The
  118. .I quorum_type
  119. argument is set to:
  120. .nf
  121. #define QUORUM_FREE 0
  122. #define QUORUM_SET 1
  123. .fi
  124. .PP
  125. .I QUORUM_FREE
  126. value means that no quorum algorithm is loaded and that no callbacks will take place.
  127. .PP
  128. .I QUORUM_SET
  129. value means that one quorum algorithm is configured and that callbacks will take place.
  130. .PP
  131. The
  132. .I context
  133. argument sets context same way as
  134. .B quorum_context_set(3).
  135. .PP
  136. When a configuration change occurs, the callback
  137. is called from the
  138. .B quorum_dispatch(3)
  139. function.
  140. .PP
  141. .SH RETURN VALUE
  142. This call returns the CS_OK value if successful, otherwise an error is returned.
  143. .PP
  144. .SH ERRORS
  145. @COMMONIPCERRORS@
  146. .SH "SEE ALSO"
  147. .BR quorum_overview (3),
  148. .BR quorum_initialize (3),
  149. .BR quorum_finalize (3),
  150. .BR quorum_getquorate (3),
  151. .BR quorum_trackstart (3),
  152. .BR quorum_trackstop (3),
  153. .BR quorum_fd_get (3),
  154. .BR quorum_dispatch (3),
  155. .BR quorum_context_set (3),
  156. .BR quorum_context_get (3)
  157. .PP