MySQL  8.0.19
Source Code Documentation
site_def.h
Go to the documentation of this file.
1 /* Copyright (c) 2015, 2018, 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 SITE_DEF_H
24 #define SITE_DEF_H
25 
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
34 site_def *clone_site_def(site_def const *site);
35 void init_site_def(u_int n, node_address *names, site_def *site);
36 void add_site_def(u_int n, node_address *names, site_def *nodes);
37 void remove_site_def(u_int n, node_address *names, site_def *nodes);
38 char *dbg_site_def(site_def const *site);
39 void init_site_vars();
40 void free_site_def(site_def *s);
41 void free_site_defs();
43 site_def const *find_prev_site_def(synode_no synode);
44 void garbage_collect_site_defs(synode_no x);
45 site_def const *get_site_def();
48 synode_no get_boot_key();
49 void set_boot_key(synode_no const x);
50 uint32_t get_group_id(site_def const *site);
51 static uint32_t const null_id = 0;
52 node_no get_maxnodes(site_def const *site);
53 node_no get_nodeno(site_def const *site);
54 node_no find_nodeno(site_def const *site, const char *name);
55 node_no get_prev_maxnodes();
56 node_no get_prev_nodeno();
57 site_def const *find_site_def(synode_no synode);
58 site_def *find_site_def_rw(synode_no synode);
59 site_def const *find_next_site_def(synode_no synode);
60 node_set detector_node_set(site_def const *site);
61 int enough_live_nodes(site_def const *site);
63 site_def *end_site_def(synode_no start);
64 void import_config(gcs_snapshot *gcs_snap);
65 gcs_snapshot *export_config();
66 void get_all_site_defs(site_def ***s, uint32_t *n);
67 synode_no get_min_delivered_msg(site_def const *s);
68 void update_delivered(site_def *s, node_no node, synode_no msgno);
69 synode_no config_max_boot_key(gcs_snapshot const *gcs_snap);
70 
71 static inline bool_t node_no_exists(node_no n, site_def const *site) {
72  return n < get_maxnodes(site);
73 }
74 
75 static inline bool_t is_local_node(node_no n, site_def const *site) {
76  return node_no_exists(n, site) && n == get_nodeno(site);
77 }
78 
79 /**
80  Finds pointer to server given site and node number.
81  @param[in] s Pointer to site definition
82  @param[in] i Node number
83 
84  @return
85  @retval Pointer to server if success
86  @retval 0 if failure
87 */
88 static inline server *get_server(site_def const *s, node_no i) {
89  if (s && i != VOID_NODE_NO && i < s->nodes.node_list_len)
90  return s->servers[i];
91  else
92  return 0;
93 }
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif
get_boot_key
synode_no get_boot_key()
Definition: site_def.c:371
node_no_exists
static bool_t node_no_exists(node_no n, site_def const *site)
Definition: site_def.h:71
find_next_site_def
const site_def * find_next_site_def(synode_no synode)
Definition: site_def.c:233
get_site_def_rw
site_def * get_site_def_rw()
Definition: site_def.c:158
get_prev_nodeno
node_no get_prev_nodeno()
Definition: site_def.c:456
node_no.h
push_site_def
site_def * push_site_def(site_def *s)
Definition: site_def.c:120
find_site_def_rw
site_def * find_site_def_rw(synode_no synode)
Definition: site_def.c:211
bool_t
int bool_t
Definition: types.h:35
add_site_def
void add_site_def(u_int n, node_address *names, site_def *nodes)
Definition: site_def.c:351
site_def::servers
server * servers[NSERVERS]
Definition: site_struct.h:38
find_prev_site_def
const site_def * find_prev_site_def(synode_no synode)
Definition: site_def.c:252
set_boot_key
void set_boot_key(synode_no const x)
Definition: site_def.c:382
init_site_def
void init_site_def(u_int n, node_address *names, site_def *site)
Definition: site_def.c:322
get_prev_site_def
const site_def * get_prev_site_def()
Definition: site_def.c:184
update_delivered
void update_delivered(site_def *s, node_no node, synode_no msgno)
Definition: site_def.c:542
find_site_def
const site_def * find_site_def(synode_no synode)
Definition: site_def.c:196
detector_node_set
node_set detector_node_set(site_def const *site)
Definition: xcom_detector.c:342
free_site_defs
void free_site_defs()
Definition: site_def.c:109
enough_live_nodes
int enough_live_nodes(site_def const *site)
Definition: xcom_detector.c:134
get_min_delivered_msg
synode_no get_min_delivered_msg(site_def const *s)
Definition: site_def.c:520
config_max_boot_key
synode_no config_max_boot_key(gcs_snapshot const *gcs_snap)
Definition: site_def.c:459
null_id
static const uint32_t null_id
Definition: site_def.h:51
find_nodeno
node_no find_nodeno(site_def const *site, const char *name)
Definition: site_def.c:445
get_site_def
const site_def * get_site_def()
Definition: site_def.c:179
get_nodeno
node_no get_nodeno(site_def const *site)
Definition: site_def.c:442
init_site_vars
void init_site_vars()
Definition: site_def.c:88
garbage_collect_site_defs
void garbage_collect_site_defs(synode_no x)
Definition: site_def.c:266
clone_site_def
site_def * clone_site_def(site_def const *site)
Definition: site_def.c:305
begin_site_def
site_def * begin_site_def(site_def *s)
export_config
gcs_snapshot * export_config()
Definition: site_def.c:494
get_group_id
uint32_t get_group_id(site_def const *site)
Definition: site_def.c:393
name
const string name("\"Name\"")
site_def
Definition: site_struct.h:33
remove_site_def
void remove_site_def(u_int n, node_address *names, site_def *nodes)
Definition: site_def.c:360
server
Definition: server_struct.h:42
site_struct.h
dbg_site_def
char * dbg_site_def(site_def const *site)
Definition: site_def.c:290
import_config
void import_config(gcs_snapshot *gcs_snap)
Definition: site_def.c:474
free_site_def
void free_site_def(site_def *s)
Definition: site_def.c:98
get_maxnodes
node_no get_maxnodes(site_def const *site)
Definition: site_def.c:425
start
static void start(PluginFuncEnv *env)
Definition: http_server_plugin.cc:572
n
int n
Definition: xcom_base.c:425
VOID_NODE_NO
#define VOID_NODE_NO
Definition: node_no.h:39
u_int
__u_int u_int
Definition: types.h:73
new_site_def
site_def * new_site_def()
Definition: site_def.c:297
end_site_def
site_def * end_site_def(synode_no start)
Definition: site_def.c:74
get_prev_maxnodes
node_no get_prev_maxnodes()
Definition: site_def.c:428
get_server
static server * get_server(site_def const *s, node_no i)
Finds pointer to server given site and node number.
Definition: site_def.h:88
get_all_site_defs
void get_all_site_defs(site_def ***s, uint32_t *n)
Definition: site_def.c:82
is_local_node
static bool_t is_local_node(node_no n, site_def const *site)
Definition: site_def.h:75