MySQL  8.0.21
Source Code Documentation
test_services_plugin_registry.cc File Reference

Test daemon plugin for the registry plugin service. More...

#include <mysql/components/my_service.h>
#include <mysql/components/service_implementation.h>
#include <mysql/components/services/log_builtins.h>
#include <mysql/plugin.h>
#include <mysql_version.h>
#include <mysqld_error.h>
#include <stddef.h>
#include "my_dbug.h"

Classes

struct  s_mysql_test_services_plugin_registry_service
 Declare the interface to our own service. More...
 

Macros

#define LOG_COMPONENT_TAG   "test_services_plugin_registry"
 

Typedefs

typedef struct s_mysql_test_services_plugin_registry_service mysql_service_test_services_plugin_registry_service_t
 Declare the interface to our own service. More...
 
using service_type_t = mysql_service_test_services_plugin_registry_service_t
 

Functions

static mysql_service_status_t test1 (int a1, int a2, int *outres) noexcept
 Implementation of test1 method. More...
 
static bool test_plugin_registry (MYSQL_PLUGIN p)
 Tests the plugin registry service. More...
 
static int test_services_plugin_init (void *p)
 Initialize the test services at server start or plugin installation. More...
 
static int test_services_plugin_deinit (void *)
 Terminate the test services at server shutdown or plugin deinstallation. More...
 
 mysql_declare_plugin (test_services_plugin_registry)
 test_services_plugin_registry descriptor More...
 

Variables

static const mysql_service_registry_treg_srv = nullptr
 
const mysql_service_log_builtins_tlog_bi = nullptr
 accessor built-ins More...
 
const mysql_service_log_builtins_string_tlog_bs = nullptr
 string built-ins More...
 
static const mysql_service_test_services_plugin_registry_service_t svc_def = {test1}
 Our own service definition: a struct of function pointers. More...
 
static my_h_service h_my_svc
 svc_def converted to a my_h_service More...
 
static struct st_mysql_daemon test_services_plugin_registry
 
 mysql_declare_plugin_end
 

Detailed Description

Test daemon plugin for the registry plugin service.

See also
test_plugin_registry()

Macro Definition Documentation

◆ LOG_COMPONENT_TAG

#define LOG_COMPONENT_TAG   "test_services_plugin_registry"

Typedef Documentation

◆ mysql_service_test_services_plugin_registry_service_t

Declare the interface to our own service.

Usually comes from a svc header

◆ service_type_t

Function Documentation

◆ mysql_declare_plugin()

mysql_declare_plugin ( test_services_plugin_registry  )

test_services_plugin_registry descriptor

◆ test1()

static mysql_service_status_t test1 ( int  a1,
int  a2,
int *  outres 
)
staticnoexcept

Implementation of test1 method.

Parameters
a1first argument to add
a2second argument to add
[out]outresthe result of adding a1 to a2
Return values
0success
non-zerofailure

◆ test_plugin_registry()

static bool test_plugin_registry ( MYSQL_PLUGIN  p)
static

Tests the plugin registry service.

The test consists of:

  • acquire the registry_registration service default implememtnation
  • register a new service implementation for the mysql_server component
  • acquire the newly registered service's default implementation
  • compare the service handles for equality
  • release the service handle for our service
  • unregister our service
  • release the handle to the registry registration service

Error messages are written to the server's error log. In case of success writes a single information message to the server's log.

Return values
falsesuccess
truefailure

◆ test_services_plugin_deinit()

static int test_services_plugin_deinit ( void *  )
static

Terminate the test services at server shutdown or plugin deinstallation.

Does nothing

Return values
0success
1failure

◆ test_services_plugin_init()

static int test_services_plugin_init ( void *  p)
static

Initialize the test services at server start or plugin installation.

Call the test service.

Return values
0success
1failure

Variable Documentation

◆ h_my_svc

my_h_service h_my_svc
static
Initial value:
=
reinterpret_cast<my_h_service>(const_cast<service_type_t *>(&svc_def))
static const mysql_service_test_services_plugin_registry_service_t svc_def
Our own service definition: a struct of function pointers.
Definition: test_services_plugin_registry.cc:68
Declare the interface to our own service.
Definition: test_services_plugin_registry.cc:48
struct my_h_service_imp * my_h_service
A handle type for acquired Service.
Definition: registry.h:32

svc_def converted to a my_h_service

◆ log_bi

accessor built-ins

accessor built-ins

◆ log_bs

string built-ins

◆ mysql_declare_plugin_end

mysql_declare_plugin_end

◆ reg_srv

const mysql_service_registry_t* reg_srv = nullptr
static

◆ svc_def

Our own service definition: a struct of function pointers.

◆ test_services_plugin_registry

struct st_mysql_daemon test_services_plugin_registry
static
Initial value:
= {
#define MYSQL_DAEMON_INTERFACE_VERSION
Definition: plugin.h:698