MySQL 9.1.0
Source Code Documentation
plugin_registry_service_st Struct Reference

A bridge service allowing plugins to work with the registry. More...

#include <service_plugin_registry.h>

Public Attributes

const mysql_service_registry_t *(* mysql_plugin_registry_acquire_func )()
 Acquire a pointer to the registry service. More...
 
int(* mysql_plugin_registry_release_func )(const mysql_service_registry_t *registry_ptr)
 Release a pointer to the registry service. More...
 

Detailed Description

A bridge service allowing plugins to work with the registry.

This allows traditional MySQL plugins to interact with the service registry. All this plugins service does is to return a reference to the registry service. Using that the plugins can access the rest of the registry and dynamic loaders services, as well as other services present in the registry. Note that the plugins must release the service references they acquire otherwise resources will be leaked and normal unload order may be affected.

Member Data Documentation

◆ mysql_plugin_registry_acquire_func

const mysql_service_registry_t *(* plugin_registry_service_st::mysql_plugin_registry_acquire_func) ()

Acquire a pointer to the registry service.

The reference must be released by calling plugin_registry_service_st::mysql_plugin_registry_release_func() See mysql_plugin_registry_acquire() for more details.

Once you receive the registry pointer you can use it to acquire references to other services your plugin might be interested in.

Note
This is to be considered an "expensive" operation because it requires access to the global structures of the The Service Registry Service. Avoid using it in situations where fast and scalable execution is required. Since the registry service is very unlikely to change often holding on to the reference to it for extended time periods is a safe bet.
Achieveing scalability through preserving references does not come for free. These are some of the effects on code that caches active references:
  • components implementing services to which active references are held cannot be unloaded.
  • code keeping an active reference to e.g. a default service implementation will not switch to a possible new default service implementation installed by a component loaded in the meanwhile, as taking the updated default service implementation would only happen at the time of acquiring a new reference.
Returns
the registry pointer

See also: Component Subsystem, The Service Registry Service, mysql_plugin_registry_acquire(), mysql_plugin_registry_release()

◆ mysql_plugin_registry_release_func

int(* plugin_registry_service_st::mysql_plugin_registry_release_func) (const mysql_service_registry_t *registry_ptr)

Release a pointer to the registry service.

Releases the reference to the registry service, as returned by mysql_plugin_registry_acquire(). After this call the reigstry_ptr is undefined and should not be used anymore. See mysql_plugin_registry_release() for more details.

Warning
Before releasing the reference to the registry service please make sure you have released all the other service references that you explicitly or implicitly acquired. These can't be released without a valid reference to the registry service.
Note
This is also to be considered an "expensive" operation. See plugin_registry_service_st::mysql_plugin_registry_acquire_func for more details on pros and cons of re-acquiring references vs caching and reusing them.
Parameters
registry_ptrthe registry pointer
Returns
execution status
Return values
0success
non-zerofailure

See also Component Subsystem, The Service Registry Service, mysql_plugin_registry_release(), mysql_plugin_registry_acquire()


The documentation for this struct was generated from the following file: