MySQL 9.0.0
Source Code Documentation
utils.h File Reference
#include "mysqlrouter/router_utils_export.h"
#include <sys/stat.h>
#include <chrono>
#include <cstdint>
#include <functional>
#include <sstream>
#include <string>
#include "my_compiler.h"
#include "mysql/harness/stdx/expected.h"

Go to the source code of this file.

Namespaces

namespace  mysqlrouter
 

Typedefs

using mysqlrouter::perm_mode = mode_t
 

Functions

template<typename T >
std::string mysqlrouter::to_string (const T &data)
 
std::string ROUTER_UTILS_EXPORT mysqlrouter::ms_to_seconds_string (const std::chrono::milliseconds &msec)
 
uint16_t ROUTER_UTILS_EXPORT mysqlrouter::get_tcp_port (const std::string &data)
 Validates a string containing a TCP port. More...
 
std::string mysqlrouter::hexdump (const unsigned char *buffer, size_t count)
 Dumps buffer as hex values. More...
 
std::string ROUTER_UTILS_EXPORT mysqlrouter::prompt_password (const std::string &prompt)
 Prompts for a password from the console. More...
 
void ROUTER_UTILS_EXPORT mysqlrouter::set_prompt_password (const std::function< std::string(const std::string &)> &f)
 Override default prompt password function. More...
 
bool ROUTER_UTILS_EXPORT mysqlrouter::substitute_envvar (std::string &line) noexcept
 Substitutes placeholders of environment variables in a string. More...
 
std::string ROUTER_UTILS_EXPORT mysqlrouter::substitute_variable (const std::string &s, const std::string &name, const std::string &value)
 
bool mysqlrouter::my_check_access (const std::string &path)
 
void ROUTER_UTILS_EXPORT mysqlrouter::copy_file (const std::string &from, const std::string &to)
 Copy contents of one file to another. More...
 
stdx::expected< void, std::error_code > ROUTER_UTILS_EXPORT mysqlrouter::rename_file (const std::string &from, const std::string &to)
 renames file. More...
 
bool ROUTER_UTILS_EXPORT mysqlrouter::is_valid_socket_name (const std::string &socket, std::string &err_msg)
 Returns whether the socket name passed as parameter is valid. More...
 
int ROUTER_UTILS_EXPORT mysqlrouter::strtoi_checked (const char *value, signed int default_result=0) noexcept
 Converts char array to signed integer, intuitively. More...
 
unsigned ROUTER_UTILS_EXPORT mysqlrouter::strtoui_checked (const char *value, unsigned int default_result=0) noexcept
 Converts char array to unsigned integer, intuitively. More...
 
uint64_t ROUTER_UTILS_EXPORT mysqlrouter::strtoull_checked (const char *value, uint64_t default_result=0) noexcept
 

Variables

const perm_mode ROUTER_UTILS_EXPORT mysqlrouter::kStrictDirectoryPerm = S_IRWXU
 Constant for directory accessible only for the owner. More...