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);
234 std::vector<std::unique_ptr<mysql_component>> &loaded_components,
235 std::vector<const char *> &services_loaded);
249 std::vector<std::unique_ptr<mysql_component>> &loaded_components,
250 const std::set<my_string> &services_provided);
263 std::vector<std::unique_ptr<mysql_component>> &loaded_components);
276 std::vector<std::unique_ptr<mysql_component>> &loaded_components);
289 std::vector<std::unique_ptr<mysql_component>> &loaded_components);
301 std::vector<std::unique_ptr<mysql_component>> &loaded_components);
314 int component_count);
329 const std::vector<mysql_component *> &components_to_unload);
342 const std::vector<mysql_component *> &components_to_unload,
343 const std::map<
const void *, std::vector<mysql_component *>>
360 const std::vector<mysql_component *> &components_to_unload,
361 const std::map<
const void *, std::vector<mysql_component *>>
382 const std::vector<mysql_component *> &components_to_unload,
383 const std::map<
const void *, std::vector<mysql_component *>>
400 const std::vector<mysql_component *> &components_to_unload,
416 const std::vector<mysql_component *> &components_to_unload,
432 const std::vector<mysql_component *> &components_to_unload,
451 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:606
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:1160
static void rw_lock_deinit()
De-initializes RW lock.
Definition: dynamic_loader.cc:381
static void deinit()
De-initializes loader.
Definition: dynamic_loader.cc:338
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:1041
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:545
static void iterator_release(my_h_component_iterator iterator) noexcept
Releases Component iterator.
Definition: dynamic_loader.cc:517
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:491
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:1126
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:1297
static void init()
Initializes loader for usage.
Definition: dynamic_loader.cc:328
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:1335
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:1465
static mysql_rwlock_t LOCK_dynamic_loader
Definition: dynamic_loader_imp.h:67
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:930
static mysql_service_status_t iterator_next(my_h_component_iterator iterator) noexcept
Advances specified iterator to next element.
Definition: dynamic_loader.cc:579
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:649
static bool unload_do_list_components(const char *urns[], int component_count)
Unloads all Components specified in list.
Definition: dynamic_loader.cc:1000
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:1260
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:793
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:975
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:1216
static bool unload_do_commit()
Finishes unloading process by marking changes to not be rolled back.
Definition: dynamic_loader.cc:1445
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:884
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:837
static bool load_do_collect_services_provided(std::vector< std::unique_ptr< mysql_component > > &loaded_components, std::vector< const char * > &services_loaded)
Prepares a list of all Services that are provided by specified Components.
Definition: dynamic_loader.cc:753
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:402
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:1376
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:450
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:51
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:2900
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2876
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2894
#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:300
An instrumented rwlock structure.
Definition: mysql_rwlock_bits.h:51