MySQL  8.0.26
Source Code Documentation
site_def.h
Go to the documentation of this file.
1 /* Copyright (c) 2015, 2021, Oracle and/or its affiliates.
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 
26 #include "xcom/node_no.h"
27 #include "xcom/site_struct.h"
28 
30 site_def *clone_site_def(site_def const *site);
31 void init_site_def(u_int n, node_address *names, site_def *site);
32 void add_site_def(u_int n, node_address *names, site_def *nodes);
33 void remove_site_def(u_int n, node_address *names, site_def *nodes);
34 char *dbg_site_def(site_def const *site);
35 void init_site_vars();
36 void free_site_def(site_def *s);
37 void free_site_defs();
39 site_def const *find_prev_site_def(synode_no synode);
40 void garbage_collect_site_defs(synode_no x);
41 site_def const *get_site_def();
44 uint32_t get_group_id(site_def const *site);
45 static uint32_t const null_id = 0;
46 node_no get_maxnodes(site_def const *site);
47 node_no get_nodeno(site_def const *site);
48 node_no find_nodeno(site_def const *site, const char *name);
49 node_no get_prev_nodeno();
50 site_def const *find_site_def(synode_no synode);
51 site_def *find_site_def_rw(synode_no synode);
52 site_def const *find_next_site_def(synode_no synode);
53 node_set detector_node_set(site_def const *site);
54 int enough_live_nodes(site_def *site);
55 void import_config(gcs_snapshot *gcs_snap);
56 gcs_snapshot *export_config();
57 void get_all_site_defs(site_def ***s, uint32_t *n);
58 synode_no get_min_delivered_msg(site_def const *s);
59 void update_delivered(site_def *s, node_no node, synode_no msgno);
60 synode_no config_max_boot_key(gcs_snapshot const *gcs_snap);
61 synode_no get_highest_boot_key(gcs_snapshot *gcs_snap);
62 synode_no get_lowest_boot_key(gcs_snapshot *gcs_snap);
63 
64 static inline bool_t node_no_exists(node_no n, site_def const *site) {
65  return n < get_maxnodes(site);
66 }
67 
68 static inline bool_t is_local_node(node_no n, site_def const *site) {
69  return node_no_exists(n, site) && n == get_nodeno(site);
70 }
71 
72 /**
73  Finds pointer to server given site and node number.
74  @param[in] s Pointer to site definition
75  @param[in] i Node number
76 
77  @retval Pointer to server if success
78  @retval 0 if failure
79 */
80 static inline server *get_server(site_def const *s, node_no i) {
81  if (s && i != VOID_NODE_NO && i < s->nodes.node_list_len)
82  return s->servers[i];
83  else
84  return 0;
85 }
86 
87 #endif
#define VOID_NODE_NO
Definition: node_no.h:35
site_def * get_site_def_rw()
Definition: site_def.cc:144
node_no get_maxnodes(site_def const *site)
Definition: site_def.cc:373
static uint32_t const null_id
Definition: site_def.h:45
site_def * find_site_def_rw(synode_no synode)
Definition: site_def.cc:197
site_def * push_site_def(site_def *s)
Definition: site_def.cc:104
char * dbg_site_def(site_def const *site)
Definition: site_def.cc:276
site_def const * find_next_site_def(synode_no synode)
Definition: site_def.cc:219
synode_no get_min_delivered_msg(site_def const *s)
Definition: site_def.cc:498
static server * get_server(site_def const *s, node_no i)
Finds pointer to server given site and node number.
Definition: site_def.h:80
node_no get_prev_nodeno()
Definition: site_def.cc:400
void free_site_def(site_def *s)
Definition: site_def.cc:83
int enough_live_nodes(site_def *site)
Definition: xcom_detector.cc:167
void init_site_vars()
Definition: site_def.cc:74
node_no get_nodeno(site_def const *site)
Definition: site_def.cc:386
static bool_t is_local_node(node_no n, site_def const *site)
Definition: site_def.h:68
void get_all_site_defs(site_def ***s, uint32_t *n)
Definition: site_def.cc:68
synode_no get_highest_boot_key(gcs_snapshot *gcs_snap)
Definition: site_def.cc:532
void init_site_def(u_int n, node_address *names, site_def *site)
Definition: site_def.cc:306
node_no find_nodeno(site_def const *site, const char *name)
Definition: site_def.cc:389
node_set detector_node_set(site_def const *site)
Definition: xcom_detector.cc:353
site_def const * get_prev_site_def()
Definition: site_def.cc:170
void add_site_def(u_int n, node_address *names, site_def *nodes)
Definition: site_def.cc:335
site_def * clone_site_def(site_def const *site)
Definition: site_def.cc:291
void remove_site_def(u_int n, node_address *names, site_def *nodes)
Definition: site_def.cc:344
site_def const * find_site_def(synode_no synode)
Definition: site_def.cc:182
void import_config(gcs_snapshot *gcs_snap)
Definition: site_def.cc:419
synode_no config_max_boot_key(gcs_snapshot const *gcs_snap)
Definition: site_def.cc:403
static bool_t node_no_exists(node_no n, site_def const *site)
Definition: site_def.h:64
site_def const * get_site_def()
Definition: site_def.cc:165
site_def const * find_prev_site_def(synode_no synode)
Definition: site_def.cc:238
synode_no get_lowest_boot_key(gcs_snapshot *gcs_snap)
Definition: site_def.cc:550
site_def * new_site_def()
Definition: site_def.cc:283
uint32_t get_group_id(site_def const *site)
Definition: site_def.cc:354
void update_delivered(site_def *s, node_no node, synode_no msgno)
Definition: site_def.cc:520
gcs_snapshot * export_config()
Definition: site_def.cc:463
void free_site_defs()
Definition: site_def.cc:94
void garbage_collect_site_defs(synode_no x)
Definition: site_def.cc:252
case opt name
Definition: sslopt-case.h:32
Definition: server_struct.h:38
Definition: site_struct.h:29
server * servers[NSERVERS]
Definition: site_struct.h:34
__u_int u_int
Definition: types.h:72
int bool_t
Definition: types.h:34
int n
Definition: xcom_base.cc:445