MySQL 26.10.0
Source Code Documentation
health_monitor_configuration.h
Go to the documentation of this file.
1/* Copyright (c) 2026, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#pragma once
25
26#include <cstddef>
27#include <cstring>
28#include <filesystem>
29#include <string>
30
31namespace hm::configuration {
32
33constexpr char k_disk_monitored_default[]{""};
34constexpr bool k_disk_fallback_enable_default{false};
35// FN_REFLEN from my_io.h, which components cannot include
36constexpr size_t k_max_monitored_path_length{512};
37
38/** Convert a Disk Forecaster report interval from minutes to seconds. */
39constexpr int report_interval_seconds(int minutes) { return minutes * 60; }
40
41/** Return true if a string meets the configured length and content limits. */
42inline bool valid_configuration_string(const char *value, size_t length,
43 size_t maximum_length,
44 bool allow_empty) {
45 return value != nullptr && length <= maximum_length &&
46 (allow_empty || length != 0) &&
47 std::memchr(value, '\0', length) == nullptr;
48}
49
50/** Return true if a monitored path is empty or a valid absolute path. */
51inline bool valid_monitored_path(const char *path, size_t length) {
53 true)) {
54 return false;
55 }
56 return length == 0 ||
58}
59
60} // namespace hm::configuration
static char * path
Definition: mysqldump.cc:153
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
Definition: health_monitor_configuration-t.cc:31
bool valid_configuration_string(const char *value, size_t length, size_t maximum_length, bool allow_empty)
Return true if a string meets the configured length and content limits.
Definition: health_monitor_configuration.h:42
constexpr int report_interval_seconds(int minutes)
Convert a Disk Forecaster report interval from minutes to seconds.
Definition: health_monitor_configuration.h:39
bool valid_monitored_path(const char *path, size_t length)
Return true if a monitored path is empty or a valid absolute path.
Definition: health_monitor_configuration.h:51
constexpr size_t k_max_monitored_path_length
Definition: health_monitor_configuration.h:36
constexpr bool k_disk_fallback_enable_default
Definition: health_monitor_configuration.h:34
constexpr char k_disk_monitored_default[]
Definition: health_monitor_configuration.h:33
std::chrono::minutes minutes
Definition: authorize_manager.cc:72
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
bool is_absolute(const std::string &path)
Checks if path is absolute.
Definition: utils_path_unix.cc:204