MySQL 8.0.29
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
30site_def *clone_site_def(site_def const *site);
31void init_site_def(u_int n, node_address *names, site_def *site);
32void add_site_def(u_int n, node_address *names, site_def *nodes);
33void remove_site_def(u_int n, node_address *names, site_def *nodes);
34char *dbg_site_def(site_def const *site);
35void init_site_vars();
37void free_site_def(site_def *s);
38void free_site_defs();
40site_def const *find_prev_site_def(synode_no synode);
41void garbage_collect_site_defs(synode_no x);
42site_def const *get_site_def();
45uint32_t get_group_id(site_def const *site);
46static uint32_t const null_id = 0;
47node_no get_maxnodes(site_def const *site);
48node_no get_nodeno(site_def const *site);
49node_no find_nodeno(site_def const *site, const char *name);
50node_no get_prev_nodeno();
51site_def const *find_site_def(synode_no synode);
52site_def *find_site_def_rw(synode_no synode);
53site_def const *find_next_site_def(synode_no synode);
54node_set detector_node_set(site_def const *site);
56void import_config(gcs_snapshot *gcs_snap);
57gcs_snapshot *export_config();
58void get_all_site_defs(site_def ***s, uint32_t *n);
59synode_no get_min_delivered_msg(site_def const *s);
60void update_delivered(site_def *s, node_no node, synode_no msgno);
61synode_no config_max_boot_key(gcs_snapshot const *gcs_snap);
62leader_array alloc_leader_array(u_int n);
63leader_array clone_leader_array(leader_array const x);
64synode_no get_highest_boot_key(gcs_snapshot *gcs_snap);
65synode_no get_lowest_boot_key(gcs_snapshot *gcs_snap);
66
67static inline bool_t node_no_exists(node_no n, site_def const *site) {
68 return n < get_maxnodes(site);
69}
70
71static inline bool_t is_local_node(node_no n, site_def const *site) {
72 return node_no_exists(n, site) && n == get_nodeno(site);
73}
74
75/**
76 Finds pointer to server given site and node number.
77 @param[in] s Pointer to site definition
78 @param[in] i Node number
79
80 @retval Pointer to server if success
81 @retval 0 if failure
82*/
83static inline server *get_server(site_def const *s, node_no i) {
84 if (s && i != VOID_NODE_NO && i < s->nodes.node_list_len)
85 return s->servers[i];
86 else
87 return 0;
88}
89
90#endif
#define VOID_NODE_NO
Definition: node_no.h:35
node_no get_maxnodes(site_def const *site)
Definition: site_def.cc:408
site_def const * find_next_site_def(synode_no synode)
Definition: site_def.cc:231
static uint32_t const null_id
Definition: site_def.h:46
synode_no get_min_delivered_msg(site_def const *s)
Definition: site_def.cc:537
node_no get_prev_nodeno()
Definition: site_def.cc:435
void free_site_def(site_def *s)
Definition: site_def.cc:98
int enough_live_nodes(site_def *site)
Definition: xcom_detector.cc:167
site_def const * find_site_def(synode_no synode)
Definition: site_def.cc:194
site_def const * find_prev_site_def(synode_no synode)
Definition: site_def.cc:250
void init_site_vars()
Definition: site_def.cc:76
site_def const * get_site_def()
Definition: site_def.cc:177
node_no get_nodeno(site_def const *site)
Definition: site_def.cc:421
static bool_t is_local_node(node_no n, site_def const *site)
Definition: site_def.h:71
void get_all_site_defs(site_def ***s, uint32_t *n)
Definition: site_def.cc:70
synode_no get_highest_boot_key(gcs_snapshot *gcs_snap)
Definition: site_def.cc:571
void init_site_def(u_int n, node_address *names, site_def *site)
Definition: site_def.cc:342
node_no find_nodeno(site_def const *site, const char *name)
Definition: site_def.cc:424
node_set detector_node_set(site_def const *site)
Definition: xcom_detector.cc:356
site_def * get_site_def_rw()
Definition: site_def.cc:156
site_def const * get_prev_site_def()
Definition: site_def.cc:182
gcs_snapshot * export_config()
Definition: site_def.cc:500
void add_site_def(u_int n, node_address *names, site_def *nodes)
Definition: site_def.cc:371
static server * get_server(site_def const *s, node_no i)
Finds pointer to server given site and node number.
Definition: site_def.h:83
void remove_site_def(u_int n, node_address *names, site_def *nodes)
Definition: site_def.cc:380
void import_config(gcs_snapshot *gcs_snap)
Definition: site_def.cc:454
synode_no config_max_boot_key(gcs_snapshot const *gcs_snap)
Definition: site_def.cc:438
static bool_t node_no_exists(node_no n, site_def const *site)
Definition: site_def.h:67
char * dbg_site_def(site_def const *site)
Definition: site_def.cc:288
leader_array clone_leader_array(leader_array const x)
Definition: site_def.cc:313
void free_site_def_body(site_def *s)
Definition: site_def.cc:86
site_def * new_site_def()
Definition: site_def.cc:295
site_def * push_site_def(site_def *s)
Definition: site_def.cc:116
site_def * find_site_def_rw(synode_no synode)
Definition: site_def.cc:209
synode_no get_lowest_boot_key(gcs_snapshot *gcs_snap)
uint32_t get_group_id(site_def const *site)
Definition: site_def.cc:389
site_def * clone_site_def(site_def const *site)
Definition: site_def.cc:324
void update_delivered(site_def *s, node_no node, synode_no msgno)
Definition: site_def.cc:559
void free_site_defs()
Definition: site_def.cc:106
void garbage_collect_site_defs(synode_no x)
Definition: site_def.cc:264
leader_array alloc_leader_array(u_int n)
Definition: site_def.cc:305
case opt name
Definition: sslopt-case.h:32
Definition: server_struct.h:38
Definition: site_struct.h:42
server * servers[NSERVERS]
Definition: site_struct.h:48
__u_int u_int
Definition: types.h:72
int bool_t
Definition: types.h:34
int n
Definition: xcom_base.cc:505