MySQL  8.0.20
Source Code Documentation
Go to the documentation of this file.
1 /* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
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.
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.
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  GNU General Public License, version 2.0, for more details.
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 */
23 #ifndef SITE_DEF_H
24 #define SITE_DEF_H
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
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);
71 static inline bool_t node_no_exists(node_no n, site_def const *site) {
72  return n < get_maxnodes(site);
73 }
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 }
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
84  @retval Pointer to server if success
85  @retval 0 if failure
86 */
87 static inline server *get_server(site_def const *s, node_no i) {
88  if (s && i != VOID_NODE_NO && i < s->nodes.node_list_len)
89  return s->servers[i];
90  else
91  return 0;
92 }
94 #ifdef __cplusplus
95 }
96 #endif
98 #endif
void add_site_def(u_int n, node_address *names, site_def *nodes)
Definition: site_def.c:351
static server * get_server(site_def const *s, node_no i)
Finds pointer to server given site and node number.
Definition: site_def.h:87
void get_all_site_defs(site_def ***s, uint32_t *n)
Definition: site_def.c:82
static bool_t node_no_exists(node_no n, site_def const *site)
Definition: site_def.h:71
Definition: site_struct.h:33
site_def * push_site_def(site_def *s)
Definition: site_def.c:120
site_def * end_site_def(synode_no start)
Definition: site_def.c:74
synode_no get_boot_key()
Definition: site_def.c:371
site_def * get_site_def_rw()
Definition: site_def.c:158
node_no get_prev_nodeno()
Definition: site_def.c:456
site_def const * get_prev_site_def()
Definition: site_def.c:184
void update_delivered(site_def *s, node_no node, synode_no msgno)
Definition: site_def.c:542
void garbage_collect_site_defs(synode_no x)
Definition: site_def.c:266
void set_boot_key(synode_no const x)
Definition: site_def.c:382
int enough_live_nodes(site_def const *site)
Definition: xcom_detector.c:134
synode_no config_max_boot_key(gcs_snapshot const *gcs_snap)
Definition: site_def.c:459
void free_site_defs()
Definition: site_def.c:109
node_set detector_node_set(site_def const *site)
Definition: xcom_detector.c:344
synode_no get_min_delivered_msg(site_def const *s)
Definition: site_def.c:520
void init_site_vars()
Definition: site_def.c:88
uint32_t get_group_id(site_def const *site)
Definition: site_def.c:393
node_no find_nodeno(site_def const *site, const char *name)
Definition: site_def.c:445
gcs_snapshot * export_config()
Definition: site_def.c:494
site_def const * find_prev_site_def(synode_no synode)
Definition: site_def.c:252
static uint32_t const null_id
Definition: site_def.h:51
node_no get_nodeno(site_def const *site)
Definition: site_def.c:442
void remove_site_def(u_int n, node_address *names, site_def *nodes)
Definition: site_def.c:360
case opt name
Definition: sslopt-case.h:32
Definition: server_struct.h:42
site_def const * find_site_def(synode_no synode)
Definition: site_def.c:196
#define VOID_NODE_NO
Definition: node_no.h:39
site_def * begin_site_def(site_def *s)
__u_int u_int
Definition: types.h:73
site_def const * find_next_site_def(synode_no synode)
Definition: site_def.c:233
int n
Definition: xcom_base.c:425
int bool_t
Definition: types.h:35
void import_config(gcs_snapshot *gcs_snap)
Definition: site_def.c:474
node_no get_prev_maxnodes()
Definition: site_def.c:428
site_def * clone_site_def(site_def const *site)
Definition: site_def.c:305
char * dbg_site_def(site_def const *site)
Definition: site_def.c:290
void free_site_def(site_def *s)
Definition: site_def.c:98
node_no get_maxnodes(site_def const *site)
Definition: site_def.c:425
site_def * find_site_def_rw(synode_no synode)
Definition: site_def.c:211
site_def const * get_site_def()
Definition: site_def.c:179
static bool_t is_local_node(node_no n, site_def const *site)
Definition: site_def.h:75
void init_site_def(u_int n, node_address *names, site_def *site)
Definition: site_def.c:322
site_def * new_site_def()
Definition: site_def.c:297
server * servers[NSERVERS]
Definition: site_struct.h:38
static void start(PluginFuncEnv *env)