24#ifndef KEYRING_KEYS_METADATA_SERVICE_IMPL_TEMPLATE_INCLUDED
25#define KEYRING_KEYS_METADATA_SERVICE_IMPL_TEMPLATE_INCLUDED
33#include <mysqld_error.h>
47namespace service_implementation {
61template <
typename Backend,
typename Data_extension = Data>
69 ER_NOTE_KEYRING_COMPONENT_NOT_INITIALIZED);
76 ER_NOTE_KEYRING_COMPONENT_KEYS_METADATA_ITERATOR_INIT_FAILED);
82 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"init",
83 "keyring_keys_metadata_iterator");
100template <
typename Backend,
typename Data_extension = Data>
108 ER_NOTE_KEYRING_COMPONENT_NOT_INITIALIZED);
114 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"deinit",
115 "keyring_keys_metadata_iterator");
132template <
typename Backend,
typename Data_extension = Data>
140 ER_NOTE_KEYRING_COMPONENT_NOT_INITIALIZED);
143 return keyring_operations.
is_valid(it);
145 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"is_valid",
146 "keyring_keys_metadata_iterator");
163template <
typename Backend,
typename Data_extension = Data>
171 ER_NOTE_KEYRING_COMPONENT_NOT_INITIALIZED);
174 if (keyring_operations.
next(it) ==
true) {
179 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"next",
180 "keyring_keys_metadata_iterator");
199template <
typename Backend,
typename Data_extension = Data>
202 size_t *auth_id_length,
208 ER_NOTE_KEYRING_COMPONENT_NOT_INITIALIZED);
217 ER_NOTE_KEYRING_COMPONENT_KEYS_METADATA_ITERATOR_FETCH_FAILED);
221 *data_id_length = metadata.
key_id().length();
222 *auth_id_length = metadata.
owner_id().length();
225 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"get_length",
226 "keyring_keys_metadata_iterator");
246template <
typename Backend,
typename Data_extension = Data>
249 size_t data_id_length,
char *auth_id,
size_t auth_id_length,
255 ER_NOTE_KEYRING_COMPONENT_NOT_INITIALIZED);
264 ER_NOTE_KEYRING_COMPONENT_KEYS_METADATA_ITERATOR_FETCH_FAILED);
268 if (metadata.
key_id().length() >= data_id_length) {
273 if (metadata.
owner_id().length() >= auth_id_length) {
278 memcpy(data_id, metadata.
key_id().c_str(), metadata.
key_id().length());
279 data_id[metadata.
key_id().length()] =
'\0';
281 auth_id[metadata.
owner_id().length()] =
'\0';
284 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"get",
285 "keyring_keys_metadata_iterator");
Sensitive data storage.
Definition: data.h:40
Definition: iterator.h:33
Keyring operations A class to perform operations on keyring.
Definition: operations.h:483
bool next(std::unique_ptr< iterator::Iterator< Data_extension > > &it)
Move iterator forward.
Definition: operations.h:721
bool get_iterator_data(std::unique_ptr< iterator::Iterator< Data_extension > > &it, meta::Metadata &metadata, Data_extension &data)
Get data from iterator.
Definition: operations.h:737
bool init_forward_iterator(std::unique_ptr< iterator::Iterator< Data_extension > > &it, bool cached)
Iterator creation.
Definition: operations.h:681
void deinit_forward_iterator(std::unique_ptr< iterator::Iterator< Data_extension > > &it)
Iterator destruction.
Definition: operations.h:694
bool is_valid(std::unique_ptr< iterator::Iterator< Data_extension > > &it)
Check iterator validity.
Definition: operations.h:708
bool get_iterator_metadata(std::unique_ptr< iterator::Iterator< Data_extension > > &it, meta::Metadata &metadata, Data_extension &data)
Get metadata from iterator.
Definition: operations.h:763
Definition: service_requirements.h:36
bool keyring_initialized()
Keyring component status.
Definition: component_callbacks.cc:29
@ ERROR_LEVEL
Definition: my_loglevel.h:43
@ INFORMATION_LEVEL
Definition: my_loglevel.h:45
bool deinit_keys_metadata_iterator_template(std::unique_ptr< Iterator< Data_extension > > &it, Keyring_operations< Backend, Data_extension > &keyring_operations, Component_callbacks &callbacks)
Iterator deinitialization.
Definition: keyring_keys_metadata_iterator_service_impl_template.h:101
bool keys_metadata_get_template(std::unique_ptr< Iterator< Data_extension > > &it, char *data_id, size_t data_id_length, char *auth_id, size_t auth_id_length, Keyring_operations< Backend, Data_extension > &keyring_operations, Component_callbacks &callbacks)
Fetch metadata for current key pointed by iterator.
Definition: keyring_keys_metadata_iterator_service_impl_template.h:247
bool keys_metadata_iterator_is_valid(std::unique_ptr< Iterator< Data_extension > > &it, Keyring_operations< Backend, Data_extension > &keyring_operations, Component_callbacks &callbacks)
Check validity of the iterator.
Definition: keyring_keys_metadata_iterator_service_impl_template.h:133
bool init_keys_metadata_iterator_template(std::unique_ptr< Iterator< Data_extension > > &it, Keyring_operations< Backend, Data_extension > &keyring_operations, Component_callbacks &callbacks)
Forward iterator initialization.
Definition: keyring_keys_metadata_iterator_service_impl_template.h:62
bool keys_metadata_iterator_next(std::unique_ptr< Iterator< Data_extension > > &it, Keyring_operations< Backend, Data_extension > &keyring_operations, Component_callbacks &callbacks)
Move iterator forward.
Definition: keyring_keys_metadata_iterator_service_impl_template.h:164
bool keys_metadata_get_length_template(std::unique_ptr< Iterator< Data_extension > > &it, size_t *data_id_length, size_t *auth_id_length, Keyring_operations< Backend, Data_extension > &keyring_operations, Component_callbacks &callbacks)
Fetch length of metadata for current key pointed by iterator.
Definition: keyring_keys_metadata_iterator_service_impl_template.h:200
Definition: keyring_encryption_service_definition.h:32
std::conditional_t< !std::is_array< T >::value, std::unique_ptr< T, detail::Deleter< T > >, std::conditional_t< detail::is_unbounded_array_v< T >, std::unique_ptr< T, detail::Array_deleter< std::remove_extent_t< T > > >, void > > unique_ptr
The following is a common type that is returned by all the ut::make_unique (non-aligned) specializati...
Definition: ut0new.h:2438