pacemaker  3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
election_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2009-2024 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 PCMK__CRM_CLUSTER_ELECTION_INTERNAL__H
11 #define PCMK__CRM_CLUSTER_ELECTION_INTERNAL__H
12 
13 #include <stdbool.h> // bool
14 
15 #include <glib.h> // guint, GSourceFunc
16 #include <libxml/tree.h> // xmlNode
17 
18 #include <crm/common/ipc.h> // enum pcmk_ipc_server
19 #include <crm/cluster.h> // pcmk_cluster_t
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
64 // Possible election results
66  election_start = 0, // New election needed
67  election_in_progress, // Election started but not all peers have voted
68  election_lost, // Local node lost most recent election
69  election_won, // Local node won most recent election
70  election_error, // Election message or object invalid
71 };
72 
73 void election_reset(pcmk_cluster_t *cluster);
74 void election_init(pcmk_cluster_t *cluster, void (*cb)(pcmk_cluster_t *));
75 
76 void election_timeout_set_period(pcmk_cluster_t *cluster, guint period_ms);
78 
79 void election_vote(pcmk_cluster_t *cluster);
80 bool election_check(pcmk_cluster_t *cluster);
81 void election_remove(pcmk_cluster_t *cluster, const char *uname);
82 enum election_result election_state(const pcmk_cluster_t *cluster);
84  const xmlNode *message, bool can_win);
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif // PCMK__CRM_CLUSTER_ELECTION_INTERNAL__H
enum election_result election_count_vote(pcmk_cluster_t *cluster, const xmlNode *message, bool can_win)
Definition: election.c:523
void election_clear_dampening(pcmk_cluster_t *cluster)
Definition: election.c:733
bool election_check(pcmk_cluster_t *cluster)
Definition: election.c:343
void election_timeout_set_period(pcmk_cluster_t *cluster, guint period_ms)
Definition: election.c:195
void election_reset(pcmk_cluster_t *cluster)
Definition: election.c:134
void election_remove(pcmk_cluster_t *cluster, const char *uname)
Definition: election.c:118
election_result
enum election_result election_state(const pcmk_cluster_t *cluster)
Definition: election.c:67
void election_init(pcmk_cluster_t *cluster, void(*cb)(pcmk_cluster_t *))
Definition: election.c:92
char uname[MAX_NAME]
Definition: cpg.c:53
IPC interface to Pacemaker daemons.
void election_vote(pcmk_cluster_t *cluster)
Definition: election.c:278
void election_timeout_stop(pcmk_cluster_t *cluster)
Definition: election.c:180