615#ifndef MYSQL_HARNESS_LOADER_INCLUDED
616#define MYSQL_HARNESS_LOADER_INCLUDED
622#include "mysql/harness/plugin.h"
624#include "harness_export.h"
685 bool running =
false);
694 void set_running()
noexcept;
698 uint32_t milliseconds)
const noexcept;
702 bool exit_ok()
const noexcept;
703 MY_ATTRIBUTE((format(printf, 3, 0)))
705 std::tuple<std::string, std::exception_ptr> pop_error()
noexcept;
712 ErrorType error_type_ = kNoError;
714 mutable std::condition_variable
cond_;
720 void push_back(std::thread &&thr);
724 void try_stopped(std::exception_ptr &first_exc);
727 plugin_stopped_events_.push(std::move(eptr));
732 void wait_all_stopped(std::exception_ptr &first_exc);
757 : config_(config), program_(
std::move(program)) {}
777 std::list<Config::SectionKey> available()
const;
813 return waitable_services_;
822 after_all_started_ = std::move(func);
831 after_first_finished_ = std::move(func);
842 const std::array<std::string_view, N> &
options) {
843 supported_app_options_.clear();
844 for (
const auto &option :
options) {
845 supported_app_options_.emplace_back(std::string(option));
850 enum class Status { UNVISITED, ONGOING, VISITED };
879 const std::string &library_name);
908 std::exception_ptr init_all();
917 std::exception_ptr stop_and_wait_all();
919 std::exception_ptr stop_all();
925 size_t external_plugins_to_load_count();
934 bool visit(
const std::string &
name, std::map<std::string, Status> *seen,
935 std::list<std::string> *order);
944 PluginInfo(
const std::string &folder,
const std::string &libname);
947 void load_plugin_descriptor(
const std::string &
name);
981 std::map<const ConfigSection *, std::shared_ptr<PluginFuncEnv>>
1006 bool signal_thread_ready_{
false};
1017 void check_config_options_supported();
1026 void check_default_config_options_supported();
1040 friend class ::TestLoader;
A helper class for handling file paths.
Definition: path.h:38
Configuration section.
Definition: config_parser.h:141
A DynamicLibrary.
Definition: dynamic_loader.h:73
Configuration file handler for the loader.
Definition: loader_config.h:46
Holds plugin's API call information.
Definition: loader.h:942
const Plugin * plugin() const
Definition: loader.h:949
DynamicLibrary module_
Definition: loader.h:954
const DynamicLibrary & library() const
Definition: loader.h:951
PluginInfo(const Plugin *const plugin)
Definition: loader.h:945
std::list< std::string > order_
Initialization order.
Definition: loader.h:992
Stage
Flags progress of Loader.
Definition: loader.h:856
std::string logging_folder_
Definition: loader.h:994
const std::vector< std::string > & waitable_services() const
service names to wait on.
Definition: loader.h:812
std::vector< std::string > waitable_services_
Definition: loader.h:1031
std::string data_folder_
Definition: loader.h:998
std::thread signal_thread_
Definition: loader.h:1007
LoaderConfig & config_
Configuration sections for all plugins.
Definition: loader.h:965
LoaderConfig & get_config()
Get reference to configuration object.
Definition: loader.h:796
void after_all_started(std::function< void()> &&func)
set a function that's called after all plugins have been started.
Definition: loader.h:821
std::function< void()> after_all_started_
Definition: loader.h:1034
std::mutex signal_thread_ready_m_
Definition: loader.h:1004
void register_supported_app_options(const std::array< std::string_view, N > &options)
Register global configuration options supported by the application.
Definition: loader.h:841
std::function< void()> after_first_finished_
Definition: loader.h:1037
Loader & operator=(const Loader &)=delete
std::string config_folder_
Definition: loader.h:997
std::condition_variable signal_thread_ready_cond_
Definition: loader.h:1005
Loader(const Loader &)=delete
std::vector< std::string > & waitable_services()
service names to wait on.
Definition: loader.h:805
Loader(std::string program, LoaderConfig &config)
Constructor for Loader.
Definition: loader.h:756
std::map< std::string, PluginInfo > PluginMap
Definition: loader.h:958
std::string program_
Definition: loader.h:999
void after_first_finished(std::function< void()> &&func)
set a function that's called after the first plugin exited.
Definition: loader.h:830
std::string plugin_folder_
Definition: loader.h:995
AppInfo appinfo_
Definition: loader.h:1000
std::vector< std::string > supported_app_options_
Definition: loader.h:1009
Status
Definition: loader.h:850
void spawn_signal_handler_thread()
PluginThreads plugin_threads_
active plugin threads.
Definition: loader.h:987
std::map< const ConfigSection *, std::shared_ptr< PluginFuncEnv > > plugin_start_env_
Map of all {plugin instance -> plugin start() PluginFuncEnv} objects.
Definition: loader.h:982
PluginMap plugins_
Map of all successfully-loaded plugins (without key name).
Definition: loader.h:970
std::string runtime_folder_
Definition: loader.h:996
PluginFuncEnv object.
Definition: loader.h:673
std::mutex mutex_
Definition: loader.h:715
const AppInfo * app_info_
Definition: loader.h:708
bool running_
Definition: loader.h:710
const ConfigSection * config_section_
Definition: loader.h:709
std::string error_message_
Definition: loader.h:711
std::condition_variable cond_
Definition: loader.h:714
size_t running() const
Definition: loader.h:730
WaitingMPSCQueue< std::exception_ptr > plugin_stopped_events_
queue of events after plugin's start() function exited.
Definition: loader.h:745
void push_exit_status(std::exception_ptr &&eptr)
Definition: loader.h:726
std::vector< std::thread > threads_
Definition: loader.h:737
provide waiting pop and push operator to thread-safe queues.
Definition: waiting_queue_adaptor.h:39
error_type
Definition: error.h:36
Fido Client Authentication Plugin
Definition: fido_client_plugin.cc:221
static void start(mysql_harness::PluginFuncEnv *env)
Definition: http_auth_backend_plugin.cc:177
static void run(mysql_harness::PluginFuncEnv *)
Definition: io_plugin.cc:195
Header for compiler-dependent features.
bool load(THD *, const dd::String_type &fname, dd::String_type *buf)
Read an sdi file from disk and store in a buffer.
Definition: sdi_file.cc:308
const ConfigSection * get_config_section(const PluginFuncEnv *env) noexcept
Definition: loader.cc:196
const AppInfo * get_app_info(const PluginFuncEnv *env) noexcept
Definition: loader.cc:192
void set_error(PluginFuncEnv *env, ErrorType error_type, const char *fmt,...) noexcept
Definition: loader.cc:212
std::string join(Container cont, const std::string &delim)
join elements of an container into a string separated by a delimiter.
Definition: string.h:151
bool is_running(const PluginFuncEnv *env) noexcept
Definition: loader.cc:202
bool wait_for_stop(const PluginFuncEnv *env, uint32_t milliseconds) noexcept
Definition: loader.cc:204
void clear_running(PluginFuncEnv *env) noexcept
Definition: loader.cc:208
Definition: options.cc:49
Definition: gcs_xcom_synode.h:64
required string key
Definition: replication_asynchronous_connection_failover.proto:60
LEX_CSTRING * plugin_name(st_plugin_int **ref)
Definition: sql_plugin_ref.h:95
case opt name
Definition: sslopt-case.h:33