MXS-2556 Make config::Configuration aware of its object

The name of the object (i.e. the section name from the configuration
file), is now stored in the configuration object for that object.

That way, more contextual and hence morfe user friendly errors and
warnings can be generated.
This commit is contained in:
Johan Wikman
2019-06-11 11:05:15 +03:00
parent df5377f135
commit 04fdaf1fdb
11 changed files with 37 additions and 20 deletions

View File

@ -146,8 +146,8 @@ config::ParamBool CacheConfig::s_enabled(
true
);
CacheConfig::CacheConfig()
: config::Configuration(&s_specification)
CacheConfig::CacheConfig(const std::string& name)
: config::Configuration(name, &s_specification)
, storage(this, &s_storage)
, storage_options(this, &s_storage_options)
, hard_ttl(this, &s_hard_ttl)

View File

@ -38,7 +38,7 @@ const cache_thread_model CACHE_DEFAULT_THREAD_MODEL = CACHE_THREAD_MODEL_ST;
class CacheConfig : public config::Configuration
{
public:
CacheConfig();
CacheConfig(const std::string& name);
~CacheConfig();
CacheConfig(const CacheConfig&) = delete;

View File

@ -144,7 +144,8 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
// CacheFilter
//
CacheFilter::CacheFilter()
CacheFilter::CacheFilter(const std::string& name)
: m_config(name)
{
}
@ -155,7 +156,7 @@ CacheFilter::~CacheFilter()
// static
CacheFilter* CacheFilter::create(const char* zName, MXS_CONFIG_PARAMETER* ppParams)
{
CacheFilter* pFilter = new CacheFilter;
CacheFilter* pFilter = new CacheFilter(zName);
if (pFilter)
{

View File

@ -49,7 +49,7 @@ public:
private:
CacheFilter();
CacheFilter(const std::string& name);
CacheFilter(const CacheFilter&);
CacheFilter& operator=(const CacheFilter&);