26#ifndef ROUTER_MYSQL_ROUTER_INCLUDED
27#define ROUTER_MYSQL_ROUTER_INCLUDED
122 const std::vector<std::string> &arguments,
123 std::ostream &out_stream = std::cout,
124 std::ostream &err_stream = std::cerr
153 MySQLRouter(
const int argc,
char **argv, std::ostream &out_stream,
154 std::ostream &err_stream
183 bool raw_mode =
false,
bool use_os_log =
false);
295#if !defined(_MSC_VER) && !defined(UNIT_TESTS)
327 virtual void init(
const std::string &program_name,
328 const std::vector<std::string> &arguments);
385 const
std::
string &save_name,
386 const
std::
string &option_value);
411 const
int min, const
int max) const;
427 void show_usage(
bool include_options) noexcept;
457 const
std::
string &metadata_server_uri,
458 const
std::
string &plugin_folder = "");
520 std::unique_ptr<mysql_harness::Loader>
loader_;
581 FRIEND_TEST(Bug24909259, PasswordPrompt_plain);
582 FRIEND_TEST(Bug24909259, PasswordPrompt_keyed);
Defining the commandline argument handler class CmdArgHandler.
Handles command line arguments.
Definition: arg_handler.h:141
KeyringInfo class encapsulates loading and storing master key using master-key-reader and master-key-...
Definition: keyring_info.h:76
Manage the MySQL Router application.
Definition: router_app.h:78
std::ostream & out_stream_
Definition: router_app.h:556
void assert_not_bootstrap_mode(const std::string &option_name) const
verify that option given by user is not used with bootstrap option (–bootstrap or -B).
Definition: router_app.cc:898
void stop()
Stop and cleanup the MySQL Router application.
Definition: router_app.cc:801
void init_dynamic_state(mysql_harness::Config &config)
Definition: router_app.cc:371
const std::vector< std::string > & get_extra_config_files() const noexcept
Gets list of extra configuration files passed using command line.
Definition: router_app.h:291
bool showing_info_
Whether we are showing information on command line, for example, using –help or –version.
Definition: router_app.h:525
void prepare_command_options() noexcept
Prepares a command line option.
Definition: router_app.cc:961
uint32_t get_router_id(mysql_harness::Config &config)
Definition: router_app.cc:329
std::vector< std::string > check_config_files()
Finds all valid configuration files.
Definition: router_app.cc:839
std::string get_package_name() noexcept
void show_help()
Shows the help screen on the console.
Definition: router_app.cc:1961
bool core_file_
Definition: router_app.h:559
std::string bootstrap_uri_
Value of the argument passed to the -B or –bootstrap command line option for bootstrapping.
Definition: router_app.h:530
std::map< std::string, std::vector< std::string > > bootstrap_multivalue_options_
key/list-of-values map of additional configuration options for bootstrap
Definition: router_app.h:544
void parse_command_options(const std::vector< std::string > &arguments)
Process command line options.
Definition: router_app.cc:228
std::string user_cmd_line_
Value of the –user parameter given on the command line if router is launched in bootstrap mode.
Definition: router_app.h:564
std::string username_
Value of the –user parameter given on the command line.
Definition: router_app.h:571
std::vector< std::string > extra_config_files_
Vector with extra configuration file locations as strings.
Definition: router_app.h:509
virtual void init(const std::string &program_name, const std::vector< std::string > &arguments)
Initializes the MySQL Router application.
Definition: router_app.cc:240
void init_keyring(mysql_harness::Config &config)
Definition: router_app.cc:345
mysql_harness::LoaderConfig * make_config(const std::map< std::string, std::string > params, const std::vector< std::string > &config_files)
Definition: router_app.cc:504
void assert_option_value_in_range(const std::string &option_value, const int min, const int max) const
verify that option given by user is an integer value in the given range.
Definition: router_app.cc:905
bool pid_file_created_
Definition: router_app.h:515
std::map< std::string, std::string > bootstrap_options_
key/value map of additional configuration options for bootstrap
Definition: router_app.h:538
std::map< std::string, std::string > get_default_paths() const
Definition: router_app.cc:431
void init_keyring_using_external_facility(mysql_harness::Config &config)
Initializes keyring using master-key-reader and master-key-writer.
Definition: router_app.cc:385
KeyringInfo keyring_info_
Definition: router_app.h:554
void save_bootstrap_option_not_empty(const std::string &option_name, const std::string &save_name, const std::string &option_value)
Saves the selected command line option in the internal options array after verifying it's value not e...
Definition: router_app.cc:882
const std::vector< std::string > & get_default_config_files() const noexcept
Gets list of default configuration files.
Definition: router_app.h:269
std::unique_ptr< mysql_harness::Loader > loader_
Harness loader.
Definition: router_app.h:520
std::string pid_file_path_
PID file location.
Definition: router_app.h:514
void init_keyring_using_prompted_password()
Initializes keyring using password read from STDIN.
Definition: router_app.cc:403
CmdArgHandler arg_handler_
CmdArgHandler object handling command line arguments.
Definition: router_app.h:518
std::string get_version() noexcept
Returns the MySQL Router version as string.
Definition: router_app.cc:830
mysql_harness::Path origin_
Path to origin of executable.
Definition: router_app.h:552
mysql_harness::SignalHandler signal_handler_
Definition: router_app.h:578
void assert_bootstrap_mode(const std::string &option_name) const
verify that bootstrap option (–bootstrap or -B) was given by user.
Definition: router_app.cc:892
std::vector< std::string > default_config_files_
Vector with default configuration file locations as strings.
Definition: router_app.h:507
const std::vector< std::string > & get_config_files() const noexcept
Gets list of configuration files passed using command line.
Definition: router_app.h:280
void init_keyring_using_master_key_file()
Initializes keyring using master key file.
Definition: router_app.cc:398
std::string bootstrap_directory_
Valueof the argument passed to the –directory command line option.
Definition: router_app.h:534
void start()
Starts the MySQL Router application.
Definition: router_app.cc:543
MySQLRouter()
Default constructor.
Definition: router_app.h:90
std::vector< std::string > config_files_
Vector with configuration files passed through command line arguments.
Definition: router_app.h:512
virtual ~MySQLRouter()=default
void show_usage() noexcept
Definition: router_app.cc:2146
static void init_main_logger(mysql_harness::LoaderConfig &config, bool raw_mode=false, bool use_os_log=false)
Initialize main logger.
Definition: router_app.cc:437
std::ostream & err_stream_
Definition: router_app.h:557
void set_default_config_files(const char *locations) noexcept
Sets default configuration file locations.
Definition: router_app.cc:812
mysqlrouter::SysUserOperationsBase * sys_user_operations_
Pointer to the object to be used to perform system specific user-related operations.
Definition: router_app.h:575
void init_loader(mysql_harness::LoaderConfig &config)
Definition: router_app.cc:530
bool can_start_
Whether the MySQLRouter can start or not.
Definition: router_app.h:522
std::tuple< const uint8_t, const uint8_t, const uint8_t > version_
Tuple describing the MySQL Router version, with major, minor and patch level.
Definition: router_app.h:504
std::string get_version_line() noexcept
Returns string version details.
Definition: router_app.cc:832
Configuration section.
Definition: config_parser.h:141
Configuration file handler for the loader.
Definition: loader_config.h:46
Class representing a path in a file system.
Definition: filesystem.h:63
Definition: signal_handler.h:41
Base class to allow multiple SysUserOperations implementations.
Definition: sys_user_operations.h:45
static SysUserOperations * instance()
Definition: sys_user_operations.cc:49
Definition: router_app.h:586
silent_exception()
Definition: router_app.h:588
Definition: bootstrap.cc:71
Definition: gcs_xcom_synode.h:64
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2874
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2892
static const size_t kHelpScreenWidth
Definition: router_app.h:49
static const std::string kDefaultSystemUserName
Definition: router_app.h:53
static const std::string kSystemRouterName
Definition: router_app.h:52
static const size_t kHelpScreenIndent
Definition: router_app.h:50
void expose_router_configuration(const bool initial, const mysql_harness::ConfigSection §ion)
Expose the configured application-level options (the ones from [DEFAULT] section that are not specifi...
Definition: router_app.cc:2205