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