Go to the documentation of this file.
44 #include <sys/types.h>
45 #include <sys/socket.h>
49 #include <qb/qbdefs.h>
50 #include <qb/qbipcc.h>
62 qb_ipcc_connection_t *
c;
68 static void votequorum_inst_free (
void *inst);
81 goto error_no_destroy;
93 goto error_put_destroy;
101 hdb_handle_put (&votequorum_handle_t_db, *handle);
106 hdb_handle_put (&votequorum_handle_t_db, *handle);
108 hdb_handle_destroy (&votequorum_handle_t_db, *handle);
113 static void votequorum_inst_free (
void *inst)
116 qb_ipcc_disconnect(vq_inst->
c);
126 if (error !=
CS_OK) {
134 hdb_handle_put (&votequorum_handle_t_db, handle);
140 hdb_handle_destroy (&votequorum_handle_t_db, handle);
142 hdb_handle_put (&votequorum_handle_t_db, handle);
160 if (error !=
CS_OK) {
178 if (error !=
CS_OK) {
197 hdb_handle_put (&votequorum_handle_t_db, handle);
213 if (error !=
CS_OK) {
232 if (error !=
CS_OK) {
239 hdb_handle_put (&votequorum_handle_t_db, handle);
256 if (error !=
CS_OK) {
275 if (error !=
CS_OK) {
282 hdb_handle_put (&votequorum_handle_t_db, handle);
299 if (error !=
CS_OK) {
318 if (error !=
CS_OK) {
325 hdb_handle_put (&votequorum_handle_t_db, handle);
340 if (error !=
CS_OK) {
357 if (error !=
CS_OK) {
364 hdb_handle_put (&votequorum_handle_t_db, handle);
378 if (error !=
CS_OK) {
384 hdb_handle_put (&votequorum_handle_t_db, handle);
397 if (error !=
CS_OK) {
403 hdb_handle_put (&votequorum_handle_t_db, handle);
417 if (error !=
CS_OK) {
423 (void)hdb_handle_put (&votequorum_handle_t_db, handle);
437 struct qb_ipc_response_header *dispatch_data;
452 error =
hdb_error_to_cs(hdb_handle_get (&votequorum_handle_t_db, handle,
454 if (error !=
CS_OK) {
466 dispatch_data = (
struct qb_ipc_response_header *)dispatch_buf;
491 if (error !=
CS_OK) {
505 switch (dispatch_data->id) {
568 hdb_handle_put (&votequorum_handle_t_db, handle);
582 if ((strlen(name) == 0) ||
588 if (error !=
CS_OK) {
607 if (error !=
CS_OK) {
614 hdb_handle_put (&votequorum_handle_t_db, handle);
622 unsigned int cast_vote,
631 if ((strlen(name) == 0) ||
637 if (error !=
CS_OK) {
657 if (error !=
CS_OK) {
664 hdb_handle_put (&votequorum_handle_t_db, handle);
680 if ((strlen(name) == 0) ||
686 if (error !=
CS_OK) {
705 if (error !=
CS_OK) {
712 hdb_handle_put (&votequorum_handle_t_db, handle);
736 if (error !=
CS_OK) {
755 if (error !=
CS_OK) {
762 hdb_handle_put (&votequorum_handle_t_db, handle);
777 if ((strlen(name) == 0) ||
783 if (error !=
CS_OK) {
801 if (error !=
CS_OK) {
808 hdb_handle_put (&votequorum_handle_t_db, handle);
The req_lib_votequorum_qdevice_update struct.
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.
The req_lib_votequorum_getinfo struct.
votequorum_callbacks_t callbacks
votequorum_quorum_notification_fn_t votequorum_quorum_notify_fn
unsigned int expected_votes
The req_lib_votequorum_qdevice_register struct.
cs_error_t votequorum_trackstop(votequorum_handle_t handle)
votequorum_trackstop
cs_error_t votequorum_fd_get(votequorum_handle_t handle, int *fd)
Get a file descriptor on which to poll.
The votequorum_info struct.
unsigned int highest_expected
The res_lib_votequorum_status struct.
cs_error_t votequorum_qdevice_update(votequorum_handle_t handle, const char *oldname, const char *newname)
Update registered name of a quorum device.
char qdevice_name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
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_dispatch_flags_t
The cs_dispatch_flags_t enum.
uint64_t votequorum_handle_t
votequorum_handle_t
cs_error_t votequorum_context_get(votequorum_handle_t handle, void **context)
Save and retrieve private data/context.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
unsigned int expected_votes
char newname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
cs_error_t votequorum_setvotes(votequorum_handle_t handle, unsigned int nodeid, unsigned int votes)
set votes for a node
The req_lib_votequorum_setexpected struct.
The res_lib_votequorum_quorum_notification struct.
cs_error_t votequorum_context_set(votequorum_handle_t handle, void *context)
votequorum_context_set
cs_error_t
The cs_error_t enum.
cs_error_t votequorum_qdevice_register(votequorum_handle_t handle, const char *name)
Register a quorum device.
DECLARE_HDB_DATABASE(votequorum_handle_t_db, votequorum_inst_free)
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The votequorum_callbacks_t struct.
cs_error_t votequorum_getinfo(votequorum_handle_t handle, unsigned int nodeid, struct votequorum_info *info)
Get quorum information.
#define IPC_DISPATCH_SIZE
The req_lib_votequorum_qdevice_unregister struct.
cs_error_t qb_to_cs_error(int result)
qb_to_cs_error
cs_error_t votequorum_dispatch(votequorum_handle_t handle, cs_dispatch_flags_t dispatch_types)
Dispatch messages and configuration changes.
cs_error_t votequorum_finalize(votequorum_handle_t handle)
Close the quorum handle.
The req_lib_votequorum_qdevice_poll struct.
unsigned int qdevice_votes
votequorum_nodelist_notification_fn_t votequorum_nodelist_notify_fn
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_trackstart struct.
The res_lib_votequorum_getinfo struct.
unsigned int qdevice_votes
#define VOTEQUORUM_QDEVICE_MAX_NAME_LEN
votequorum_expectedvotes_notification_fn_t votequorum_expectedvotes_notify_fn
unsigned int node_expected_votes
char newname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
cs_error_t votequorum_trackstart(votequorum_handle_t handle, uint64_t context, unsigned int flags)
Track node and quorum changes.
cs_error_t votequorum_setexpected(votequorum_handle_t handle, unsigned int expected_votes)
set expected_votes
struct memb_ring_id ring_id
char qdevice_name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_general struct.
The res_lib_votequorum_expectedvotes_notification struct.
The votequorum_node_t struct.
cs_error_t votequorum_initialize(votequorum_handle_t *handle, votequorum_callbacks_t *callbacks)
Create a new quorum connection.
The req_lib_votequorum_qdevice_master_wins struct.
char oldname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The votequorum_ring_id_t struct.
cs_error_t votequorum_qdevice_unregister(votequorum_handle_t handle, const char *name)
Unregister a quorum device.
unsigned int highest_expected
char oldname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
#define CS_IPC_TIMEOUT_MS
cs_error_t hdb_error_to_cs(int res)
The req_lib_votequorum_setvotes struct.