46#include <sys/socket.h>
63 qb_ipcc_connection_t *
c;
69static void votequorum_inst_free (
void *inst);
99 goto error_no_destroy;
103 if (error !=
CS_OK) {
111 goto error_put_destroy;
119 hdb_handle_put (&votequorum_handle_t_db, *handle);
124 hdb_handle_put (&votequorum_handle_t_db, *handle);
126 hdb_handle_destroy (&votequorum_handle_t_db, *handle);
131static void votequorum_inst_free (
void *inst)
134 qb_ipcc_disconnect(vq_inst->
c);
144 if (error !=
CS_OK) {
152 hdb_handle_put (&votequorum_handle_t_db, handle);
158 hdb_handle_destroy (&votequorum_handle_t_db, handle);
160 hdb_handle_put (&votequorum_handle_t_db, handle);
178 if (error !=
CS_OK) {
196 if (error !=
CS_OK) {
215 hdb_handle_put (&votequorum_handle_t_db, handle);
231 if (error !=
CS_OK) {
250 if (error !=
CS_OK) {
257 hdb_handle_put (&votequorum_handle_t_db, handle);
274 if (error !=
CS_OK) {
293 if (error !=
CS_OK) {
300 hdb_handle_put (&votequorum_handle_t_db, handle);
317 if (error !=
CS_OK) {
336 if (error !=
CS_OK) {
343 hdb_handle_put (&votequorum_handle_t_db, handle);
358 if (error !=
CS_OK) {
375 if (error !=
CS_OK) {
382 hdb_handle_put (&votequorum_handle_t_db, handle);
396 if (error !=
CS_OK) {
402 hdb_handle_put (&votequorum_handle_t_db, handle);
415 if (error !=
CS_OK) {
421 hdb_handle_put (&votequorum_handle_t_db, handle);
435 if (error !=
CS_OK) {
441 (void)hdb_handle_put (&votequorum_handle_t_db, handle);
455 struct qb_ipc_response_header *dispatch_data;
471 error =
hdb_error_to_cs(hdb_handle_get (&votequorum_handle_t_db, handle,
473 if (error !=
CS_OK) {
485 dispatch_data = (
struct qb_ipc_response_header *)dispatch_buf;
510 if (error !=
CS_OK) {
524 switch (dispatch_data->id) {
600 hdb_handle_put (&votequorum_handle_t_db, handle);
614 if ((strlen(name) == 0) ||
620 if (error !=
CS_OK) {
639 if (error !=
CS_OK) {
646 hdb_handle_put (&votequorum_handle_t_db, handle);
654 unsigned int cast_vote,
663 if ((strlen(name) == 0) ||
669 if (error !=
CS_OK) {
689 if (error !=
CS_OK) {
696 hdb_handle_put (&votequorum_handle_t_db, handle);
712 if ((strlen(name) == 0) ||
718 if (error !=
CS_OK) {
737 if (error !=
CS_OK) {
744 hdb_handle_put (&votequorum_handle_t_db, handle);
768 if (error !=
CS_OK) {
787 if (error !=
CS_OK) {
794 hdb_handle_put (&votequorum_handle_t_db, handle);
809 if ((strlen(name) == 0) ||
815 if (error !=
CS_OK) {
833 if (error !=
CS_OK) {
840 hdb_handle_put (&votequorum_handle_t_db, handle);
863 error =
hdb_error_to_cs(hdb_handle_get (&votequorum_handle_t_db, handle, (
void *)&inst));
864 if (error !=
CS_OK) {
882 if (error !=
CS_OK) {
893 hdb_handle_put (&votequorum_handle_t_db, handle);
911 error =
hdb_error_to_cs(hdb_handle_get (&votequorum_handle_t_db, handle, (
void *)&inst));
912 if (error !=
CS_OK) {
941 if (error !=
CS_OK) {
948 hdb_handle_put (&votequorum_handle_t_db, handle);
unsigned int nodeid
the ID of the node whose info needs updating
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
char oldname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
char newname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
uint32_t ei_size
length of the extra info
#define DECLARE_HDB_DATABASE
uint64_t votequorum_handle_t
votequorum_handle_t
#define VOTEQUORUM_QDEVICE_EXTRA_NODEINFO_MAXSIZE
@ MESSAGE_RES_VOTEQUORUM_NODELIST_NOTIFICATION
@ MESSAGE_RES_VOTEQUORUM_EXPECTEDVOTES_NOTIFICATION
@ MESSAGE_RES_VOTEQUORUM_QDEVICE_EXTRA_INFO_NOTIFICATION
@ MESSAGE_RES_VOTEQUORUM_QUORUM_NOTIFICATION
@ MESSAGE_REQ_VOTEQUORUM_TRACKSTART
@ MESSAGE_REQ_VOTEQUORUM_GETINFO
@ MESSAGE_REQ_VOTEQUORUM_QDEVICE_UNREGISTER
@ MESSAGE_REQ_VOTEQUORUM_QDEVICE_REGISTER
@ MESSAGE_REQ_VOTEQUORUM_TRACKSTOP
@ MESSAGE_REQ_VOTEQUORUM_SETEXPECTED
@ MESSAGE_REQ_VOTEQUORUM_QDEVICE_GET_EXTRA_INFO
@ MESSAGE_REQ_VOTEQUORUM_QDEVICE_UPDATE
@ MESSAGE_REQ_VOTEQUORUM_SETVOTES
@ MESSAGE_REQ_VOTEQUORUM_QDEVICE_MASTER_WINS
@ MESSAGE_REQ_VOTEQUORUM_QDEVICE_POLL
@ MESSAGE_REQ_VOTEQUORUM_QDEVICE_SET_EXTRA_INFO
#define VOTEQUORUM_QDEVICE_MAX_NAME_LEN
cs_error_t hdb_error_to_cs(int res)
#define IPC_DISPATCH_SIZE
cs_error_t votequorum_qdevice_register(votequorum_handle_t handle, const char *name)
Register a quorum device.
cs_error_t votequorum_setvotes(votequorum_handle_t handle, unsigned int nodeid, unsigned int votes)
set votes for a node
cs_error_t votequorum_qdevice_master_wins(votequorum_handle_t handle, const char *name, unsigned int allow)
Allow qdevice to tell votequorum if master_wins can be enabled or not.
cs_error_t votequorum_qdevice_poll(votequorum_handle_t handle, const char *name, unsigned int cast_vote, votequorum_ring_id_t ring_id)
Poll a quorum device.
cs_error_t votequorum_context_get(votequorum_handle_t handle, void **context)
Save and retrieve private data/context.
cs_error_t votequorum_set_qdevice_extra_info(votequorum_handle_t handle, uint32_t ei_size, const void *extra_info)
set the current extra_info for this node, should only be used by the qdevice
cs_error_t votequorum_finalize(votequorum_handle_t handle)
Close the quorum handle.
cs_error_t votequorum_trackstop(votequorum_handle_t handle)
votequorum_trackstop
cs_error_t votequorum_qdevice_unregister(votequorum_handle_t handle, const char *name)
Unregister a quorum device.
cs_error_t votequorum_fd_get(votequorum_handle_t handle, int *fd)
Get a file descriptor on which to poll.
cs_error_t votequorum_model_initialize(votequorum_handle_t *handle, const votequorum_model_v1_data_t *model)
Create a new quorum connection.
cs_error_t votequorum_get_qdevice_extra_info(votequorum_handle_t handle, unsigned int nodeid, uint32_t *ei_size, void *extra_info)
request the current extra_info for a node
cs_error_t votequorum_context_set(votequorum_handle_t handle, void *context)
votequorum_context_set
cs_error_t votequorum_trackstart(votequorum_handle_t handle, uint64_t context, unsigned int flags)
Track node and quorum changes.
cs_error_t votequorum_qdevice_update(votequorum_handle_t handle, const char *oldname, const char *newname)
Update registered name of a quorum device.
cs_error_t votequorum_dispatch(votequorum_handle_t handle, cs_dispatch_flags_t dispatch_types)
Dispatch messages and configuration changes.
cs_error_t votequorum_getinfo(votequorum_handle_t handle, unsigned int nodeid, struct votequorum_info *info)
Get quorum information.
cs_error_t votequorum_setexpected(votequorum_handle_t handle, unsigned int expected_votes)
set expected_votes
cs_error_t votequorum_initialize(votequorum_handle_t *handle, votequorum_callbacks_t *callbacks)
Create a new quorum connection.
The req_lib_votequorum_general struct.
The req_lib_votequorum_getinfo struct.
The req_lib_votequorum_qdevice_master_wins struct.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_qdevice_poll struct.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_qdevice_register struct.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_qdevice_unregister struct.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_qdevice_update struct.
char newname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
char oldname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_setexpected struct.
unsigned int expected_votes
The req_lib_votequorum_setvotes struct.
The req_lib_votequorum_trackstart struct.
The res_lib_votequorum_expectedvotes_notification struct.
The res_lib_votequorum_getinfo struct.
unsigned int highest_expected
char qdevice_name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
unsigned int expected_votes
unsigned int qdevice_votes
The res_lib_votequorum_quorum_notification struct.
The res_lib_votequorum_status struct.
The votequorum_callbacks_t struct.
votequorum_nodelist_notification_fn_t votequorum_nodelist_notify_fn
votequorum_expectedvotes_notification_fn_t votequorum_expectedvotes_notify_fn
votequorum_quorum_notification_fn_t votequorum_quorum_notify_fn
The votequorum_info struct.
unsigned int qdevice_votes
unsigned int highest_expected
char qdevice_name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
unsigned int node_expected_votes
votequorum_model_v1_data_t callbacks
votequorum_nodelist_notification_fn_t votequorum_nodelist_notify_fn
votequorum_qdevice_extra_info_fn_t votequorum_qdevice_extra_info_fn
votequorum_expectedvotes_notification_fn_t votequorum_expectedvotes_notify_fn
votequorum_quorum_notification_fn_t votequorum_quorum_notify_fn
The votequorum_node_t struct.
The votequorum_ring_id_t struct.
struct memb_ring_id ring_id