24#ifndef KEYRING_METADATA_QUERY_SERVICE_IMPL_TEMPLATE_INCLUDED
25#define KEYRING_METADATA_QUERY_SERVICE_IMPL_TEMPLATE_INCLUDED
33#include <mysqld_error.h>
38namespace service_implementation {
69 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"init",
70 "keyring_component_metadata_query");
85 std::unique_ptr<config_vector> &it) {
90 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"deinit",
91 "keyring_component_metadata_query");
106 std::unique_ptr<config_vector> &it) {
108 return ((it.get() !=
nullptr) && (it.get()->size() > 0));
110 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"is_valid",
111 "keyring_component_metadata_query");
127 if (it.get()->size() == 0) {
130 it.get()->erase(it.get()->begin());
133 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"next",
134 "keyring_component_metadata_query");
151 std::unique_ptr<config_vector> &it,
size_t *key_buffer_length,
152 size_t *value_buffer_length) {
154 if (it->size() == 0) {
158 if (key_buffer_length ==
nullptr || value_buffer_length ==
nullptr) {
163 auto key_value = (*it)[0];
166 *key_buffer_length = key_value.first.length() + 1;
167 *value_buffer_length = key_value.second.length() + 1;
171 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"get_length",
172 "keyring_component_metadata_query");
191 size_t key_buffer_length,
193 size_t value_buffer_length,
194 std::unique_ptr<config_vector> &it) {
196 if (it->size() == 0) {
200 auto key_value = (*it)[0];
202 if (key_value.first.length() >= key_buffer_length) {
207 if (key_value.second.length() >= value_buffer_length) {
212 memcpy(key_buffer, key_value.first.c_str(), key_value.first.length());
213 key_buffer[key_value.first.length()] =
'\0';
214 memcpy(value_buffer, key_value.second.c_str(), key_value.second.length());
215 value_buffer[key_value.second.length()] =
'\0';
219 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"get",
220 "keyring_component_metadata_query");
Definition: service_requirements.h:36
bool create_config(std::unique_ptr< config_vector > &metadata)
Create configuration vector.
Definition: component_callbacks.cc:33
bool keyring_initialized()
Keyring component status.
Definition: component_callbacks.cc:29
@ ERROR_LEVEL
Definition: my_loglevel.h:43
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:64
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:190
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:150
bool keyring_metadata_query_keyring_initialized_template(Component_callbacks &callbacks)
Returns status of the keyring component.
Definition: keyring_metadata_query_service_impl_template.h:49
bool keyring_metadata_query_next_template(std::unique_ptr< config_vector > &it)
Move iterator forward.
Definition: keyring_metadata_query_service_impl_template.h:125
bool keyring_metadata_query_deinit_template(std::unique_ptr< config_vector > &it)
Deinitialize metadata iterator.
Definition: keyring_metadata_query_service_impl_template.h:84
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:105
Definition: keyring_encryption_service_definition.h:32