MySQL 8.0.39
Source Code Documentation
site_def.h
Go to the documentation of this file.
1/* Copyright (c) 2015, 2024, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef SITE_DEF_H
25#define SITE_DEF_H
26
27#include "xcom/node_no.h"
28#include "xcom/site_struct.h"
29
31site_def *clone_site_def(site_def const *site);
32void init_site_def(u_int n, node_address *names, site_def *site);
33void add_site_def(u_int n, node_address *names, site_def *nodes);
34void remove_site_def(u_int n, node_address *names, site_def *nodes);
35char *dbg_site_def(site_def const *site);
36void init_site_vars();
38void free_site_def(site_def *s);
39void free_site_defs();
41site_def const *find_prev_site_def(synode_no synode);
42void garbage_collect_site_defs(synode_no x);
43site_def const *get_site_def();
46uint32_t get_group_id(site_def const *site);
47static uint32_t const null_id = 0;
48node_no get_maxnodes(site_def const *site);
49node_no get_nodeno(site_def const *site);
50node_no find_nodeno(site_def const *site, const char *name);
51node_no get_prev_nodeno();
52site_def const *find_site_def(synode_no synode);
53site_def *find_site_def_rw(synode_no synode);
54site_def const *find_next_site_def(synode_no synode);
55node_set detector_node_set(site_def const *site);
57void import_config(gcs_snapshot *gcs_snap);
58gcs_snapshot *export_config();
59void get_all_site_defs(site_def ***s, uint32_t *n);
60synode_no get_min_delivered_msg(site_def const *s);
61void update_delivered(site_def *s, node_no node, synode_no msgno);
62synode_no config_max_boot_key(gcs_snapshot const *gcs_snap);
63leader_array alloc_leader_array(u_int n);
64leader_array clone_leader_array(leader_array const x);
65synode_no get_highest_boot_key(gcs_snapshot *gcs_snap);
66synode_no get_lowest_boot_key(gcs_snapshot *gcs_snap);
67
68static inline bool_t node_no_exists(node_no n, site_def const *site) {
69 return n < get_maxnodes(site);
70}
71
72static inline bool_t is_local_node(node_no n, site_def const *site) {
73 return node_no_exists(n, site) && n == get_nodeno(site);
74}
75
76/**
77 Finds pointer to server given site and node number.
78 @param[in] s Pointer to site definition
79 @param[in] i Node number
80
81 @retval Pointer to server if success
82 @retval 0 if failure
83*/
84static inline server *get_server(site_def const *s, node_no i) {
85 if (s && i != VOID_NODE_NO && i < s->nodes.node_list_len)
86 return s->servers[i];
87 else
88 return nullptr;
89}
90
91#endif
#define VOID_NODE_NO
Definition: node_no.h:36
node_no get_maxnodes(site_def const *site)
Definition: site_def.cc:409
site_def const * find_next_site_def(synode_no synode)
Definition: site_def.cc:232
static uint32_t const null_id
Definition: site_def.h:47
synode_no get_min_delivered_msg(site_def const *s)
Definition: site_def.cc:538
node_no get_prev_nodeno()
Definition: site_def.cc:436
void free_site_def(site_def *s)
Definition: site_def.cc:99
int enough_live_nodes(site_def *site)
Definition: xcom_detector.cc:168
site_def const * find_site_def(synode_no synode)
Definition: site_def.cc:195
site_def const * find_prev_site_def(synode_no synode)
Definition: site_def.cc:251
void init_site_vars()
Definition: site_def.cc:77
site_def const * get_site_def()
Definition: site_def.cc:178
node_no get_nodeno(site_def const *site)
Definition: site_def.cc:422
static bool_t is_local_node(node_no n, site_def const *site)
Definition: site_def.h:72
void get_all_site_defs(site_def ***s, uint32_t *n)
Definition: site_def.cc:71
synode_no get_highest_boot_key(gcs_snapshot *gcs_snap)
Definition: site_def.cc:572
void init_site_def(u_int n, node_address *names, site_def *site)
Definition: site_def.cc:343
node_no find_nodeno(site_def const *site, const char *name)
Definition: site_def.cc:425
node_set detector_node_set(site_def const *site)
Definition: xcom_detector.cc:357
site_def * get_site_def_rw()
Definition: site_def.cc:157
site_def const * get_prev_site_def()
Definition: site_def.cc:183
gcs_snapshot * export_config()
Definition: site_def.cc:501
void add_site_def(u_int n, node_address *names, site_def *nodes)
Definition: site_def.cc:372
static server * get_server(site_def const *s, node_no i)
Finds pointer to server given site and node number.
Definition: site_def.h:84
void remove_site_def(u_int n, node_address *names, site_def *nodes)
Definition: site_def.cc:381
void import_config(gcs_snapshot *gcs_snap)
Definition: site_def.cc:455
synode_no config_max_boot_key(gcs_snapshot const *gcs_snap)
Definition: site_def.cc:439
static bool_t node_no_exists(node_no n, site_def const *site)
Definition: site_def.h:68
char * dbg_site_def(site_def const *site)
Definition: site_def.cc:289
leader_array clone_leader_array(leader_array const x)
Definition: site_def.cc:314
void free_site_def_body(site_def *s)
Definition: site_def.cc:87
site_def * new_site_def()
Definition: site_def.cc:296
site_def * push_site_def(site_def *s)
Definition: site_def.cc:117
site_def * find_site_def_rw(synode_no synode)
Definition: site_def.cc:210
synode_no get_lowest_boot_key(gcs_snapshot *gcs_snap)
uint32_t get_group_id(site_def const *site)
Definition: site_def.cc:390
site_def * clone_site_def(site_def const *site)
Definition: site_def.cc:325
void update_delivered(site_def *s, node_no node, synode_no msgno)
Definition: site_def.cc:560
void free_site_defs()
Definition: site_def.cc:107
void garbage_collect_site_defs(synode_no x)
Definition: site_def.cc:265
leader_array alloc_leader_array(u_int n)
Definition: site_def.cc:306
case opt name
Definition: sslopt-case.h:33
Definition: server_struct.h:39
Definition: site_struct.h:43
server * servers[NSERVERS]
Definition: site_struct.h:49
__u_int u_int
Definition: types.h:73
int bool_t
Definition: types.h:35
int n
Definition: xcom_base.cc:509