corosync 3.1.9
Data Structures | Functions
votequorum.c File Reference
#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"
Include dependency graph for lib/votequorum.c:

Go to the source code of this file.

Data Structures

struct  votequorum_inst
 

Functions

 DECLARE_HDB_DATABASE (votequorum_handle_t_db, votequorum_inst_free)
 
cs_error_t votequorum_initialize (votequorum_handle_t *handle, votequorum_callbacks_t *callbacks)
 Create a new quorum connection.
 
cs_error_t votequorum_finalize (votequorum_handle_t handle)
 Close the quorum handle.
 
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_setvotes (votequorum_handle_t handle, unsigned int nodeid, unsigned int votes)
 set votes for a node
 
cs_error_t votequorum_trackstart (votequorum_handle_t handle, uint64_t context, unsigned int flags)
 Track node and quorum changes.
 
cs_error_t votequorum_trackstop (votequorum_handle_t handle)
 votequorum_trackstop
 
cs_error_t votequorum_context_get (votequorum_handle_t handle, void **context)
 Save and retrieve private data/context.
 
cs_error_t votequorum_context_set (votequorum_handle_t handle, void *context)
 votequorum_context_set
 
cs_error_t votequorum_fd_get (votequorum_handle_t handle, int *fd)
 Get a file descriptor on which to poll.
 
cs_error_t votequorum_dispatch (votequorum_handle_t handle, cs_dispatch_flags_t dispatch_types)
 Dispatch messages and configuration changes.
 
cs_error_t votequorum_qdevice_register (votequorum_handle_t handle, const char *name)
 Register a quorum device.
 
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_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_update (votequorum_handle_t handle, const char *oldname, const char *newname)
 Update registered name of a quorum device.
 
cs_error_t votequorum_qdevice_unregister (votequorum_handle_t handle, const char *name)
 Unregister a quorum device.
 

Function Documentation

◆ DECLARE_HDB_DATABASE()

DECLARE_HDB_DATABASE ( votequorum_handle_t_db  ,
votequorum_inst_free   
)

◆ votequorum_context_get()

cs_error_t votequorum_context_get ( votequorum_handle_t  handle,
void **  context 
)

Save and retrieve private data/context.

Parameters
handle
context
Returns

Definition at line 370 of file lib/votequorum.c.

References votequorum_inst::context, CS_OK, hdb_error_to_cs(), and nodeid.

◆ votequorum_context_set()

cs_error_t votequorum_context_set ( votequorum_handle_t  handle,
void context 
)

votequorum_context_set

Parameters
handle
context
Returns

Definition at line 389 of file lib/votequorum.c.

References votequorum_inst::context, CS_OK, hdb_error_to_cs(), and nodeid.

◆ votequorum_dispatch()

cs_error_t votequorum_dispatch ( votequorum_handle_t  handle,
cs_dispatch_flags_t  dispatch_types 
)

◆ votequorum_fd_get()

cs_error_t votequorum_fd_get ( votequorum_handle_t  handle,
int fd 
)

Get a file descriptor on which to poll.

Note
votequorum_handle_t is NOT a file descriptor and may not be used directly.
Parameters
handle
fd
Returns

Definition at line 409 of file lib/votequorum.c.

References votequorum_inst::c, CS_OK, hdb_error_to_cs(), nodeid, and qb_to_cs_error().

◆ votequorum_finalize()

cs_error_t votequorum_finalize ( votequorum_handle_t  handle)

Close the quorum handle.

Parameters
handle
Returns

Definition at line 119 of file lib/votequorum.c.

References CS_ERR_BAD_HANDLE, CS_OK, votequorum_inst::finalize, hdb_error_to_cs(), and nodeid.

◆ votequorum_getinfo()

cs_error_t votequorum_getinfo ( votequorum_handle_t  handle,
unsigned int  nodeid,
struct votequorum_info info 
)

◆ votequorum_initialize()

cs_error_t votequorum_initialize ( votequorum_handle_t handle,
votequorum_callbacks_t callbacks 
)

Create a new quorum connection.

Parameters
handle
callbacks
Returns

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, nodeid, and qb_to_cs_error().

◆ votequorum_qdevice_master_wins()

cs_error_t votequorum_qdevice_master_wins ( votequorum_handle_t  handle,
const char name,
unsigned int  allow 
)

◆ votequorum_qdevice_poll()

cs_error_t votequorum_qdevice_poll ( votequorum_handle_t  handle,
const char name,
unsigned int  cast_vote,
votequorum_ring_id_t  ring_id 
)

◆ votequorum_qdevice_register()

cs_error_t votequorum_qdevice_register ( votequorum_handle_t  handle,
const char name 
)

◆ votequorum_qdevice_unregister()

cs_error_t votequorum_qdevice_unregister ( votequorum_handle_t  handle,
const char name 
)

◆ votequorum_qdevice_update()

cs_error_t votequorum_qdevice_update ( votequorum_handle_t  handle,
const char oldname,
const char newname 
)

◆ votequorum_setexpected()

cs_error_t votequorum_setexpected ( votequorum_handle_t  handle,
unsigned int  expected_votes 
)

◆ votequorum_setvotes()

cs_error_t votequorum_setvotes ( votequorum_handle_t  handle,
unsigned int  nodeid,
unsigned int  votes 
)

◆ votequorum_trackstart()

cs_error_t votequorum_trackstart ( votequorum_handle_t  handle,
uint64_t  context,
unsigned int  flags 
)

◆ votequorum_trackstop()

cs_error_t votequorum_trackstop ( votequorum_handle_t  handle)

votequorum_trackstop

Parameters
handle
Returns

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, nodeid, and qb_to_cs_error().