corosync 3.1.7
Data Structures | Macros | Typedefs | Functions
include/corosync/votequorum.h File Reference
#include <corosync/corotypes.h>
Include dependency graph for include/corosync/votequorum.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  votequorum_info
 The votequorum_info struct. More...
 
struct  votequorum_node_t
 The votequorum_node_t struct. More...
 
struct  votequorum_ring_id_t
 The votequorum_ring_id_t struct. More...
 
struct  votequorum_callbacks_t
 The votequorum_callbacks_t struct. More...
 

Macros

#define VOTEQUORUM_INFO_TWONODE   1
 
#define VOTEQUORUM_INFO_QUORATE   2
 
#define VOTEQUORUM_INFO_WAIT_FOR_ALL   4
 
#define VOTEQUORUM_INFO_LAST_MAN_STANDING   8
 
#define VOTEQUORUM_INFO_AUTO_TIE_BREAKER   16
 
#define VOTEQUORUM_INFO_ALLOW_DOWNSCALE   32
 
#define VOTEQUORUM_INFO_QDEVICE_REGISTERED   64
 
#define VOTEQUORUM_INFO_QDEVICE_ALIVE   128
 
#define VOTEQUORUM_INFO_QDEVICE_CAST_VOTE   256
 
#define VOTEQUORUM_INFO_QDEVICE_MASTER_WINS   512
 
#define VOTEQUORUM_QDEVICE_NODEID   0
 
#define VOTEQUORUM_QDEVICE_MAX_NAME_LEN   255
 
#define VOTEQUORUM_QDEVICE_DEFAULT_TIMEOUT   10000
 
#define VOTEQUORUM_QDEVICE_DEFAULT_SYNC_TIMEOUT   30000
 
#define VOTEQUORUM_NODESTATE_MEMBER   1
 
#define VOTEQUORUM_NODESTATE_DEAD   2
 
#define VOTEQUORUM_NODESTATE_LEAVING   3
 

Typedefs

typedef uint64_t votequorum_handle_t
 votequorum_handle_t More...
 
typedef void(* votequorum_quorum_notification_fn_t) (votequorum_handle_t handle, uint64_t context, uint32_t quorate, uint32_t node_list_entries, votequorum_node_t node_list[])
 The votequorum_quorum_notification_fn_t callback. More...
 
typedef void(* votequorum_nodelist_notification_fn_t) (votequorum_handle_t handle, uint64_t context, votequorum_ring_id_t ring_id, uint32_t node_list_entries, uint32_t node_list[])
 
typedef void(* votequorum_expectedvotes_notification_fn_t) (votequorum_handle_t handle, uint64_t context, uint32_t expected_votes)
 The votequorum_expectedvotes_notification_fn_t callback. More...
 

Functions

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

Macro Definition Documentation

◆ VOTEQUORUM_INFO_ALLOW_DOWNSCALE

#define VOTEQUORUM_INFO_ALLOW_DOWNSCALE   32

Definition at line 55 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_INFO_AUTO_TIE_BREAKER

#define VOTEQUORUM_INFO_AUTO_TIE_BREAKER   16

Definition at line 54 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_INFO_LAST_MAN_STANDING

#define VOTEQUORUM_INFO_LAST_MAN_STANDING   8

Definition at line 53 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_INFO_QDEVICE_ALIVE

#define VOTEQUORUM_INFO_QDEVICE_ALIVE   128

Definition at line 57 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_INFO_QDEVICE_CAST_VOTE

#define VOTEQUORUM_INFO_QDEVICE_CAST_VOTE   256

Definition at line 58 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_INFO_QDEVICE_MASTER_WINS

#define VOTEQUORUM_INFO_QDEVICE_MASTER_WINS   512

Definition at line 59 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_INFO_QDEVICE_REGISTERED

#define VOTEQUORUM_INFO_QDEVICE_REGISTERED   64

Definition at line 56 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_INFO_QUORATE

#define VOTEQUORUM_INFO_QUORATE   2

Definition at line 51 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_INFO_TWONODE

#define VOTEQUORUM_INFO_TWONODE   1

Definition at line 50 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_INFO_WAIT_FOR_ALL

#define VOTEQUORUM_INFO_WAIT_FOR_ALL   4

Definition at line 52 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_NODESTATE_DEAD

#define VOTEQUORUM_NODESTATE_DEAD   2

Definition at line 67 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_NODESTATE_LEAVING

#define VOTEQUORUM_NODESTATE_LEAVING   3

Definition at line 68 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_NODESTATE_MEMBER

#define VOTEQUORUM_NODESTATE_MEMBER   1

Definition at line 66 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_QDEVICE_DEFAULT_SYNC_TIMEOUT

#define VOTEQUORUM_QDEVICE_DEFAULT_SYNC_TIMEOUT   30000

Definition at line 64 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_QDEVICE_DEFAULT_TIMEOUT

