MySQL 8.0.29
Source Code Documentation
registry.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 2022, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is also distributed with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have included with MySQL.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License, version 2.0, for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef MYSQL_REGISTRY_H
24#define MYSQL_REGISTRY_H
25
27#include <stdint.h>
28
29/**
30 A handle type for acquired Service.
31*/
33
34/**
35 A handle type for a iterator to a Service Implementation.
36*/
38/**
39 A handle type for a iterator to metadata of some Service Implementation.
40*/
42
43/**
44 Service for acquiring and releasing references to all registered Service
45 Implementations.
46*/
48/**
49 Finds and acquires a Service by name. A name of the Service or the Service
50 Implementation can be specified. In case of the Service name, the default
51 Service Implementation for Service specified will be returned.
52
53 @param service_name Name of Service or Service Implementation to acquire.
54 @param [out] out_service Pointer to Service handle to set acquired Service.
55 @return Status of performed operation
56 @retval false success
57 @retval true failure
58*/
60 (const char *service_name, my_h_service *out_service));
61/**
62 Finds a Service by name. If there is a Service Implementation with the same
63 Component part of name as the input Service then the found Service is
64 returned.
65
66 @param service_name Name of Service or Service Implementation to acquire.
67 @param service Service handle already acquired Service Implementation.
68 @param [out] out_service Pointer to Service Implementation handle to set
69 acquired Service Implementation.
70 @return Status of performed operation
71 @retval false success
72 @retval true failure
73*/
74DECLARE_BOOL_METHOD(acquire_related,
75 (const char *service_name, my_h_service service,
76 my_h_service *out_service));
77/**
78 Releases the Service Implementation previously acquired. After the call to
79 this method the usage of the Service Implementation handle will lead to
80 unpredicted results.
81
82 @param service Service Implementation handle of already acquired Service.
83 @return Status of performed operation
84 @retval false success
85 @retval true failure
86*/
89
90/**
91 Service for managing list of registered Service Implementations.
92*/
93BEGIN_SERVICE_DEFINITION(registry_registration)
94/**
95 Registers a new Service Implementation. If it is the first Service
96 Implementation for the specified Service then it is made a default one.
97
98 @param service_implementation_name Name of the Service Implementation to
99 register.
100 @param ptr Pointer to the Service Implementation structure.
101 @return Status of performed operation
102 @retval false success
103 @retval true failure
104*/
105DECLARE_BOOL_METHOD(register_service, (const char *service_implementation_name,
107/**
108 Removes previously registered Service Implementation from registry. If it is
109 the default one for specified Service then any one still registered is made
110 default. If there is no other, the default entry is removed from the
111 Registry too.
112
113 @param service_implementation_name Name of the Service Implementation to
114 unregister.
115 @return Status of performed operation
116 @retval false success
117 @retval true Failure. May happen when Service is still being referenced.
118*/
119DECLARE_BOOL_METHOD(unregister, (const char *service_implementation_name));
120/**
121 Sets new default Service Implementation for corresponding Service name.
122
123 @param service_implementation_name Name of the Service Implementation to
124 set as default one.
125 @return Status of performed operation
126 @retval false success
127 @retval true failure
128*/
129DECLARE_BOOL_METHOD(set_default, (const char *service_implementation_name));
130END_SERVICE_DEFINITION(registry_registration)
131
132/**
133 Service for listing all Service Implementations by iterator.
134*/
136/**
137 Creates iterator that iterates through all registered Service
138 Implementations. If successful it leaves read lock on the Registry until
139 iterator is released. The starting point of iteration may be specified
140 to be on one particular Service Implementation. The iterator will move
141 through all Service Implementations and additionally through all default
142 Service Implementation additionally, i.e. the default Service Implementation
143 will be returned twice. If no name is specified for search, iterator will be
144 positioned on the first Service Implementation.
145
146 @param service_name_pattern Name of Service or Service Implementation to
147 start iteration from. May be empty string or NULL pointer, in which case
148 iteration starts from the first Service Implementation.
149 @param [out] out_iterator Pointer to the Service Implementation iterator
150 handle.
151 @return Status of performed operation
152 @retval false success
153 @retval true failure
154*/
155DECLARE_BOOL_METHOD(create, (const char *service_name_pattern,
156 my_h_service_iterator *out_iterator));
157/**
158 Gets name of Service pointed to by iterator. The pointer returned will last
159 at least up to the moment of call to the release() method on the iterator.
160
161 @param iterator Service Implementation iterator handle.
162 @param [out] out_name Pointer to string with name to set result pointer to.
163 @return Status of performed operation
164 @retval false success
165 @retval true Failure, may be caused when called on iterator that went
166 through all values already.
167*/
168DECLARE_BOOL_METHOD(get, (my_h_service_iterator iter, const char **out_name));
169/**
170 Advances specified iterator to next element. Will succeed but return true if
171 it reaches one-past-last element.
172
173 @param iterator Service Implementation iterator handle.
174 @return Status of performed operation and validity of iterator after
175 operation.
176 @retval false success
177 @retval true Failure or called on iterator that was on last element.
178*/
180/**
181 Checks if specified iterator is valid, i.e. have not reached one-past-last
182 element.
183
184 @param iterator Service Implementation iterator handle.
185 @return Validity of iterator
186 @retval false Valid
187 @retval true Invalid or reached one-past-last element.
188*/
190/**
191 Releases the Service Implementations iterator. Releases read lock on the
192 Registry.
193
194 @param iterator Service Implementation iterator handle.
195 @return Status of performed operation
196 @retval false success
197 @retval true failure
198*/
201
202/**
203 Service for listing all metadata for a Service Implementation specified by
204 the given iterator.
205*/
206BEGIN_SERVICE_DEFINITION(registry_metadata_enumerate)
207/**
208 Creates a iterator that iterates through all metadata for the object pointed
209 by the specified iterator. If successful it leaves read lock on the registry
210 until the iterator is released.
211
212 @param iterator A iterator that points to object to get the metadata
213 iterator for.
214 @param [out] out_iterator Pointer to metadata iterator handle.
215 @return Status of performed operation
216 @retval false success
217 @retval true failure
218*/
221/**
222 Gets the key and value of the metadata pointed to by the specified iterator.
223 The pointers returned will last at least up to the moment of call to the
224 release() method on the iterator.
225
226 @param iterator Metadata iterator handle.
227 @param [out] out_name A pointer to the string with the key to set the result
228 pointer to.
229 @param [out] out_value A pointer to the string with the metadata value to
230 set the result pointer to.
231 @return Status of performed operation
232 @retval false success
233 @retval true Failure, may be caused when called on the iterator that went
234 through all values already.
235*/
237 const char **name, const char **value));
238/**
239 Advances specified iterator to next element. Will fail if it reaches
240 one-past-last element.
241
242 @param iterator Metadata iterator handle.
243 @return Status of performed operation
244 @retval false success
245 @retval true Failure, may be caused when called on iterator that was on last
246 element.
247*/
249/**
250 Checks if specified iterator is valid, i.e. have not reached one-past-last
251 element.
252
253 @param iterator Metadata iterator handle.
254 @return Validity of iterator
255 @retval false Valid
256 @retval true Invalid or reached one-past-last element.
257*/
259/**
260 Releases the specified iterator. Releases read lock on the registry.
261
262 @param iterator Metadata iterator handle.
263 @return Status of performed operation
264 @retval false success
265 @retval true failure
266*/
268END_SERVICE_DEFINITION(registry_metadata_enumerate)
269
270/**
271 Service to query specified metadata key directly for the specified Service
272 Implementation by iterator to it.
273*/
274BEGIN_SERVICE_DEFINITION(registry_metadata_query)
275/**
276 Gets the key and value of the metadata pointed to by the specified object
277 iterator. The pointer returned will last at least up to the moment of call
278 to the release() method on the iterator.
279
280 @param iterator A iterator that points to object to get the metadata
281 iterator for.
282 @param name A pointer to the string with the key to set the result
283 pointer to.
284 @param [out] out_value A pointer to the string with the metadata value to
285 set the result pointer to.
286 @return Status of performed operation
287 @retval false success
288 @retval true Failure, may be caused when called on the iterator that went
289 through all values already.
290*/
291DECLARE_BOOL_METHOD(get_value, (my_h_service_iterator iterator,
292 const char *name, const char **value));
293END_SERVICE_DEFINITION(registry_metadata_query)
294
295#endif /* MYSQL_REGISTRY_H */
struct my_h_service_imp * my_h_service
A handle type for acquired Service.
Definition: registry.h:32
bool is_valid(const dd::Spatial_reference_system *srs, const Geometry *g, const char *func_name, bool *is_valid) noexcept
Decides if a geometry is valid.
Definition: is_valid.cc:94
static mysql_service_status_t get(reference_caching_cache cache, unsigned service_name_index, const my_h_service **refs) noexcept
Definition: component.cc:113
static mysql_service_status_t create(const char *service_names[], reference_caching_channel *out_channel) noexcept
Definition: component.cc:35
#define DECLARE_METHOD(retval, name, args)
Declares a method as a part of the Service definition.
Definition: service.h:102
#define END_SERVICE_DEFINITION(name)
A macro to end the last Service definition started with the BEGIN_SERVICE_DEFINITION macro.
Definition: service.h:90
#define BEGIN_SERVICE_DEFINITION(name)
Declares a new Service.
Definition: service.h:85
#define DEFINE_SERVICE_HANDLE(name)
Defines an object type that is meant for carrying handles to the implementation-specific objects used...
Definition: service.h:128
#define DECLARE_BOOL_METHOD(name, args)
Declares a method that returns bool as a part of the Service definition.
Definition: service.h:111
case opt name
Definition: sslopt-case.h:32
Definition: registry.cc:57
Definition: registry.cc:62