votequorum_initialize.3.in 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. .\"/*
  2. .\" * Copyright (c) 2009,2012 Red Hat, Inc.
  3. .\" *
  4. .\" * All rights reserved.
  5. .\" *
  6. .\" * Author: Christine Caulfield <ccaulfie@redhat.com>
  7. .\" *
  8. .\" * This software licensed under BSD license, the text of which follows:
  9. .\" *
  10. .\" * Redistribution and use in source and binary forms, with or without
  11. .\" * modification, are permitted provided that the following conditions are met:
  12. .\" *
  13. .\" * - Redistributions of source code must retain the above copyright notice,
  14. .\" * this list of conditions and the following disclaimer.
  15. .\" * - Redistributions in binary form must reproduce the above copyright notice,
  16. .\" * this list of conditions and the following disclaimer in the documentation
  17. .\" * and/or other materials provided with the distribution.
  18. .\" * - Neither the name of the MontaVista Software, Inc. nor the names of its
  19. .\" * contributors may be used to endorse or promote products derived from this
  20. .\" * software without specific prior written permission.
  21. .\" *
  22. .\" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23. .\" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. .\" * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. .\" * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  26. .\" * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  27. .\" * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  28. .\" * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  29. .\" * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  30. .\" * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  31. .\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  32. .\" * THE POSSIBILITY OF SUCH DAMAGE.
  33. .\" */
  34. .TH VOTEQUORUM_INITIALIZE 3 @BUILDDATE@ "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
  35. .SH NAME
  36. votequorum_initialize \- Create a new connection to the VoteQuorum service
  37. .SH SYNOPSIS
  38. .B #include <corosync/votequorum.h>
  39. .sp
  40. .BI "int votequorum_initialize(votequorum_handle_t *" handle ", votequorum_callbacks_t *" callbacks ");"
  41. .SH DESCRIPTION
  42. The
  43. .B votequorum_initialize
  44. function is used to initialize a connection to the vote-based quorum database API.
  45. .PP
  46. Each application may have several connections to the votequorum API. Each application
  47. uses the
  48. .I handle
  49. argument to uniquely identify the connection. The
  50. .I handle
  51. argument is then used in other function calls to identify the connection to be used
  52. for communication with the votequorum service.
  53. .PP
  54. Every time the voting configuration is about to change (eg a node joins or leave the cluster), the callback is called.
  55. The callback function is described by the following type definitions:
  56. .nf
  57. typedef void (*votequorum_nodelist_notification_fn_t) (
  58. votequorum_handle_t handle,
  59. uint64_t context,
  60. uint32_t node_list_entries,
  61. uint32_t node_list[]
  62. );
  63. .fi
  64. Current ring_id (one get in votequorum_quorum_notification_fn) must be passed to
  65. .B votequorum_qdevice_poll
  66. to make qdevice voting valid.
  67. .PP
  68. Every time the quorum state changes (eg a node joins or leave the cluster), the callback is called.
  69. The callback function is described by the following type definitions:
  70. .nf
  71. typedef void (*votequorum_quorum_notification_fn_t) (
  72. votequorum_handle_t handle,
  73. uint64_t context,
  74. uint32_t quorate,
  75. uint32_t node_list_entries,
  76. votequorum_node_t node_list[]
  77. );
  78. .fi
  79. The difference between votequorum_nodelist_notification_t and votequorum_quorum_notification_t is subtle but important.
  80. The 'nodelist' callback is sent at the start of a cluster state transition and contains the new ring_id and only the list of
  81. nodes that are included in the sync state - ie only active nodes. No quorum information is included this callback
  82. because it is not available at that time.
  83. The 'quorum' callback is sent after the cluster state transition has completed and does contain quorum information.
  84. In addition, the nodelist contains a list of all nodes known to votequorum (whether up or down) and their state as well
  85. as information about the quorum device attached (if any). Quorum callbacks will not be sent for qdevice up and down
  86. events unless they affect quorum.
  87. .PP
  88. Every time the expected votes are changed, the callback is called.
  89. The expected votes callback function is described by the following type definitions:
  90. .nf
  91. typedef void (*votequorum_expectedvotes_notification_fn_t) (
  92. votequorum_handle_t handle,
  93. uint64_t context,
  94. uint32_t expected_votes);
  95. .fi
  96. .PP
  97. The
  98. .I callbacks
  99. argument is of the type:
  100. .nf
  101. typedef struct {
  102. votequorum_quorum_notification_fn_t votequorum_quorum_notify_fn;
  103. votequorum_expectedvotes_notification_fn_t votequorum_expectedvotes_notify_fn;
  104. votequorum_nodelist_notification_fn_t votequorum_nodelist_notify_fn;
  105. } votequorum_callbacks_t;
  106. .fi
  107. .PP
  108. When a configuration change occurs, the callback
  109. is called from the
  110. .B votequorum_dispatch()
  111. function.
  112. .PP
  113. .SH RETURN VALUE
  114. This call returns the CS_OK value if successful, otherwise an error is returned.
  115. .SH ERRORS
  116. @COMMONIPCERRORS@
  117. .SH "SEE ALSO"
  118. .BR votequorum_overview (3),
  119. .BR votequorum_finalize (3),
  120. .BR votequorum_getinfo (3),
  121. .BR votequorum_trackstart (3),
  122. .BR votequorum_trackstop (3),
  123. .BR votequorum_fd_get (3),
  124. .BR votequorum_dispatch (3),
  125. .BR votequorum_context_set (3),
  126. .BR votequorum_context_get (3),
  127. .BR votequorum_setexpected (3),
  128. .BR votequorum_setvotes (3)
  129. .PP