24#ifndef MYSQL_SERVER_DYNAMIC_LOADER_H
25#define MYSQL_SERVER_DYNAMIC_LOADER_H
33#include <forward_list>
51typedef std::map<const char *, std::unique_ptr<mysql_component>,
c_string_less>
127 typedef std::pair<my_component_registry::const_iterator,
167 const char **out_name,
const char **out_urn));
199#define OBJECT_ITERATOR my_h_component_iterator
200#define METADATA_ITERATOR my_h_component_metadata_iterator
219 int component_count);
232 std::vector<std::unique_ptr<mysql_component>> &loaded_components);
246 std::vector<std::unique_ptr<mysql_component>> &loaded_components,
247 const std::set<my_string> &services_provided);
260 std::vector<std::unique_ptr<mysql_component>> &loaded_components);
273 std::vector<std::unique_ptr<mysql_component>> &loaded_components);
286 std::vector<std::unique_ptr<mysql_component>> &loaded_components);
298 std::vector<std::unique_ptr<mysql_component>> &loaded_components);
311 int component_count);
326 const std::vector<mysql_component *> &components_to_unload);
339 const std::vector<mysql_component *> &components_to_unload,
340 const std::map<
const void *, std::vector<mysql_component *>>
357 const std::vector<mysql_component *> &components_to_unload,
358 const std::map<
const void *, std::vector<mysql_component *>>
379 const std::vector<mysql_component *> &components_to_unload,
380 const std::map<
const void *, std::vector<mysql_component *>>
397 const std::vector<mysql_component *> &components_to_unload,
413 const std::vector<mysql_component *> &components_to_unload,
429 const std::vector<mysql_component *> &components_to_unload,
448 const std::vector<mysql_component *> &components_to_unload,
Locks RW-lock and releases lock on scope exit.
Definition: rwlock_scoped_lock.h:33
Wraps my_h_service struct conforming ABI into RAII C++ object with ability to cast to desired service...
Definition: my_service.h:35
A class with an implementation of the Dynamic Loader Service.
Definition: dynamic_loader_imp.h:60
static mysql_service_status_t iterator_is_valid(my_h_component_iterator iterator) noexcept
Checks if specified iterator is valid, i.e.
Definition: dynamic_loader.cc:605
static bool unload_do_lock_provided_services(const std::vector< mysql_component * > &components_to_unload, const std::map< const void *, std::vector< mysql_component * > > &dependency_graph, scheme_service_map &scheme_services)
Takes a lock on all services that are provided by the Components to be unloaded, to prevent reference...
Definition: dynamic_loader.cc:1121
static void rw_lock_deinit()
De-initializes RW lock.
Definition: dynamic_loader.cc:380
static void deinit()
De-initializes loader.
Definition: dynamic_loader.cc:337
static bool unload_do_topological_order(const std::vector< mysql_component * > &components_to_unload)
Orders components in a order that would allow allow deinitialization to be done always for components...
Definition: dynamic_loader.cc:1002
static mysql_service_status_t iterator_get(my_h_component_iterator iterator, const char **out_name, const char **out_urn) noexcept
Gets name and URN of Service pointed to by iterator.
Definition: dynamic_loader.cc:544
static void iterator_release(my_h_component_iterator iterator) noexcept
Releases Component iterator.
Definition: dynamic_loader.cc:516
static mysql_service_status_t iterator_create(my_h_component_iterator *out_iterator) noexcept
Creates iterator that iterates through all loaded Components.
Definition: dynamic_loader.cc:490
static bool unload_do_get_scheme_services(const std::vector< mysql_component * > &components_to_unload, const std::map< const void *, std::vector< mysql_component * > > &dependency_graph)
Prefetch all scheme loading Services before we get a lock on a Registry.
Definition: dynamic_loader.cc:1087
static bool unload_do_unload_dependencies(const std::vector< mysql_component * > &components_to_unload, scheme_service_map &scheme_services)
Releases Service Implementations acquired to satisfy dependencies.
Definition: dynamic_loader.cc:1233
static void init()
Initializes loader for usage.
Definition: dynamic_loader.cc:327
static bool unload_do_unregister_services(const std::vector< mysql_component * > &components_to_unload, scheme_service_map &scheme_services)
Unregisters all Service Implementations of specified Components.
Definition: dynamic_loader.cc:1271
static bool get_scheme_service_from_urn(const my_string &urn, const mysql_service_dynamic_loader_scheme_t **out_scheme_service, scheme_service_map &scheme_services)
Returns scheme loading Service based on given URN.
Definition: dynamic_loader.cc:1401
static mysql_rwlock_t LOCK_dynamic_loader
Definition: dynamic_loader_imp.h:67
static bool load_do_collect_services_provided(std::vector< std::unique_ptr< mysql_component > > &loaded_components)
Prepares a list of all Services that are provided by specified Components.
Definition: dynamic_loader.cc:716
static bool load_do_initialize_components(std::vector< std::unique_ptr< mysql_component > > &loaded_components)
Calls Components initialization method to make Components ready to function.
Definition: dynamic_loader.cc:891
static mysql_service_status_t iterator_next(my_h_component_iterator iterator) noexcept
Advances specified iterator to next element.
Definition: dynamic_loader.cc:578
static bool load_do_load_component_by_scheme(const char *urns[], int component_count)
Loads specified group of Components by URN.
Definition: dynamic_loader.cc:648
static bool unload_do_list_components(const char *urns[], int component_count)
Unloads all Components specified in list.
Definition: dynamic_loader.cc:961
static bool unload_do_deinitialize_components(const std::vector< mysql_component * > &components_to_unload, scheme_service_map &scheme_services)
Deinitialize Components using their deinitialization method.
Definition: dynamic_loader.cc:1196
static bool load_do_check_dependencies(std::vector< std::unique_ptr< mysql_component > > &loaded_components, const std::set< my_string > &services_provided)
Checks if all dependencies can be satisfied with existing or to be added Services.
Definition: dynamic_loader.cc:754
std::pair< my_component_registry::const_iterator, minimal_chassis::rwlock_scoped_lock > component_iterator
Definition: dynamic_loader_imp.h:129
static bool load_do_commit(std::vector< std::unique_ptr< mysql_component > > &loaded_components)
Adds all Components to main list of loaded Components.
Definition: dynamic_loader.cc:936
static bool unload_do_check_provided_services_reference_count(const std::vector< mysql_component * > &components_to_unload, const std::map< const void *, std::vector< mysql_component * > > &dependency_graph, scheme_service_map &scheme_services)
Checks if all Service Implementations provided by the Components to be unloaded have no references ou...
Definition: dynamic_loader.cc:1152
static bool unload_do_commit()
Finishes unloading process by marking changes to not be rolled back.
Definition: dynamic_loader.cc:1381
static bool load_do_resolve_dependencies(std::vector< std::unique_ptr< mysql_component > > &loaded_components)
Acquires Service Implementations for all dependencies of Components.
Definition: dynamic_loader.cc:845
static bool load_do_register_services(std::vector< std::unique_ptr< mysql_component > > &loaded_components)
Registers all Services that are provided by specified Components.
Definition: dynamic_loader.cc:798
static generation_urns_list urns_with_gen_list
Definition: dynamic_loader_imp.h:68
static mysql_service_status_t load(const char *urns[], int component_count) noexcept
Loads specified group of Components by URN, initializes them and registers all Service Implementation...
Definition: dynamic_loader.cc:401
static my_component_registry components_list
Definition: dynamic_loader_imp.h:66
static bool unload_do_unload_components(const std::vector< mysql_component * > &components_to_unload, scheme_service_map &scheme_services)
Uses Component URN to extract the scheme part of URN (part before "://") and use it to acquire Servic...
Definition: dynamic_loader.cc:1312
static mysql_service_status_t unload(const char *urns[], int component_count) noexcept
Unloads specified group of Components by URN, deinitializes them and unregisters all Service Implemen...
Definition: dynamic_loader.cc:449
std::unordered_map< my_string, my_service< const mysql_service_dynamic_loader_scheme_t > > scheme_service_map
Definition: dynamic_loader_imp.h:63
REQUIRES_SERVICE_PLACEHOLDER(mysql_runtime_error)
std::vector< mysql_component * > components_vector
Definition: dynamic_loader_imp.h:54
std::forward_list< components_vector > generation_urns_list
Definition: dynamic_loader_imp.h:55
std::map< const char *, std::unique_ptr< mysql_component >, c_string_less > my_component_registry
Making component object and the generation ID as a pair.
Definition: dynamic_loader_imp.h:52
my_h_service h_err_service
Definition: minimal_chassis.cc:50
struct my_h_service_imp * my_h_service
A handle type for acquired Service.
Definition: registry.h:33
std::unordered_map< Key, Value, Hash, Key_equal, ut::allocator< std::pair< const Key, Value > > > unordered_map
Definition: ut0new.h:2898
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
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76
Specifies macros to define Service Implementations.
#define DEFINE_BOOL_METHOD(name, args)
A short macro to define method that returns bool, which is the most common case.
Definition: service_implementation.h:88
#define DEFINE_METHOD(retval, name, args)
A macro to ensure method implementation has required properties, that is it does not throw exceptions...
Definition: service_implementation.h:79
Compares two strings for order, assures ascending lexicographical order.
Definition: c_string_less.h:39
Definition: dynamic_loader.cc:299
An instrumented rwlock structure.
Definition: mysql_rwlock_bits.h:51