pacemaker
2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
|
#include <crm_internal.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <crm/msg_xml.h>
#include <crm/common/xml.h>
#include <crm/common/mainloop.h>
#include <crm/cluster/internal.h>
#include <crm/cluster/election_internal.h>
#include <crm/crm.h>
Go to the source code of this file.
Macros | |
#define | STORM_INTERVAL 2 /* in seconds */ |
#define | LOSS_DAMPEN 2 /* in seconds */ |
Functions | |
enum election_result | election_state (const election_t *e) |
Get current state of an election. More... | |
election_t * | election_init (const char *name, const char *uname, guint period_ms, GSourceFunc cb) |
Create a new election object. More... | |
void | election_remove (election_t *e, const char *uname) |
Disregard any previous vote by specified peer. More... | |
void | election_reset (election_t *e) |
Stop election timer and disregard all votes. More... | |
void | election_fini (election_t *e) |
Free an election object. More... | |
void | election_timeout_stop (election_t *e) |
Stop an election's timer, if running. More... | |
void | election_timeout_set_period (election_t *e, guint period) |
Change an election's timeout (restarting timer if running) More... | |
void | election_vote (election_t *e) |
Start a new election by offering local node's candidacy. More... | |
bool | election_check (election_t *e) |
Check whether local node has won an election. More... | |
enum election_result | election_count_vote (election_t *e, const xmlNode *message, bool can_win) |
Process an election message (vote or no-vote) from a peer. More... | |
void | election_clear_dampening (election_t *e) |
Reset any election dampening currently in effect. More... | |
Variables | |
struct election_s | __attribute__ |
#define LOSS_DAMPEN 2 /* in seconds */ |
Definition at line 399 of file election.c.
#define STORM_INTERVAL 2 /* in seconds */ |
Definition at line 23 of file election.c.
bool election_check | ( | election_t * | e | ) |
Check whether local node has won an election.
If all known peers have sent no-vote messages, stop the election timer, set the election state to won, and call any registered win callback.
[in,out] | e | Election object |
election_in_progress
. Definition at line 343 of file election.c.
void election_clear_dampening | ( | election_t * | e | ) |
Reset any election dampening currently in effect.
[in,out] | e | Election object to clear |
Definition at line 724 of file election.c.
enum election_result election_count_vote | ( | election_t * | e, |
const xmlNode * | message, | ||
bool | can_win | ||
) |
Process an election message (vote or no-vote) from a peer.
[in,out] | e | Election object |
[in] | message | Election message XML from peer |
[in] | can_win | Whether local node is eligible to win |
Definition at line 534 of file election.c.
void election_fini | ( | election_t * | e | ) |
Free an election object.
Free all memory associated with an election object, stopping its election timer (if running).
[in,out] | e | Election object |
Definition at line 165 of file election.c.
election_t* election_init | ( | const char * | name, |
const char * | uname, | ||
guint | period_ms, | ||
GSourceFunc | cb | ||
) |
Create a new election object.
Every node that wishes to participate in an election must create an election object. Typically, this should be done once, at start-up. A caller should only create a single election object.
[in] | name | Label for election (for logging) |
[in] | uname | Local node's name |
[in] | period_ms | How long to wait for all peers to vote |
[in] | cb | Function to call if local node wins election |
Definition at line 89 of file election.c.
void election_remove | ( | election_t * | e, |
const char * | uname | ||
) |
Disregard any previous vote by specified peer.
This discards any recorded vote from a specified peer. Election users should call this whenever a voting peer becomes inactive.
[in,out] | e | Election object |
[in] | uname | Name of peer to disregard |
Definition at line 129 of file election.c.
void election_reset | ( | election_t * | e | ) |
Stop election timer and disregard all votes.
[in,out] | e | Election object |
Definition at line 143 of file election.c.
enum election_result election_state | ( | const election_t * | e | ) |
Get current state of an election.
[in] | e | Election object |
Definition at line 67 of file election.c.
void election_timeout_set_period | ( | election_t * | e, |
guint | period | ||
) |
Change an election's timeout (restarting timer if running)
[in,out] | e | Election object |
[in] | period | New timeout |
Definition at line 205 of file election.c.
void election_timeout_stop | ( | election_t * | e | ) |
Stop an election's timer, if running.
[in,out] | e | Election object |
Definition at line 191 of file election.c.
void election_vote | ( | election_t * | e | ) |
Start a new election by offering local node's candidacy.
Broadcast a "vote" election message containing the local node's ID, (incremented) election counter, and uptime, and start the election timer.
[in,out] | e | Election object |
Definition at line 290 of file election.c.
struct pcmk__cpg_msg_s __attribute__ |