MySQL 9.1.0
Source Code Documentation
registry.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef REGISTRY_H
25#define REGISTRY_H
26
27#include <string>
28
31
32/**
33 This is the interface for the registrty module. This is a convenience
34 class to conduct operations on the service registry. It can be used for
35 instance to cache relevant and frequently used references to service
36 implementations.
37 */
39 public:
40 /** The name of the membership service. */
41 static const std::string SVC_NAME_MEMBERSHIP;
42 /** The name of the member status service. */
43 static const std::string SVC_NAME_STATUS;
44 /** The name of the registry query service. */
45 static const std::string SVC_NAME_REGISTRY_QUERY;
46
47 public:
48 virtual ~Registry_module_interface() = default;
49
50 /**
51 Initializes the registry handles. It acquires registry handles
52 and allocates required memory.
53
54 @return true if there was an error, false otherwise.
55 */
56 virtual bool initialize() = 0;
57
58 /**
59 SHALL release the registry handles and frees memory that
60 may have been in use. Clean up.
61
62 @return true if there was an error, false otherwise.
63 */
64 virtual bool finalize() = 0;
65
66 /**
67 SHALL return the service registry handle if initialized already.
68
69 @return the service registry handle if initialized. NULL otherwise.
70 */
71 virtual SERVICE_TYPE(registry) * get_registry_handle() = 0;
72
73 /**
74 SHALL return the service registry query handle if initialized already.
75
76 @return the service registry query handle if initialized. NULL otherwise.
77 */
78 virtual SERVICE_TYPE(registry_query) * get_registry_query_handle() = 0;
79};
80
81/**
82 This is the implementation of the registry module interface.
83
84 This implementation will acquire a reference to the service registry
85 and to the registry query service when initialized. It will only release
86 these references when the module is finalized.
87 */
89 private:
90 /**
91 Cached reference to the service registry.
92 */
94
95 /**
96 Cached reference to the registry query service.
97 */
98 SERVICE_TYPE(registry_query) * m_registry_query;
99
100 /* Disable copy and assignment constructors. */
103
104 public:
106
107 ~Registry_module() override { finalize(); }
108
109 bool initialize() override;
110 bool finalize() override;
111 SERVICE_TYPE(registry) * get_registry_handle() override;
112 SERVICE_TYPE(registry_query) * get_registry_query_handle() override;
113};
114
115#endif
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
This is the interface for the registrty module.
Definition: registry.h:38
virtual ~Registry_module_interface()=default
static const std::string SVC_NAME_MEMBERSHIP
The name of the membership service.
Definition: registry.h:41
static const std::string SVC_NAME_REGISTRY_QUERY
The name of the registry query service.
Definition: registry.h:45
virtual const mysql_service_registry_t * get_registry_handle()=0
SHALL return the service registry handle if initialized already.
virtual const mysql_service_registry_query_t * get_registry_query_handle()=0
SHALL return the service registry query handle if initialized already.
virtual bool initialize()=0
Initializes the registry handles.
static const std::string SVC_NAME_STATUS
The name of the member status service.
Definition: registry.h:43
virtual bool finalize()=0
SHALL release the registry handles and frees memory that may have been in use.
This is the implementation of the registry module interface.
Definition: registry.h:88
const mysql_service_registry_t * get_registry_handle() override
SHALL return the service registry handle if initialized already.
Definition: registry.cc:86
const mysql_service_registry_query_t * get_registry_query_handle() override
SHALL return the service registry query handle if initialized already.
Definition: registry.cc:90
bool initialize() override
Initializes the registry handles.
Definition: registry.cc:35
Registry_module & operator=(const Registry_module rhs)
Registry_module()
Definition: registry.h:105
Registry_module(const Registry_module &rhs)
bool finalize() override
SHALL release the registry handles and frees memory that may have been in use.
Definition: registry.cc:63
const mysql_service_registry_t * m_registry
Cached reference to the service registry.
Definition: registry.h:93
~Registry_module() override
Definition: registry.h:107
const mysql_service_registry_query_t * m_registry_query
Cached reference to the registry query service.
Definition: registry.h:98
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76
Declaration of the registry plugin service.