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>
67 if (
callbacks.keyring_initialized() ==
false) {
77 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"init",
78 "keyring_keys_metadata_iterator");
95template <
typename Backend,
typename Data_extension = Data>
101 if (
callbacks.keyring_initialized() ==
false) {
107 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"deinit",
108 "keyring_keys_metadata_iterator");
125template <
typename Backend,
typename Data_extension = Data>
131 if (
callbacks.keyring_initialized() ==
false)
return false;
132 return keyring_operations.
is_valid(it);
134 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"is_valid",
135 "keyring_keys_metadata_iterator");
152template <
typename Backend,
typename Data_extension = Data>
158 if (
callbacks.keyring_initialized() ==
false) {
161 if (keyring_operations.
next(it) ==
true) {
166 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"next",
167 "keyring_keys_metadata_iterator");
186template <
typename Backend,
typename Data_extension = Data>
189 size_t *auth_id_length,
193 if (
callbacks.keyring_initialized() ==
false) {
202 ER_NOTE_KEYRING_COMPONENT_KEYS_METADATA_ITERATOR_FETCH_FAILED);
206 *data_id_length = metadata.
key_id().length();
207 *auth_id_length = metadata.
owner_id().length();
210 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"get_length",
211 "keyring_keys_metadata_iterator");
231template <
typename Backend,
typename Data_extension = Data>
234 size_t data_id_length,
char *auth_id,
size_t auth_id_length,
238 if (
callbacks.keyring_initialized() ==
false) {
247 ER_NOTE_KEYRING_COMPONENT_KEYS_METADATA_ITERATOR_FETCH_FAILED);
251 if (metadata.
key_id().length() >= data_id_length) {
256 if (metadata.
owner_id().length() >= auth_id_length) {
261 memcpy(data_id, metadata.
key_id().c_str(), metadata.
key_id().length());
262 data_id[metadata.
key_id().length()] =
'\0';
264 auth_id[metadata.
owner_id().length()] =
'\0';
267 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"get",
268 "keyring_keys_metadata_iterator");
static const sasl_callback_t callbacks[]
Definition: auth_ldap_sasl_client.h:45
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
@ 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:96
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:232
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:126
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:153
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:187
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:2439