MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
option_tracker_usage.h File Reference

Go to the source code of this file.

Functions

bool option_usage_read_counter (const char *option_name, unsigned long long *pCounter, const mysql_service_registry_t *registry)
 A helper function to read the current value of a option usage counter. More...
 
bool option_usage_register_callback (const char *option_name, mysql_option_tracker_usage_cache_update_callback cb, const mysql_service_registry_t *registry)
 Registers a cache update callback. More...
 
bool option_usage_unregister_callback (const char *option_name, mysql_option_tracker_usage_cache_update_callback cb, const mysql_service_registry_t *registry)
 Unregisters a cache update callback. More...
 
bool option_usage_set_counter_from_json (const mysql_service_registry_t *registry, const char *option_name, char *usage_data, unsigned long long *pCounter)
 A helper function to parse a JSON string and extract the counter value. More...
 

Function Documentation

◆ option_usage_read_counter()

bool option_usage_read_counter ( const char *  option_name,
unsigned long long *  pCounter,
const mysql_service_registry_t registry 
)

A helper function to read the current value of a option usage counter.

Fetches a reference to the option_tracker service. Retrieves the usage JSON for the option, parses it, fetches the usedCounter field and stores it into the pointer passed. Then disposes of the reference.

Returns true if there's any error.

Return values
truefailure
falsesuccess
Parameters
option_namethe name of the option to retrieve data for
[out]pCounterthe buffer to return the value into
registryA reference to the registry service to use

◆ option_usage_register_callback()

bool option_usage_register_callback ( const char *  option_name,
mysql_option_tracker_usage_cache_update_callback  cb,
const mysql_service_registry_t registry 
)

Registers a cache update callback.

Call this to subscribe to persisted data updates

Parameters
option_namethe name of the option to register a callback for
cbthe callback function
registryA reference to the registry service to use
Return values
truefailure
falsesucees

◆ option_usage_set_counter_from_json()

bool option_usage_set_counter_from_json ( const mysql_service_registry_t registry,
const char *  option_name,
char *  usage_data,
unsigned long long *  pCounter 
)

A helper function to parse a JSON string and extract the counter value.

Given the usage JSON for the option, parses it, fetches the usedCounter field and stores it into the pointer passed.

Returns true if there's any error.

Return values
truefailure
falsesuccess
Parameters
registryA reference to the registry service to use to put errors and warnings. can be null.
option_namethe name of the option that JSON usage is for
usage_dataa JSON string for the usage data
[out]pCounterthe buffer to return the value into

◆ option_usage_unregister_callback()

bool option_usage_unregister_callback ( const char *  option_name,
mysql_option_tracker_usage_cache_update_callback  cb,
const mysql_service_registry_t registry 
)

Unregisters a cache update callback.

Call this to unsubscribe to persisted data updates

Parameters
option_namethe name of the option to unregister a callback for
cbthe callback function
registryA reference to the registry service to use
Return values
truefailure
falsesucees