#define VOTEQUORUM_QDEVICE_DEFAULT_TIMEOUT   10000

Definition at line 63 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_QDEVICE_MAX_NAME_LEN

#define VOTEQUORUM_QDEVICE_MAX_NAME_LEN   255

Definition at line 62 of file include/corosync/votequorum.h.

◆ VOTEQUORUM_QDEVICE_NODEID

#define VOTEQUORUM_QDEVICE_NODEID   0

Definition at line 61 of file include/corosync/votequorum.h.

Typedef Documentation

◆ votequorum_expectedvotes_notification_fn_t

typedef void(* votequorum_expectedvotes_notification_fn_t) (votequorum_handle_t handle, uint64_t context, uint32_t expected_votes)

The votequorum_expectedvotes_notification_fn_t callback.

Definition at line 124 of file include/corosync/votequorum.h.

◆ votequorum_handle_t

typedef uint64_t votequorum_handle_t

votequorum_handle_t

Definition at line 48 of file include/corosync/votequorum.h.

◆ votequorum_nodelist_notification_fn_t

typedef void(* votequorum_nodelist_notification_fn_t) (votequorum_handle_t handle, uint64_t context, votequorum_ring_id_t ring_id, uint32_t node_list_entries, uint32_t node_list[])

Definition at line 114 of file include/corosync/votequorum.h.

◆ votequorum_quorum_notification_fn_t

typedef void(* votequorum_quorum_notification_fn_t) (votequorum_handle_t handle, uint64_t context, uint32_t quorate, uint32_t node_list_entries, votequorum_node_t node_list[])

The votequorum_quorum_notification_fn_t callback.

Definition at line 107 of file include/corosync/votequorum.h.

Function Documentation

◆ 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 hdb_error_to_cs().

◆ 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 hdb_error_to_cs().

◆ votequorum_dispatch()

cs_error_t votequorum_dispatch ( votequorum_handle_t  handle,
cs_dispatch_flags_t  dispatch_types 
)

Dispatch messages and configuration changes.

Parameters
handle
dispatch_types
Returns

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

References votequorum_inst::callbacks, CS_DISPATCH_ALL, CS_DISPATCH_BLOCKING, CS_DISPATCH_ONE, CS_DISPATCH_ONE_NONBLOCKING, CS_ERR_INVALID_PARAM, hdb_error_to_cs(), IPC_DISPATCH_SIZE, and ring_id.

◆ 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 hdb_error_to_cs().

◆ 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 hdb_error_to_cs().

◆ votequorum_getinfo()

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

Get quorum information.

Parameters
handle
nodeid
info
Returns

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

References hdb_error_to_cs().

◆ 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 hdb_error_to_cs().

◆ votequorum_qdevice_master_wins()

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.

Parameters
handle
name
allow
Returns

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

References CS_ERR_INVALID_PARAM, hdb_error_to_cs(), and VOTEQUORUM_QDEVICE_MAX_NAME_LEN.

◆ 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 
)

Poll a quorum device.

Parameters
handle
name
cast_vote
ring_id
Returns

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

References CS_ERR_INVALID_PARAM, hdb_error_to_cs(), and VOTEQUORUM_QDEVICE_MAX_NAME_LEN.

◆ votequorum_qdevice_register()

cs_error_t votequorum_qdevice_register ( votequorum_handle_t  handle,
const char *  name 
)

Register a quorum device.

it will be DEAD until polled

Parameters
handle
name
Returns

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

References CS_ERR_INVALID_PARAM, hdb_error_to_cs(), and VOTEQUORUM_QDEVICE_MAX_NAME_LEN.

◆ votequorum_qdevice_unregister()

cs_error_t votequorum_qdevice_unregister ( votequorum_handle_t  handle,
const char *  name 
)

Unregister a quorum device.

Parameters
handle
name
Returns

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

References CS_ERR_INVALID_PARAM, hdb_error_to_cs(), and VOTEQUORUM_QDEVICE_MAX_NAME_LEN.

◆ votequorum_qdevice_update()

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

Update registered name of a quorum device.

Parameters
handle
oldname
newname
Returns

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

References CS_ERR_INVALID_PARAM, hdb_error_to_cs(), newname, oldname, and VOTEQUORUM_QDEVICE_MAX_NAME_LEN.

◆ votequorum_setexpected()

cs_error_t votequorum_setexpected ( votequorum_handle_t  handle,
unsigned int  expected_votes 
)

set expected_votes

Parameters
handle
expected_votes
Returns

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

References hdb_error_to_cs().

◆ votequorum_setvotes()

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

set votes for a node

Parameters
handle
nodeid
votes
Returns

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

References hdb_error_to_cs().

◆ votequorum_trackstart()

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

Track node and quorum changes.

Parameters
handle
context
flags
Returns

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

References hdb_error_to_cs().

◆ 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 hdb_error_to_cs().