44#include <sys/socket.h>
59 qb_ipcc_connection_t *
c;
69static void quorum_inst_free (
void *inst);
76 uint32_t *quorum_type)
94 uint32_t *quorum_type,
100 struct qb_ipc_request_header quorum_gettype_req;
104 uint32_t local_quorum_type;
108 goto error_no_destroy;
112 if (error !=
CS_OK) {
113 goto error_no_destroy;
117 if (error !=
CS_OK) {
126 goto error_put_destroy;
131 quorum_gettype_req.size =
sizeof (quorum_gettype_req);
134 iov.iov_base = (
char *)&quorum_gettype_req;
135 iov.iov_len =
sizeof (quorum_gettype_req);
144 if (error !=
CS_OK) {
145 goto error_put_destroy;
151 quorum_model_gettype_req.header.size =
sizeof (quorum_model_gettype_req);
153 quorum_model_gettype_req.model = model;
155 iov.iov_base = (
char *)&quorum_model_gettype_req;
156 iov.iov_len =
sizeof (quorum_model_gettype_req);
165 if (error !=
CS_OK) {
166 goto error_put_destroy;
173 if (quorum_type != NULL) {
174 *quorum_type = local_quorum_type;
177 if (model_data != NULL) {
191 (void)hdb_handle_put (&quorum_handle_t_db, *handle);
196 (void)hdb_handle_put (&quorum_handle_t_db, *handle);
198 (void)hdb_handle_destroy (&quorum_handle_t_db, *handle);
203static void quorum_inst_free (
void *inst)
216 if (error !=
CS_OK) {
224 (void)hdb_handle_put (&quorum_handle_t_db, handle);
230 (void)hdb_handle_destroy (&quorum_handle_t_db, handle);
232 (void)hdb_handle_put (&quorum_handle_t_db, handle);
244 struct qb_ipc_request_header req;
248 if (error !=
CS_OK) {
252 req.size =
sizeof (req);
255 iov.iov_base = (
char *)&req;
256 iov.iov_len =
sizeof (req);
265 if (error !=
CS_OK) {
274 (void)hdb_handle_put (&quorum_handle_t_db, handle);
287 if (error !=
CS_OK) {
293 (void)hdb_handle_put (&quorum_handle_t_db, handle);
307 if (error !=
CS_OK) {
313 (void)hdb_handle_put (&quorum_handle_t_db, handle);
326 if (error !=
CS_OK) {
332 (void)hdb_handle_put (&quorum_handle_t_db, handle);
346 struct qb_ipc_response_header res;
349 if (error !=
CS_OK) {
367 if (error !=
CS_OK) {
374 (void)hdb_handle_put (&quorum_handle_t_db, handle);
385 struct qb_ipc_request_header req;
386 struct qb_ipc_response_header res;
389 if (error !=
CS_OK) {
393 req.size =
sizeof (req);
396 iov.iov_base = (
char *)&req;
397 iov.iov_len =
sizeof (req);
406 if (error !=
CS_OK) {
413 (void)hdb_handle_put (&quorum_handle_t_db, handle);
427 struct qb_ipc_response_header *dispatch_data;
446 if (error !=
CS_OK) {
458 dispatch_data = (
struct qb_ipc_response_header *)dispatch_buf;
483 if (error !=
CS_OK) {
492 memcpy (&quorum_inst_copy,
quorum_inst,
sizeof(quorum_inst_copy));
498 switch (dispatch_data->id) {
521 switch (dispatch_data->id) {
550 left_list = joined_list +
586 (void)hdb_handle_put (&quorum_handle_t_db, handle);
cs_dispatch_flags_t
The cs_dispatch_flags_t enum.
@ CS_DISPATCH_ONE_NONBLOCKING
cs_error_t qb_to_cs_error(int result)
qb_to_cs_error
cs_error_t
The cs_error_t enum.
#define CS_IPC_TIMEOUT_MS
uint64_t quorum_handle_t
quorum_handle_t
@ MESSAGE_RES_QUORUM_V1_QUORUM_NOTIFICATION
@ MESSAGE_RES_QUORUM_V1_NODELIST_NOTIFICATION
@ MESSAGE_RES_QUORUM_NOTIFICATION
@ MESSAGE_REQ_QUORUM_GETTYPE
@ MESSAGE_REQ_QUORUM_TRACKSTART
@ MESSAGE_REQ_QUORUM_TRACKSTOP
@ MESSAGE_REQ_QUORUM_GETQUORATE
@ MESSAGE_REQ_QUORUM_MODEL_GETTYPE
cs_error_t quorum_context_get(quorum_handle_t handle, const void **context)
quorum_context_get
DECLARE_HDB_DATABASE(quorum_handle_t_db, quorum_inst_free)
cs_error_t quorum_trackstop(quorum_handle_t handle)
quorum_trackstop
cs_error_t quorum_initialize(quorum_handle_t *handle, quorum_callbacks_t *callbacks, uint32_t *quorum_type)
Create a new quorum connection.
cs_error_t quorum_fd_get(quorum_handle_t handle, int *fd)
Get a file descriptor on which to poll.
cs_error_t quorum_trackstart(quorum_handle_t handle, unsigned int flags)
Track node and quorum changes.
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)
cs_error_t quorum_finalize(quorum_handle_t handle)
Close the quorum handle.
cs_error_t quorum_getquorate(quorum_handle_t handle, int *quorate)
Get quorum information.
cs_error_t quorum_context_set(quorum_handle_t handle, const void *context)
quorum_context_set
cs_error_t quorum_dispatch(quorum_handle_t handle, cs_dispatch_flags_t dispatch_types)
Dispatch messages and configuration changes.
cs_error_t hdb_error_to_cs(int res)
#define IPC_DISPATCH_SIZE
The quorum_callbacks_t struct.
quorum_notification_fn_t quorum_notify_fn
quorum_model_v0_data_t model_v0_data
quorum_model_data_t model_data
quorum_model_v1_data_t model_v1_data
quorum_notification_fn_t quorum_notify_fn
quorum_v1_quorum_notification_fn_t quorum_notify_fn
quorum_v1_nodelist_notification_fn_t nodelist_notify_fn
The req_lib_quorum_trackstart struct.
The res_lib_quorum_getquorate struct.
The res_lib_quorum_gettype struct.
The res_lib_quorum_notification struct.
mar_uint32_t member_list[]
struct memb_ring_id ring_id