26#ifndef ROUTER_MYSQL_ROUTER_INCLUDED
27#define ROUTER_MYSQL_ROUTER_INCLUDED
119 const std::vector<std::string> &arguments,
120 std::ostream &out_stream = std::cout,
121 std::ostream &err_stream = std::cerr
150 MySQLRouter(
const int argc,
char **argv, std::ostream &out_stream,
151 std::ostream &err_stream
180 bool raw_mode =
false,
bool use_os_log =
false);
292#if !defined(_MSC_VER) && !defined(UNIT_TESTS)
324 virtual void init(
const std::string &program_name,
325 const std::vector<std::string> &arguments);
382 const
std::
string &save_name,
383 const
std::
string &option_value);
408 const
int min, const
int max) const;
424 void show_usage(
bool include_options) noexcept;
454 const
std::
string &metadata_server_uri);
516 std::unique_ptr<mysql_harness::Loader>
loader_;
577 FRIEND_TEST(Bug24909259, PasswordPrompt_plain);
578 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:75
std::ostream & out_stream_
Definition: router_app.h:552
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:873
void stop()
Stop and cleanup the MySQL Router application.
Definition: router_app.cc:776
void init_dynamic_state(mysql_harness::Config &config)
Definition: router_app.cc:350
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:288
bool showing_info_
Whether we are showing information on command line, for example, using –help or –version.
Definition: router_app.h:521
void prepare_command_options() noexcept
Prepares a command line option.
Definition: router_app.cc:936
uint32_t get_router_id(mysql_harness::Config &config)
Definition: router_app.cc:308
std::vector< std::string > check_config_files()
Finds all valid configuration files.
Definition: router_app.cc:814
std::string get_package_name() noexcept
void show_help()
Shows the help screen on the console.
Definition: router_app.cc:1924
bool core_file_
Definition: router_app.h:555
std::string bootstrap_uri_
Value of the argument passed to the -B or –bootstrap command line option for bootstrapping.
Definition: router_app.h:526
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:540
void parse_command_options(const std::vector< std::string > &arguments)
Process command line options.
Definition: router_app.cc:210
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:560
std::string username_
Value of the –user parameter given on the command line.
Definition: router_app.h:567
std::vector< std::string > extra_config_files_
Vector with extra configuration file locations as strings.
Definition: router_app.h:505
virtual void init(const std::string &program_name, const std::vector< std::string > &arguments)
Initializes the MySQL Router application.
Definition: router_app.cc:222
void init_keyring(mysql_harness::Config &config)
Definition: router_app.cc:324
mysql_harness::LoaderConfig * make_config(const std::map< std::string, std::string > params, const std::vector< std::string > &config_files)
Definition: router_app.cc:481
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:880
bool pid_file_created_
Definition: router_app.h:511
std::map< std::string, std::string > bootstrap_options_
key/value map of additional configuration options for bootstrap
Definition: router_app.h:534
std::map< std::string, std::string > get_default_paths() const
Definition: router_app.cc:409
void init_keyring_using_external_facility(mysql_harness::Config &config)
Initializes keyring using master-key-reader and master-key-writer.
Definition: router_app.cc:363
KeyringInfo keyring_info_
Definition: router_app.h:550
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:857
const std::vector< std::string > & get_default_config_files() const noexcept
Gets list of default configuration files.
Definition: router_app.h:266
std::unique_ptr< mysql_harness::Loader > loader_
Harness loader.
Definition: router_app.h:516
std::string pid_file_path_
PID file location.
Definition: router_app.h:510
void init_keyring_using_prompted_password()
Initializes keyring using password read from STDIN.
Definition: router_app.cc:381
CmdArgHandler arg_handler_
CmdArgHandler object handling command line arguments.
Definition: router_app.h:514
std::string get_version() noexcept
Returns the MySQL Router version as string.
Definition: router_app.cc:805
mysql_harness::Path origin_
Path to origin of executable.
Definition: router_app.h:548
mysql_harness::SignalHandler signal_handler_
Definition: router_app.h:574
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:867
std::vector< std::string > default_config_files_
Vector with default configuration file locations as strings.
Definition: router_app.h:503
const std::vector< std::string > & get_config_files() const noexcept
Gets list of configuration files passed using command line.
Definition: router_app.h:277
void init_keyring_using_master_key_file()
Initializes keyring using master key file.
Definition: router_app.cc:376
std::string bootstrap_directory_
Valueof the argument passed to the –directory command line option.
Definition: router_app.h:530
void start()
Starts the MySQL Router application.
Definition: router_app.cc:519
MySQLRouter()
Default constructor.
Definition: router_app.h:87
std::vector< std::string > config_files_
Vector with configuration files passed through command line arguments.
Definition: router_app.h:508
virtual ~MySQLRouter()=default
void show_usage() noexcept
Definition: router_app.cc:2109
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:415
std::ostream & err_stream_
Definition: router_app.h:553
void set_default_config_files(const char *locations) noexcept
Sets default configuration file locations.
Definition: router_app.cc:787
mysqlrouter::SysUserOperationsBase * sys_user_operations_
Pointer to the object to be used to perform system specific user-related operations.
Definition: router_app.h:571
void init_loader(mysql_harness::LoaderConfig &config)
Definition: router_app.cc:507
bool can_start_
Whether the MySQLRouter can start or not.
Definition: router_app.h:518
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:500
std::string get_version_line() noexcept
Returns string version details.
Definition: router_app.cc:807
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:582
silent_exception()
Definition: router_app.h:584
Definition: bootstrap.cc:70
Definition: gcs_xcom_synode.h:64
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2875
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2893
static const size_t kHelpScreenWidth
Definition: router_app.h:49
static const size_t kHelpScreenIndent
Definition: router_app.h:50