MySQL 26.10.0
Source Code Documentation
mrs_component_status_vars.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2026, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef MRS_COMPONENT_STATUS_VARS_H
27#define MRS_COMPONENT_STATUS_VARS_H
28
29#include <mutex>
30#include <string>
31
33
34namespace mrs_component {
35
36struct Statusvar {
37 Statusvar() = default;
38
39 SHOW_VAR var{.name = nullptr,
40 .value = nullptr,
41 .type = SHOW_UNDEF,
42 .scope = SHOW_SCOPE_UNDEF};
43 bool registered{false};
44};
45
46/**
47 Owns and manages status variables exposed by the MRS component.
48*/
50 public:
51 StatusVars() = default;
52 ~StatusVars() = default;
53 StatusVars(const StatusVars &) = delete;
54 StatusVars &operator=(const StatusVars &) = delete;
55 StatusVars(StatusVars &&) = delete;
57
58 int initialize_all();
59 int register_all();
60 int unregister_all();
61
62 void publish_current_runtime_values(unsigned long http_port,
63 std::string tls_cert, std::string tls_key,
64 std::string tls_cipher,
65 unsigned long io_worker_threads);
67
68 private:
70 unsigned long http_port{0};
71 std::string tls_cert;
72 std::string tls_key;
73 std::string tls_cipher;
74 unsigned long io_worker_threads{0};
75 };
76
77 int register_status_var(Statusvar &statusvar) const;
78 int unregister_status_var(Statusvar &statusvar) const;
79
80 static int show_current_http_port(MYSQL_THD, SHOW_VAR *var, char *buf);
81 static int show_current_tls_cert(MYSQL_THD, SHOW_VAR *var, char *buf);
82 static int show_current_tls_key(MYSQL_THD, SHOW_VAR *var, char *buf);
83 static int show_current_tls_cipher(MYSQL_THD, SHOW_VAR *var, char *buf);
85 char *buf);
86 static int show_state(MYSQL_THD, SHOW_VAR *var, char *buf);
87
90
97
98 // Null terminator for the SHOW_VAR array
100};
101
102} // namespace mrs_component
103
104#endif // MRS_COMPONENT_STATUS_VARS_H
#define MYSQL_THD
Definition: backup_page_tracker.h:38
Owns and manages status variables exposed by the MRS component.
Definition: mrs_component_status_vars.h:49
StatusVars & operator=(const StatusVars &)=delete
StatusVars(StatusVars &&)=delete
Statusvar m_current_io_worker_threads
Definition: mrs_component_status_vars.h:95
int unregister_status_var(Statusvar &statusvar) const
Definition: mrs_component_status_vars.cc:210
void clear_current_runtime_values()
Definition: mrs_component_status_vars.cc:124
Statusvar m_current_tls_cipher
Definition: mrs_component_status_vars.h:94
static int show_current_tls_key(MYSQL_THD, SHOW_VAR *var, char *buf)
Definition: mrs_component_status_vars.cc:151
CurrentRuntimeValues m_current_runtime_values
Definition: mrs_component_status_vars.h:89
Statusvar m_current_tls_cert
Definition: mrs_component_status_vars.h:92
StatusVars & operator=(StatusVars &&)=delete
Statusvar m_null_entry
Definition: mrs_component_status_vars.h:99
void publish_current_runtime_values(unsigned long http_port, std::string tls_cert, std::string tls_key, std::string tls_cipher, unsigned long io_worker_threads)
Definition: mrs_component_status_vars.cc:111
int register_all()
Definition: mrs_component_status_vars.cc:77
static int show_current_http_port(MYSQL_THD, SHOW_VAR *var, char *buf)
Definition: mrs_component_status_vars.cc:129
static int show_state(MYSQL_THD, SHOW_VAR *var, char *buf)
Definition: mrs_component_status_vars.cc:185
int initialize_all()
Definition: mrs_component_status_vars.cc:36
int register_status_var(Statusvar &statusvar) const
Definition: mrs_component_status_vars.cc:195
Statusvar m_state
Definition: mrs_component_status_vars.h:96
static int show_current_tls_cert(MYSQL_THD, SHOW_VAR *var, char *buf)
Definition: mrs_component_status_vars.cc:140
std::mutex m_current_runtime_values_mutex
Definition: mrs_component_status_vars.h:88
Statusvar m_current_http_port
Definition: mrs_component_status_vars.h:91
static int show_current_io_worker_threads(MYSQL_THD, SHOW_VAR *var, char *buf)
Definition: mrs_component_status_vars.cc:173
StatusVars(const StatusVars &)=delete
Statusvar m_current_tls_key
Definition: mrs_component_status_vars.h:93
static int show_current_tls_cipher(MYSQL_THD, SHOW_VAR *var, char *buf)
Definition: mrs_component_status_vars.cc:162
int unregister_all()
Definition: mrs_component_status_vars.cc:99
Definition: buf0block_hint.cc:30
Definition: mrs_component.cc:137
@ SHOW_UNDEF
Definition: status_variables_bits.h:33
@ SHOW_SCOPE_UNDEF
Definition: status_variables_bits.h:71
SHOW STATUS Server status variable.
Definition: status_variables_bits.h:81
const char * name
Definition: status_variables_bits.h:82
Definition: mrs_component_status_vars.h:69
std::string tls_cert
Definition: mrs_component_status_vars.h:71
unsigned long http_port
Definition: mrs_component_status_vars.h:70
std::string tls_key
Definition: mrs_component_status_vars.h:72
std::string tls_cipher
Definition: mrs_component_status_vars.h:73
unsigned long io_worker_threads
Definition: mrs_component_status_vars.h:74
Definition: mrs_component_status_vars.h:36
SHOW_VAR var
Definition: mrs_component_status_vars.h:39
bool registered
Definition: mrs_component_status_vars.h:43