MySQL 9.1.0
Source Code Documentation
mysql_registry_imp Class Reference

#include <registry_imp.h>

Inheritance diagram for mysql_registry_imp:
[legend]

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 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...
 
- Static Public Member Functions inherited from mysql_registry_no_lock_imp
static void deinit ()
 De-initializes registry, other structures. 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 Private Attributes

static mysql_rwlock_t LOCK_registry
 

Additional Inherited Members

- Protected Types inherited from mysql_registry_no_lock_imp
typedef std::map< my_h_service, mysql_service_implementation * > my_interface_mapping
 
- Static Protected Attributes inherited from mysql_registry_no_lock_imp
static my_service_registry service_registry
 
static my_interface_mapping interface_mapping
 

Member Function Documentation

◆ acquire()

mysql_service_status_t mysql_registry_imp::acquire ( const char *  service_name,
my_h_service out_service 
)
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.

Parameters
service_nameName of Service or Service Implementation to acquire.
[out]out_servicePointer to Service handle to set acquired Service.
Returns
Status of performed operation
Return values
falsesuccess
truefailure

◆ acquire_related()

mysql_service_status_t mysql_registry_imp::acquire_related ( const char *  service_name,
my_h_service  service,
my_h_service out_service 
)
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.

Parameters
service_nameName of Service or Service Implementation to acquire.
serviceService handle already acquired Service Implementation.
[out]out_servicePointer to Service Implementation handle to set acquired Service Implementation.
Returns
Status of performed operation
Return values
falsesuccess
truefailure

◆ deinit()

void mysql_registry_imp::deinit ( )
static

De-initializes registry.

De-initializes RW lock, all other structures are cleaned up.

◆ init()

void mysql_registry_imp::init ( )
static

Initializes registry for usage.

Initializes RW lock, all other structures should be empty. Shouldn't be called multiple times.

◆ iterator_create()

mysql_service_status_t mysql_registry_imp::iterator_create ( const char *  service_name_pattern,
my_h_service_iterator out_iterator 
)
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.

Parameters
service_name_patternName 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_iteratorPointer to the Service Implementation iterator handle.
Returns
Status of performed operation
Return values
falsesuccess
truefailure

◆ iterator_get()

mysql_service_status_t mysql_registry_imp::iterator_get ( my_h_service_iterator  iterator,
const char **  out_name 
)
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.

Parameters
iteratorService Implementation iterator handle.
[out]out_namePointer to string with name to set result pointer to.
Returns
Status of performed operation
Return values
falsesuccess
trueFailure, may be caused when called on iterator that went through all values already.

◆ iterator_is_valid()

mysql_service_status_t mysql_registry_imp::iterator_is_valid ( my_h_service_iterator  iterator)
staticnoexcept

Checks if specified iterator is valid, i.e.

have not reached one-past-last element.

Parameters
iteratorService Implementation iterator handle.
Returns
Validity of iterator
Return values
falseValid
trueInvalid or reached one-past-last element.

◆ iterator_next()

mysql_service_status_t mysql_registry_imp::iterator_next ( my_h_service_iterator  iterator)
staticnoexcept

Advances specified iterator to next element.

Will succeed but return true if it reaches one-past-last element.

Parameters
iteratorService Implementation iterator handle.
Returns
Status of performed operation and validity of iterator after operation.
Return values
falsesuccess
trueFailure or called on iterator that was on last element.

◆ iterator_release()

void mysql_registry_imp::iterator_release ( my_h_service_iterator  iterator)
staticnoexcept

Releases Service implementations iterator.

Releases read lock on registry.

Parameters
iteratorService Implementation iterator handle.

◆ lock_registry_for_write()

minimal_chassis::rwlock_scoped_lock mysql_registry_imp::lock_registry_for_write ( )
static

Locks whole registry for write.

For internal use only.

Returns
A lock acquired wrapped into RAII object.

◆ register_service()

mysql_service_status_t mysql_registry_imp::register_service ( const char *  service_implementation_name,
my_h_service  ptr 
)
staticnoexcept

Registers a new Service Implementation.

If it is the first Service Implementation for the specified Service then it is made a default one.

Parameters
service_implementation_nameName of the Service Implementation to register.
ptrPointer to the Service Implementation structure.
Returns
Status of performed operation
Return values
falsesuccess
truefailure

◆ release()

mysql_service_status_t mysql_registry_imp::release ( my_h_service  service)
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.

Parameters
serviceService Implementation handle of already acquired Service.
Returns
Status of performed operation
Return values
falsesuccess
truefailure

◆ rw_lock_deinit()

void mysql_registry_imp::rw_lock_deinit ( )
static

De-initializes RW lock.

◆ set_default()

mysql_service_status_t mysql_registry_imp::set_default ( const char *  service_implementation_name)
staticnoexcept

Sets new default Service Implementation for corresponding Service name.

Parameters
service_implementation_nameName of the Service Implementation to set as default one.
Returns
Status of performed operation
Return values
falsesuccess
truefailure

◆ unregister()

mysql_service_status_t mysql_registry_imp::unregister ( const char *  service_implementation_name)
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.

Parameters
service_implementation_nameName of the Service Implementation to unregister.
Returns
Status of performed operation
Return values
falsesuccess
trueFailure. May happen when Service is still being referenced.

Member Data Documentation

◆ LOCK_registry

mysql_rwlock_t mysql_registry_imp::LOCK_registry
staticprivate

The documentation for this class was generated from the following files: