MySQL 8.0.40
Source Code Documentation
s_mysql_keyring_component_metadata_query Struct Reference

Keyring component metadata query service provides APIs to obtain component specific metadata in string format. More...

#include <keyring_metadata_query.h>

Public Attributes

mysql_service_status_t(* init )(my_h_keyring_component_metadata_iterator *metadata_iterator)
 Initialize metadata iterator. More...
 
mysql_service_status_t(* deinit )(my_h_keyring_component_metadata_iterator metadata_iterator)
 Deinitialize metadata iterator. More...
 
mysql_service_status_t(* is_valid )(my_h_keyring_component_metadata_iterator metadata_iterator)
 Check validity of iterator. More...
 
mysql_service_status_t(* next )(my_h_keyring_component_metadata_iterator metadata_iterator)
 Move iterator forward. More...
 
mysql_service_status_t(* get_length )(my_h_keyring_component_metadata_iterator metadata_iterator, size_t *key_buffer_length, size_t *value_buffer_length)
 Get length information about metadata key and value. More...
 
mysql_service_status_t(* get )(my_h_keyring_component_metadata_iterator metadata_iterator, char *key_buffer, size_t key_buffer_len, char *value_buffer, size_t value_buffer_len)
 Get name and value of metadata at current position. More...
 

Detailed Description

Keyring component metadata query service provides APIs to obtain component specific metadata in string format.

Metadata would be in (key, value) pair.

Implementor can decide what metadata should be exposed through these APIs.

One of the primary consumer of this metadata is Performance schema table keyring_component_status.

bool print_component_status() {
bool next_status = false;
my_service<SERVICE_TYPE(keyring_component_metadata_query)>
metadata_query_service("keyring_component_metadata_query",
m_reg_srv);
if (!metadata_query_service.valid()) {
return false;
}
if (metadata_query_service->init(&iterator) == true) {
return false;
}
bool ok = true;
for (; metadata_query_service->is_valid(iterator) && next_status;
next_status = metadata_query_service->next(iterator)) {
size_t key_buffer_length = 0;
size_t value_buffer_length = 0;
if (metadata_query_service->get_length(iterator, &key_buffer_length,
&value_buffer_length) == true) {
ok = false;
break;
}
std::unique_ptr<char[]> key_buffer(new char[key_buffer_length]);
std::unique_ptr<char[]> value_buffer(new char[value_buffer_length]);
if (key_buffer.get() == nullptr || value_buffer.get() == nullptr) break;
memset(key_buffer.get(), 0, key_buffer_length);
memset(value_buffer.get(), 0, value_buffer_length);
if (metadata_query_service->get(
iterator, key_buffer.get(), key_buffer_length, value_buffer.get(),
value_buffer_length) == true) {
ok = false;
break;
}
std::cout << "Metadata key: " << key_buffer.get()
<< ". Metadata value: " << value_buffer.get.get() << std::endl;
}
if (metadata_query_service->deinit(iterator) {
return false;
}
return ok;
}
Wraps my_h_service struct conforming ABI into RAII C++ object with ability to cast to desired service...
Definition: my_service.h:35
struct my_h_keyring_component_metadata_iterator_imp * my_h_keyring_component_metadata_iterator
Definition: keyring_metadata_query.h:29
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76

Member Data Documentation

◆ deinit

mysql_service_status_t(* s_mysql_keyring_component_metadata_query::deinit) (my_h_keyring_component_metadata_iterator metadata_iterator)

Deinitialize metadata iterator.

Parameters
[in,out]metadata_iteratorMetadata iterator handle
Returns
Status of iterator deinitialization
Return values
falseSuccess
trueFailure

◆ get

mysql_service_status_t(* s_mysql_keyring_component_metadata_query::get) (my_h_keyring_component_metadata_iterator metadata_iterator, char *key_buffer, size_t key_buffer_len, char *value_buffer, size_t value_buffer_len)

Get name and value of metadata at current position.

Parameters
[in]metadata_iteratorMetadata iterator handle
[out]key_bufferOutput buffer for key. Byte string.
[in]key_buffer_lengthLength of key buffer
[out]value_bufferOutput buffer for value. Byte string.
[in]value_buffer_lengthLength of value buffer
Returns
Status of fetch operation
Return values
falseSuccess
trueFailure

◆ get_length

mysql_service_status_t(* s_mysql_keyring_component_metadata_query::get_length) (my_h_keyring_component_metadata_iterator metadata_iterator, size_t *key_buffer_length, size_t *value_buffer_length)

Get length information about metadata key and value.

Parameters
[in]metadata_iteratorMetadata iterator handle
[out]key_buffer_lengthLength of the key buffer
[out]value_buffer_lengthLength of the value buffer
Returns
Get length information about key and value
Return values
falseSuccess
trueFailure

◆ init

mysql_service_status_t(* s_mysql_keyring_component_metadata_query::init) (my_h_keyring_component_metadata_iterator *metadata_iterator)

Initialize metadata iterator.

deinit should be called for clean-up.

Parameters
[out]metadata_iteratorMetadata iterator handle
Returns
Status of iterator initialization
Return values
falseSuccess
trueFailure

◆ is_valid

mysql_service_status_t(* s_mysql_keyring_component_metadata_query::is_valid) (my_h_keyring_component_metadata_iterator metadata_iterator)

Check validity of iterator.

Parameters
[in]metadata_iteratorMetadata iterator handle
Returns
Validity of the the iterator
Return values
trueIterator valid
falseIterator invalid

◆ next

mysql_service_status_t(* s_mysql_keyring_component_metadata_query::next) (my_h_keyring_component_metadata_iterator metadata_iterator)

Move iterator forward.

Parameters
[in,out]metadata_iteratorMetadata iterator handle
Returns
Status of operation
Return values
falseSuccess
trueFailure. Either iterator already reached end position or some other error was encountered.

The documentation for this struct was generated from the following file: