MySQL  8.0.18
Source Code Documentation
registry.h
Go to the documentation of this file.
1 /* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
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 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 */
59 DECLARE_BOOL_METHOD(acquire,
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. Otherwise the default Service Implementation for specified
65  Service is returned.
66 
67  @param service_name Name of Service or Service Implementation to acquire.
68  @param service Service handle already acquired Service Implementation.
69  @param [out] out_service Pointer to Service Implementation handle to set
70  acquired Service Implementation.
71  @return Status of performed operation
72  @retval false success
73  @retval true failure
74 */
75 DECLARE_BOOL_METHOD(acquire_related,
76  (const char *service_name, my_h_service service,
77  my_h_service *out_service));
78 /**
79  Releases the Service Implementation previously acquired. After the call to
80  this method the usage of the Service Implementation handle will lead to
81  unpredicted results.
82 
83  @param service Service Implementation handle of already acquired Service.
84  @return Status of performed operation
85  @retval false success
86  @retval true failure
87 */
88 DECLARE_BOOL_METHOD(release, (my_h_service service));
89 END_SERVICE_DEFINITION(registry)
90 
91 /**
92  Service for managing list of registered Service Implementations.
93 */
94 BEGIN_SERVICE_DEFINITION(registry_registration)
95 /**
96  Registers a new Service Implementation. If it is the first Service
97  Implementation for the specified Service then it is made a default one.
98 
99  @param service_implementation_name Name of the Service Implementation to
100  register.
101  @param ptr Pointer to the Service Implementation structure.
102  @return Status of performed operation
103  @retval false success
104  @retval true failure
105 */
106 DECLARE_BOOL_METHOD(register_service, (const char *service_implementation_name,
108 /**
109  Removes previously registered Service Implementation from registry. If it is
110  the default one for specified Service then any one still registered is made
111  default. If there is no other, the default entry is removed from the
112  Registry too.
113 
114  @param service_implementation_name Name of the Service Implementation to
115  unregister.
116  @return Status of performed operation
117  @retval false success
118  @retval true Failure. May happen when Service is still being referenced.
119 */
120 DECLARE_BOOL_METHOD(unregister, (const char *service_implementation_name));
121 /**
122  Sets new default Service Implementation for corresponding Service name.
123 
124  @param service_implementation_name Name of the Service Implementation to
125  set as default one.
126  @return Status of performed operation
127  @retval false success
128  @retval true failure
129 */
130 DECLARE_BOOL_METHOD(set_default, (const char *service_implementation_name));
131 END_SERVICE_DEFINITION(registry_registration)
132 
133 /**
134  Service for listing all Service Implementations by iterator.
135 */
137 /**
138  Creates iterator that iterates through all registered Service
139  Implementations. If successful it leaves read lock on the Registry until
140  iterator is released. The starting point of iteration may be specified
141  to be on one particular Service Implementation. The iterator will move
142  through all Service Implementations and additionally through all default
143  Service Implementation additionally, i.e. the default Service Implementation
144  will be returned twice. If no name is specified for search, iterator will be
145  positioned on the first Service Implementation.
146 
147  @param service_name_pattern Name of Service or Service Implementation to
148  start iteration from. May be empty string or NULL pointer, in which case
149  iteration starts from the first Service Implementation.
150  @param [out] out_iterator Pointer to the Service Implementation iterator
151  handle.
152  @return Status of performed operation
153  @retval false success
154  @retval true failure
155 */
156 DECLARE_BOOL_METHOD(create, (const char *service_name_pattern,
157  my_h_service_iterator *out_iterator));
158 /**
159  Gets name of Service pointed to by iterator. The pointer returned will last
160  at least up to the moment of call to the release() method on the iterator.
161 
162  @param iterator Service Implementation iterator handle.
163  @param [out] out_name Pointer to string with name to set result pointer to.
164  @return Status of performed operation
165  @retval false success
166  @retval true Failure, may be caused when called on iterator that went
167  through all values already.
168 */
169 DECLARE_BOOL_METHOD(get, (my_h_service_iterator iter, const char **out_name));
170 /**
171  Advances specified iterator to next element. Will succeed but return true if
172  it reaches one-past-last element.
173 
174  @param iterator Service Implementation iterator handle.
175  @return Status of performed operation and validity of iterator after
176  operation.
177  @retval false success
178  @retval true Failure or called on iterator that was on last element.
179 */
181 /**
182  Checks if specified iterator is valid, i.e. have not reached one-past-last
183  element.
184 
185  @param iterator Service Implementation iterator handle.
186  @return Validity of iterator
187  @retval false Valid
188  @retval true Invalid or reached one-past-last element.
189 */
191 /**
192  Releases the Service Implementations iterator. Releases read lock on the
193  Registry.
194 
195  @param iterator Service Implementation iterator handle.
196  @return Status of performed operation
197  @retval false success
198  @retval true failure
199 */
200 DECLARE_METHOD(void, release, (my_h_service_iterator iter));
201 END_SERVICE_DEFINITION(registry_query)
202 
203 /**
204  Service for listing all metadata for a Service Implementation specified by
205  the given iterator.
206 */
207 BEGIN_SERVICE_DEFINITION(registry_metadata_enumerate)
208 /**
209  Creates a iterator that iterates through all metadata for the object pointed
210  by the specified iterator. If successful it leaves read lock on the registry
211  until the iterator is released.
212 
213  @param iterator A iterator that points to object to get the metadata
214  iterator for.
215  @param [out] out_iterator Pointer to metadata iterator handle.
216  @return Status of performed operation
217  @retval false success
218  @retval true failure
219 */
222 /**
223  Gets the key and value of the metadata pointed to by the specified iterator.
224  The pointers returned will last at least up to the moment of call to the
225  release() method on the iterator.
226 
227  @param iterator Metadata iterator handle.
228  @param [out] out_name A pointer to the string with the key to set the result
229  pointer to.
230  @param [out] out_value A pointer to the string with the metadata value to
231  set the result pointer to.
232  @return Status of performed operation
233  @retval false success
234  @retval true Failure, may be caused when called on the iterator that went
235  through all values already.
236 */
238  const char **name, const char **value));
239 /**
240  Advances specified iterator to next element. Will fail if it reaches
241  one-past-last element.
242 
243  @param iterator Metadata iterator handle.
244  @return Status of performed operation
245  @retval false success
246  @retval true Failure, may be caused when called on iterator that was on last
247  element.
248 */
250 /**
251  Checks if specified iterator is valid, i.e. have not reached one-past-last
252  element.
253 
254  @param iterator Metadata iterator handle.
255  @return Validity of iterator
256  @retval false Valid
257  @retval true Invalid or reached one-past-last element.
258 */
260 /**
261  Releases the specified iterator. Releases read lock on the registry.
262 
263  @param iterator Metadata iterator handle.
264  @return Status of performed operation
265  @retval false success
266  @retval true failure
267 */
269 END_SERVICE_DEFINITION(registry_metadata_enumerate)
270 
271 /**
272  Service to query specified metadata key directly for the specified Service
273  Implementation by iterator to it.
274 */
275 BEGIN_SERVICE_DEFINITION(registry_metadata_query)
276 /**
277  Gets the key and value of the metadata pointed to by the specified object
278  iterator. The pointer returned will last at least up to the moment of call
279  to the release() method on the iterator.
280 
281  @param iterator A iterator that points to object to get the metadata
282  iterator for.
283  @param name A pointer to the string with the key to set the result
284  pointer to.
285  @param [out] out_value A pointer to the string with the metadata value to
286  set the result pointer to.
287  @return Status of performed operation
288  @retval false success
289  @retval true Failure, may be caused when called on the iterator that went
290  through all values already.
291 */
292 DECLARE_BOOL_METHOD(get_value, (my_h_service_iterator iterator,
293  const char *name, const char **value));
294 END_SERVICE_DEFINITION(registry_metadata_query)
295 
296 #endif /* MYSQL_REGISTRY_H */
const string name("\ame\)
#define DEFINE_SERVICE_HANDLE(name)
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
Definition: registry.cc:57
#define DECLARE_METHOD(retval, name, args)
Definition: registry.cc:62
#define DECLARE_BOOL_METHOD(name, args)
#define BEGIN_SERVICE_DEFINITION(name)
Type get(const Shards< COUNT > &shards, size_t id)
Get the counter value for a shard.
Definition: ut0counter.h:272
const string value("\alue\)
#define END_SERVICE_DEFINITION(name)
struct my_h_service_imp * my_h_service
A handle type for acquired Service.
Definition: registry.h:32