|
With the way the configuration processing happens on startup right now, this is not simple to implement.
The first obstacle is the way the configuration processing happens right at process startup. If there is a stored configuration file for an object, it completely overwrites the one in the base section and the object that would've been constructed from the static configuration section will never exist. This means that the object after startup cannot be used as the baseline to which future configuration states are compared to as it may already be in a configuration state that's not from the static configuration. One option would be to do the initialization in two steps: first from the static configuration and then from the dynamic configuration. This would complicate the current configuration processing procedure but doing the startup in two phases would make it a little bit easier to deal with. This would result in the most accurate comparison as the object's themselves would produce the configuration state that is compared.
Another alternative that does not require changes to how the startup is done is to simply do it on the configuration level. The static configuration data is kept alive (or if it isn't it's trivial to do so) and it can be used to detect when the dynamic configuration is identical to the static one. Since the generated configuration sections are complete configurations, they should produce a relatively stable configuration that can be used for literal comparisons. Problems that will be seen with this approach are the elimination of values that are explicit in one configuration and implicit in another. Some examples of these are variables that are set to the module's default values and variables that are enabled in one but aren't in other but would be implicitly enabled by another. Type conversions would also have to be done to generate a "normalized" configuration. The values 3600s, 60m and 1h are all equivalent which means even the static configuration still needs to be processed before it can be used for comparisons. One thing that can be leveraged is the mxs::Configuration object that could do the type comparisons and report whether the values are identical.
|