corosync
2.3.5-dirty
|
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <errno.h>
#include <qb/qbdefs.h>
#include <qb/qbipcc.h>
#include <corosync/corotypes.h>
#include <corosync/corodefs.h>
#include <corosync/hdb.h>
#include <corosync/votequorum.h>
#include <corosync/ipc_votequorum.h>
#include "util.h"
Go to the source code of this file.
Data Structures | |
struct | votequorum_inst |
DECLARE_HDB_DATABASE | ( | votequorum_handle_t_db | , |
votequorum_inst_free | |||
) |
cs_error_t votequorum_context_get | ( | votequorum_handle_t | handle, |
void ** | context | ||
) |
Save and retrieve private data/context.
Definition at line 370 of file lib/votequorum.c.
References votequorum_inst::context, CS_OK, and hdb_error_to_cs().
cs_error_t votequorum_context_set | ( | votequorum_handle_t | handle, |
void * | context | ||
) |
Definition at line 389 of file lib/votequorum.c.
References votequorum_inst::context, CS_OK, and hdb_error_to_cs().
cs_error_t votequorum_dispatch | ( | votequorum_handle_t | handle, |
cs_dispatch_flags_t | dispatch_types | ||
) |
Dispatch messages and configuration changes.
Definition at line 428 of file lib/votequorum.c.
References votequorum_inst::c, votequorum_inst::callbacks, CS_DISPATCH_ALL, CS_DISPATCH_BLOCKING, CS_DISPATCH_ONE, CS_DISPATCH_ONE_NONBLOCKING, CS_ERR_BAD_HANDLE, CS_ERR_INVALID_PARAM, CS_ERR_LIBRARY, CS_ERR_TRY_AGAIN, CS_OK, votequorum_inst::finalize, hdb_error_to_cs(), IPC_DISPATCH_SIZE, MESSAGE_RES_VOTEQUORUM_EXPECTEDVOTES_NOTIFICATION, MESSAGE_RES_VOTEQUORUM_NOTIFICATION, qb_to_cs_error(), ring_id, votequorum_callbacks_t::votequorum_expectedvotes_notify_fn, and votequorum_callbacks_t::votequorum_notify_fn.
cs_error_t votequorum_fd_get | ( | votequorum_handle_t | handle, |
int * | fd | ||
) |
Get a file descriptor on which to poll.
Definition at line 409 of file lib/votequorum.c.
References votequorum_inst::c, CS_OK, hdb_error_to_cs(), and qb_to_cs_error().
cs_error_t votequorum_finalize | ( | votequorum_handle_t | handle | ) |
Close the quorum handle.
Definition at line 119 of file lib/votequorum.c.
References CS_ERR_BAD_HANDLE, CS_OK, votequorum_inst::finalize, and hdb_error_to_cs().
cs_error_t votequorum_getinfo | ( | votequorum_handle_t | handle, |
unsigned int | nodeid, | ||
struct votequorum_info * | info | ||
) |
Get quorum information.
Definition at line 148 of file lib/votequorum.c.
References votequorum_inst::c, CS_IPC_TIMEOUT_MS, CS_OK, res_lib_votequorum_getinfo::expected_votes, votequorum_info::flags, res_lib_votequorum_getinfo::flags, hdb_error_to_cs(), votequorum_info::highest_expected, res_lib_votequorum_getinfo::highest_expected, MESSAGE_REQ_VOTEQUORUM_GETINFO, votequorum_info::node_expected_votes, votequorum_info::node_id, votequorum_info::node_state, votequorum_info::node_votes, nodeid, req_lib_votequorum_getinfo::nodeid, res_lib_votequorum_getinfo::nodeid, qb_to_cs_error(), votequorum_info::qdevice_name, res_lib_votequorum_getinfo::qdevice_name, votequorum_info::qdevice_votes, res_lib_votequorum_getinfo::qdevice_votes, votequorum_info::quorum, res_lib_votequorum_getinfo::quorum, res_lib_votequorum_getinfo::state, votequorum_info::total_votes, res_lib_votequorum_getinfo::total_votes, VOTEQUORUM_QDEVICE_MAX_NAME_LEN, and res_lib_votequorum_getinfo::votes.
cs_error_t votequorum_initialize | ( | votequorum_handle_t * | handle, |
votequorum_callbacks_t * | callbacks | ||
) |
Create a new quorum connection.
Definition at line 72 of file lib/votequorum.c.
References votequorum_inst::c, votequorum_inst::callbacks, CS_OK, votequorum_inst::finalize, hdb_error_to_cs(), IPC_REQUEST_SIZE, and qb_to_cs_error().
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.
Definition at line 657 of file lib/votequorum.c.
References req_lib_votequorum_qdevice_master_wins::allow, votequorum_inst::c, CS_ERR_INVALID_PARAM, CS_IPC_TIMEOUT_MS, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_VOTEQUORUM_QDEVICE_MASTER_WINS, req_lib_votequorum_qdevice_master_wins::name, qb_to_cs_error(), and 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.
Definition at line 607 of file lib/votequorum.c.
References votequorum_inst::c, req_lib_votequorum_qdevice_poll::cast_vote, CS_ERR_INVALID_PARAM, CS_IPC_TIMEOUT_MS, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_VOTEQUORUM_QDEVICE_POLL, req_lib_votequorum_qdevice_poll::name, qb_to_cs_error(), and VOTEQUORUM_QDEVICE_MAX_NAME_LEN.
cs_error_t votequorum_qdevice_register | ( | votequorum_handle_t | handle, |
const char * | name | ||
) |
Register a quorum device.
it will be DEAD until polled
Definition at line 560 of file lib/votequorum.c.
References votequorum_inst::c, CS_ERR_INVALID_PARAM, CS_IPC_TIMEOUT_MS, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_VOTEQUORUM_QDEVICE_REGISTER, req_lib_votequorum_qdevice_register::name, qb_to_cs_error(), and VOTEQUORUM_QDEVICE_MAX_NAME_LEN.
cs_error_t votequorum_qdevice_unregister | ( | votequorum_handle_t | handle, |
const char * | name | ||
) |
Unregister a quorum device.
Definition at line 755 of file lib/votequorum.c.
References votequorum_inst::c, CS_ERR_INVALID_PARAM, CS_IPC_TIMEOUT_MS, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_VOTEQUORUM_QDEVICE_UNREGISTER, req_lib_votequorum_qdevice_unregister::name, qb_to_cs_error(), and VOTEQUORUM_QDEVICE_MAX_NAME_LEN.
cs_error_t votequorum_qdevice_update | ( | votequorum_handle_t | handle, |
const char * | oldname, | ||
const char * | newname | ||
) |
Update registered name of a quorum device.
Definition at line 705 of file lib/votequorum.c.
References votequorum_inst::c, CS_ERR_INVALID_PARAM, CS_IPC_TIMEOUT_MS, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_VOTEQUORUM_QDEVICE_UPDATE, req_lib_votequorum_qdevice_update::newname, req_lib_votequorum_qdevice_update::oldname, qb_to_cs_error(), and VOTEQUORUM_QDEVICE_MAX_NAME_LEN.
cs_error_t votequorum_setexpected | ( | votequorum_handle_t | handle, |
unsigned int | expected_votes | ||
) |
set expected_votes
Definition at line 202 of file lib/votequorum.c.
References votequorum_inst::c, CS_IPC_TIMEOUT_MS, CS_OK, expected_votes, req_lib_votequorum_setexpected::expected_votes, hdb_error_to_cs(), MESSAGE_REQ_VOTEQUORUM_SETEXPECTED, and qb_to_cs_error().
cs_error_t votequorum_setvotes | ( | votequorum_handle_t | handle, |
unsigned int | nodeid, | ||
unsigned int | votes | ||
) |
set votes for a node
Definition at line 244 of file lib/votequorum.c.
References votequorum_inst::c, CS_IPC_TIMEOUT_MS, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_VOTEQUORUM_SETVOTES, nodeid, req_lib_votequorum_setvotes::nodeid, qb_to_cs_error(), votes, and req_lib_votequorum_setvotes::votes.
cs_error_t votequorum_trackstart | ( | votequorum_handle_t | handle, |
uint64_t | context, | ||
unsigned int | flags | ||
) |
Track node and quorum changes.
Definition at line 287 of file lib/votequorum.c.
References votequorum_inst::c, req_lib_votequorum_trackstart::context, CS_IPC_TIMEOUT_MS, CS_OK, flags, hdb_error_to_cs(), MESSAGE_REQ_VOTEQUORUM_TRACKSTART, qb_to_cs_error(), and req_lib_votequorum_trackstart::track_flags.
cs_error_t votequorum_trackstop | ( | votequorum_handle_t | handle | ) |
Definition at line 330 of file lib/votequorum.c.
References votequorum_inst::c, CS_IPC_TIMEOUT_MS, CS_OK, hdb_error_to_cs(), MESSAGE_REQ_VOTEQUORUM_TRACKSTOP, and qb_to_cs_error().