A helper class to handle option usage population.
Adds a top level JSON object (if missing), then adds (if missing, otherwise updates) the following two JSON elements to the top level JSON object: used (boolean) usedDate (ISO 8601 string)
Create an instance of the class at component/plugin init time and dispose of it at deinit time as follows:
...
#include "mysql/components/library_mysys/option_usage_data.h"
...
...
init() {
...
...
}
...
deinit() {
..
delete usage_data;
usage_data = nullptr;
..
}
Option_usage_data(const char *option_name, const mysql_service_registry_t *registry)
Use this constructor at init time.
Definition: option_usage_data.h:81
#define SERVICE_PLACEHOLDER(service)
Use this macro to reference the service placeholder as defined by the REQUIRES_SERVICE_PLACEHOLDER ma...
Definition: component_implementation.h:382
handlerton is a singleton structure - one instance per storage engine - to provide access to storage ...
Definition: handler.h:2740
Now, when the functionality is used (careful, an expensive call), do:
usage_data->set_sampled(true);
Do not register usage at the time the plugin component is initilized. Try to register it at the time it is actually being used. But do not do it too often: it parses JSON and writes to an InnoDB table!