MySQL 8.0.39
Source Code Documentation
|
#include <registry_imp.h>
Static Public Member Functions | |
static void | init () |
Initializes registry for usage. More... | |
static void | deinit () |
De-initializes registry. More... | |
static void | rw_lock_deinit () |
De-initializes RW lock. More... | |
static minimal_chassis::rwlock_scoped_lock | lock_registry_for_write () |
Locks whole registry for write. More... | |
static uint64_t | get_service_implementation_reference_count (my_h_service interface) |
Gets current reference count for a Service Implementation related to the specified pointer to the interface structure. More... | |
static bool | acquire_nolock (const char *service_name, my_h_service *out_service) |
Finds and acquires a Service by name. More... | |
static bool | release_nolock (my_h_service service) |
Releases the Service Implementation previously acquired. More... | |
static bool | register_service_nolock (const char *service_implementation_name, my_h_service ptr) |
Registers a new Service Implementation. More... | |
static bool | unregister_nolock (const char *service_implementation_name) |
Removes previously registered Service Implementation from registry. More... | |
static mysql_service_status_t | acquire (const char *service_name, my_h_service *out_service) noexcept |
Finds and acquires a Service by name. More... | |
static mysql_service_status_t | acquire_related (const char *service_name, my_h_service service, my_h_service *out_service) noexcept |
Finds a Service by name. More... | |
static mysql_service_status_t | release (my_h_service service) noexcept |
Releases the Service Implementation previously acquired. More... | |
static mysql_service_status_t | register_service (const char *service_implementation_name, my_h_service ptr) noexcept |
Registers a new Service Implementation. More... | |
static mysql_service_status_t | unregister (const char *service_implementation_name) noexcept |
Removes previously registered Service Implementation from registry. More... | |
static mysql_service_status_t | set_default (const char *service_implementation_name) noexcept |
Sets new default Service Implementation for corresponding Service name. More... | |
static mysql_service_status_t | iterator_create (const char *service_name_pattern, my_h_service_iterator *out_iterator) noexcept |
Creates iterator that iterates through all registered Service Implementations. More... | |
static void | iterator_release (my_h_service_iterator iterator) noexcept |
Releases Service implementations iterator. More... | |
static mysql_service_status_t | iterator_get (my_h_service_iterator iterator, const char **out_name) noexcept |
Gets name of Service pointed to by iterator. More... | |
static mysql_service_status_t | iterator_next (my_h_service_iterator iterator) noexcept |
Advances specified iterator to next element. More... | |
static mysql_service_status_t | iterator_is_valid (my_h_service_iterator iterator) noexcept |
Checks if specified iterator is valid, i.e. More... | |
Private Types | |
typedef std::map< my_h_service, mysql_service_implementation * > | my_interface_mapping |
Static Private Member Functions | |
static mysql_service_implementation * | get_service_implementation_by_interface (my_h_service interface) |
Finds a Service Implementation data structure based on the pointer to interface struct supplied. More... | |
Static Private Attributes | |
static my_service_registry | service_registry |
static my_interface_mapping | interface_mapping |
static mysql_rwlock_t | LOCK_registry |
|
private |
|
staticnoexcept |
Finds and acquires a Service by name.
A name of the Service or the Service Implementation can be specified. In case of the Service name, the default Service Implementation for Service specified will be returned.
service_name | Name of Service or Service Implementation to acquire. | |
[out] | out_service | Pointer to Service handle to set acquired Service. |
false | success |
true | failure |
|
static |
Finds and acquires a Service by name.
A name of the Service or the Service Implementation can be specified. In case of the Service name, the default Service Implementation for Service specified will be returned. Assumes caller has at least a read lock on the Registry.
service_name | Name of Service or Service Implementation to acquire. | |
[out] | out_service | Pointer to Service handle to set acquired Service. |
false | success |
true | failure |
|
staticnoexcept |
Finds a Service by name.
If there is a Service Implementation with the same Component part of name as the input Service then the found Service is returned.
service_name | Name of Service or Service Implementation to acquire. | |
service | Service handle already acquired Service Implementation. | |
[out] | out_service | Pointer to Service Implementation handle to set acquired Service Implementation. |
false | success |
true | failure |
|
static |
De-initializes registry.
De-initializes RW lock, all other structures are cleaned up.
|
staticprivate |
Finds a Service Implementation data structure based on the pointer to interface struct supplied.
Assumes caller has at least a read lock on the Registry.
interface | A pointer to the interface structure of the Service Implementation to look for. |
|
static |
Gets current reference count for a Service Implementation related to the specified pointer to the interface structure.
Assumes caller has at least a read lock on the Registry.
interface | A pointer to the interface structure of the Service Implementation to get reference count of. |
|
static |
Initializes registry for usage.
Initializes RW lock, all other structures should be empty. Shouldn't be called multiple times.
|
staticnoexcept |
Creates iterator that iterates through all registered Service Implementations.
If successful it leaves read lock on the Registry until iterator is released. The starting point of iteration may be specified to be on one particular Service Implementation. The iterator will move through all Service Implementations and additionally through all default Service Implementation additionally, i.e. the default Service Implementation will be returned twice. If no name is specified for search, iterator will be positioned on the first Service Implementation.
service_name_pattern | Name of Service or Service Implementation to start iteration from. May be empty string or NULL pointer, in which case iteration starts from the first Service Implementation. | |
[out] | out_iterator | Pointer to the Service Implementation iterator handle. |
false | success |
true | failure |
|
staticnoexcept |
Gets name of Service pointed to by iterator.
The pointer returned will last at least up to the moment of call to the release() method on the iterator.
iterator | Service Implementation iterator handle. | |
[out] | out_name | Pointer to string with name to set result pointer to. |
false | success |
true | Failure, may be caused when called on iterator that went through all values already. |
|
staticnoexcept |
Checks if specified iterator is valid, i.e.
have not reached one-past-last element.
iterator | Service Implementation iterator handle. |
false | Valid |
true | Invalid or reached one-past-last element. |
|
staticnoexcept |
Advances specified iterator to next element.
Will succeed but return true if it reaches one-past-last element.
iterator | Service Implementation iterator handle. |
false | success |
true | Failure or called on iterator that was on last element. |
|
staticnoexcept |
Releases Service implementations iterator.
Releases read lock on registry.
iterator | Service Implementation iterator handle. |
|
static |
Locks whole registry for write.
For internal use only.
|
staticnoexcept |
Registers a new Service Implementation.
If it is the first Service Implementation for the specified Service then it is made a default one.
service_implementation_name | Name of the Service Implementation to register. |
ptr | Pointer to the Service Implementation structure. |
false | success |
true | failure |
|
static |
Registers a new Service Implementation.
If it is the first Service Implementation for the specified Service then it is made a default one. Assumes caller has a write lock on the Registry.
service_implementation_name | Name of the Service Implementation to register. |
ptr | Pointer to the Service Implementation structure. |
false | success |
true | failure |
|
staticnoexcept |
Releases the Service Implementation previously acquired.
After the call to this method the usage of the Service Implementation handle will lead to unpredicted results.
service | Service Implementation handle of already acquired Service. |
false | success |
true | failure |
|
static |
Releases the Service Implementation previously acquired.
After the call to this method the usage of the Service Implementation handle will lead to unpredicted results. Assumes caller has at least a read lock on the Registry.
service | Service Implementation handle of already acquired Service. |
false | success |
true | failure |
|
static |
De-initializes RW lock.
|
staticnoexcept |
Sets new default Service Implementation for corresponding Service name.
service_implementation_name | Name of the Service Implementation to set as default one. |
false | success |
true | failure |
|
staticnoexcept |
Removes previously registered Service Implementation from registry.
If it is the default one for specified Service then any one still registered is made default. If there is no other, the default entry is removed from the Registry too.
service_implementation_name | Name of the Service Implementation to unregister. |
false | success |
true | Failure. May happen when Service is still being referenced. |
|
static |
Removes previously registered Service Implementation from registry.
If it is the default one for specified Service then any one still registered is made default. If there is no other, the default entry is removed from the Registry too. Assumes caller has a write lock on the Registry.
service_implementation_name | Name of the Service Implementation to unregister. |
false | success |
true | Failure. May happen when Service is still being referenced. |
|
staticprivate |
|
staticprivate |
|
staticprivate |