pacemaker  2.1.4-dc6eb4362
Scalable High-Availability cluster resource manager
election_internal.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 
56 typedef struct election_s election_t;
57 
65 };
66 
67 void election_fini(election_t *e);
68 void election_reset(election_t *e);
69 election_t *election_init(const char *name, const char *uname, guint period_ms, GSourceFunc cb);
70 
71 void election_timeout_set_period(election_t *e, guint period_ms);
73 
74 void election_vote(election_t *e);
75 bool election_check(election_t *e);
76 void election_remove(election_t *e, const char *uname);
78 enum election_result election_count_vote(election_t *e, xmlNode *vote, bool can_win);
80 
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif
void election_vote(election_t *e)
Start a new election by offering local node's candidacy.
Definition: election.c:289
const char * name
Definition: cib.c:24
void election_reset(election_t *e)
Stop election timer and disregard all votes.
Definition: election.c:143
bool election_check(election_t *e)
Check whether local node has won an election.
Definition: election.c:342
void election_timeout_stop(election_t *e)
Stop an election's timer, if running.
Definition: election.c:191
struct election_s election_t
void election_timeout_set_period(election_t *e, guint period_ms)
Change an election's timeout (restarting timer if running)
Definition: election.c:205
election_result
void election_remove(election_t *e, const char *uname)
Disregard any previous vote by specified peer.
Definition: election.c:129
void election_clear_dampening(election_t *e)
Reset any election dampening currently in effect.
Definition: election.c:722
void election_fini(election_t *e)
Free an election object.
Definition: election.c:165
char uname[MAX_NAME]
Definition: cpg.c:50
election_t * election_init(const char *name, const char *uname, guint period_ms, GSourceFunc cb)
Create a new election object.
Definition: election.c:89
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:532
enum election_result election_state(election_t *e)
Get current state of an election.
Definition: election.c:67