pacemaker  2.0.2-debe490
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
election.h
Go to the documentation of this file.
1 /*
2  * Copyright 2009-2019 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU Lesser General Public License
7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8  */
9 
10 #ifndef CRM_COMMON_ELECTION__H
11 # define CRM_COMMON_ELECTION__H
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
58 typedef struct election_s election_t;
59 
67 };
68 
69 void election_fini(election_t *e);
70 void election_reset(election_t *e);
71 election_t *election_init(const char *name, const char *uname, guint period_ms, GSourceFunc cb);
72 
73 void election_timeout_set_period(election_t *e, guint period_ms);
75 
76 void election_vote(election_t *e);
77 bool election_check(election_t *e);
78 void election_remove(election_t *e, const char *uname);
80 enum election_result election_count_vote(election_t *e, xmlNode *vote, bool can_win);
82 
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif
bool election_check(election_t *e)
Check whether local node has won an election.
Definition: election.c:337
char uname[MAX_NAME]
Definition: internal.h:87
enum election_result election_count_vote(election_t *e, xmlNode *vote, bool can_win)
Process an election message (vote or no-vote) from a peer.
Definition: election.c:527
void election_remove(election_t *e, const char *uname)
Disregard any previous vote by specified peer.
Definition: election.c:123
void election_fini(election_t *e)
Free an election object.
Definition: election.c:159
void election_vote(election_t *e)
Start a new election by offering local node's candidacy.
Definition: election.c:283
struct election_s election_t
Definition: election.h:58
election_result
Definition: election.h:61
enum election_result election_state(election_t *e)
Definition: election.c:58
void election_clear_dampening(election_t *e)
Reset any election dampening currently in effect.
Definition: election.c:716
election_t * election_init(const char *name, const char *uname, guint period_ms, GSourceFunc cb)
Create a new election object.
Definition: election.c:83
void election_timeout_stop(election_t *e)
Stop an election's timer, if running.
Definition: election.c:185
void election_reset(election_t *e)
Stop election timer and disregard all votes.
Definition: election.c:137
void election_timeout_set_period(election_t *e, guint period_ms)
Change an election's timeout (restarting timer if running)
Definition: election.c:199