Improve persisted configuration handling

When a persisted configuration file is read, the values in it are
considered to be more up-to-date than the ones in the main configuration
file. This allows all objects to be persisted in a more complete form
making it easier to change configuration values at runtime.

This change is intended to help make runtime alterations to services
possible.
This commit is contained in:
Markus Mäkelä
2017-04-25 15:51:55 +03:00
parent b736776c8f
commit f7fefad2e6
7 changed files with 116 additions and 117 deletions

View File

@ -92,6 +92,16 @@ bool config_add_param(CONFIG_CONTEXT* obj, const char* key, const char* value);
*/
bool config_append_param(CONFIG_CONTEXT* obj, const char* key, const char* value);
/**
* @brief Replace an existing parameter
*
* @param obj Configuration context
* @param key Parameter name
* @param value Parameter value
* @return True on success, false on memory allocation error
*/
bool config_replace_param(CONFIG_CONTEXT* obj, const char* key, const char* value);
/**
* @brief Construct an SSL structure
*

View File

@ -65,22 +65,6 @@ bool monitorRemoveParameter(MXS_MONITOR *monitor, const char *key);
void monitorSetInterval (MXS_MONITOR *, unsigned long);
bool monitorSetNetworkTimeout(MXS_MONITOR *, int, int);
/**
* @brief Serialize the servers of a monitor to a file
*
* This partially converts @c monitor into an INI format file. Only the servers
* of the monitor are serialized. This allows the monitor to keep monitoring
* the servers that were added at runtime even after a restart.
*
* NOTE: This does not persist the complete monitor configuration and requires
* that an existing monitor configuration is in the main configuration file.
* Changes to monitor parameters are not persisted.
*
* @param monitor Monitor to serialize
* @return False if the serialization of the monitor fails, true if it was successful
*/
bool monitor_serialize_servers(const MXS_MONITOR *monitor);
/**
* @brief Serialize a monitor to a file
*

View File

@ -82,18 +82,15 @@ void serviceRemoveBackend(SERVICE *service, const SERVER *server);
/**
* @brief Serialize a service to a file
*
* This partially converts @c service into an INI format file. Only the servers
* of the service are serialized. This allows the service to keep using the servers
* added at runtime even after a restart.
* This converts @c service into an INI format file.
*
* NOTE: This does not persist the complete service configuration and requires
* that an existing service configuration is in the main configuration file.
* Changes to service parameters are not persisted.
*
* @param service Service to serialize
* @return False if the serialization of the service fails, true if it was successful
*/
bool service_serialize_servers(const SERVICE *service);
bool service_serialize(const SERVICE *service);
/**
* Internal utility functions