1 /* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
2 
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License, version 2.0,
5    as published by the Free Software Foundation.
6 
7    This program is also distributed with certain software (including
8    but not limited to OpenSSL) that is licensed under separate terms,
9    as designated in a particular file or component or in included license
10    documentation.  The authors of MySQL hereby grant you an additional
11    permission to link the program and your derivative works with the
12    separately licensed software that they have included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
22 
23 #ifndef PRIMARY_ELECTION_INCLUDE_INCLUDED
24 #define PRIMARY_ELECTION_INCLUDE_INCLUDED
25 
26 /** The server version in which member weight was introduced.*/
27 #define PRIMARY_ELECTION_MEMBER_WEIGHT_VERSION 0x050720
28 /** The server version in which online leader elections were introduced */
29 #define PRIMARY_ELECTION_LEGACY_ALGORITHM_VERSION 0x080013
30 
31 /** Enum for election types */
32 enum enum_primary_election_mode {
33   SAFE_OLD_PRIMARY = 0,    // Migrating from multi primary to single primary
34   UNSAFE_OLD_PRIMARY = 1,  // Changing from one primary to another
35   DEAD_OLD_PRIMARY = 2,    // Old primary died
36   LEGACY_ELECTION_PRIMARY = 3,  // Electing a primary using legacy election
37   ELECTION_MODE_END = 4         // Enum end
38 };
39 
40 /** Enum for election errors */
41 enum enum_primary_election_error {
42   PRIMARY_ELECTION_NO_ERROR = 0,             // No errors
43   PRIMARY_ELECTION_NO_CANDIDATES_ERROR = 1,  // No candidates for election
44   PRIMARY_ELECTION_PROCESS_ERROR = 2,  // There was a problem in the election
45   PRIMARY_ELECTION_ERROR_END = 3       // Enum end
46 };
47 
48 #endif /* PRIMARY_ELECTION_INCLUDE_INCLUDED */
49