24#ifndef KEYRING_METADATA_QUERY_SERVICE_IMPL_TEMPLATE_INCLUDED
25#define KEYRING_METADATA_QUERY_SERVICE_IMPL_TEMPLATE_INCLUDED
33#include <mysqld_error.h>
68 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"init",
69 "keyring_component_metadata_query");
84 std::unique_ptr<config_vector> &it) {
89 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"deinit",
90 "keyring_component_metadata_query");
105 std::unique_ptr<config_vector> &it) {
107 return (it !=
nullptr) && !it->empty();
109 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"is_valid",
110 "keyring_component_metadata_query");
129 it->erase(it->begin());
132 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"next",
133 "keyring_component_metadata_query");
150 std::unique_ptr<config_vector> &it,
size_t *key_buffer_length,
151 size_t *value_buffer_length) {
157 if (key_buffer_length ==
nullptr || value_buffer_length ==
nullptr) {
162 auto key_value = (*it)[0];
165 *key_buffer_length = key_value.first.length() + 1;
166 *value_buffer_length = key_value.second.length() + 1;
170 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"get_length",
171 "keyring_component_metadata_query");
190 size_t key_buffer_length,
192 size_t value_buffer_length,
193 std::unique_ptr<config_vector> &it) {
199 auto key_value = (*it)[0];
201 if (key_value.first.length() >= key_buffer_length) {
206 if (key_value.second.length() >= value_buffer_length) {
211 memcpy(key_buffer, key_value.first.c_str(), key_value.first.length());
212 key_buffer[key_value.first.length()] =
'\0';
213 memcpy(value_buffer, key_value.second.c_str(), key_value.second.length());
214 value_buffer[key_value.second.length()] =
'\0';
218 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"get",
219 "keyring_component_metadata_query");
Definition: service_requirements.h:35
bool create_config(std::unique_ptr< config_vector > &metadata)
Create configuration vector.
Definition: component_callbacks.cc:32
bool keyring_initialized()
Keyring component status.
Definition: component_callbacks.cc:28
@ ERROR_LEVEL
Definition: my_loglevel.h:43
Definition: keyring_encryption_service_impl_template.h:56
bool keyring_metadata_query_init_template(std::unique_ptr< config_vector > &it, Component_callbacks &callbacks)
Initialize metadata iterator.
Definition: keyring_metadata_query_service_impl_template.h:63
bool keyring_metadata_query_get_template(char *key_buffer, size_t key_buffer_length, char *value_buffer, size_t value_buffer_length, std::unique_ptr< config_vector > &it)
Get name and value of metadata at current position.
Definition: keyring_metadata_query_service_impl_template.h:189
bool keyring_metadata_query_get_length_template(std::unique_ptr< config_vector > &it, size_t *key_buffer_length, size_t *value_buffer_length)
Get length information about metadata key and value.
Definition: keyring_metadata_query_service_impl_template.h:149
bool keyring_metadata_query_keyring_initialized_template(Component_callbacks &callbacks)
Returns status of the keyring component.
Definition: keyring_metadata_query_service_impl_template.h:48
bool keyring_metadata_query_next_template(std::unique_ptr< config_vector > &it)
Move iterator forward.
Definition: keyring_metadata_query_service_impl_template.h:124
bool keyring_metadata_query_deinit_template(std::unique_ptr< config_vector > &it)
Deinitialize metadata iterator.
Definition: keyring_metadata_query_service_impl_template.h:83
bool keyring_metadata_query_is_valid_template(std::unique_ptr< config_vector > &it)
Check validity of iterator.
Definition: keyring_metadata_query_service_impl_template.h:104