24 Commits

Author SHA1 Message Date
Johan Wikman
df36ef86d0 2.4.14 Update Change Date 2020-11-16 14:23:26 +02:00
Johan Wikman
faaf7f483e 2.4.13 Update Change Date 2020-10-14 09:15:46 +03:00
Johan Wikman
babcda3eca 2.4.12 Update Change Date 2020-08-24 09:42:48 +03:00
Johan Wikman
fc9c9fcd77 2.4.11 Update change date 2020-07-07 10:01:38 +03:00
Johan Wikman
7781f7042a 2.4.10 Update change date 2020-06-05 10:21:37 +03:00
Johan Wikman
321126660f 2.4.9 Update Change Date 2020-04-29 10:17:14 +03:00
Johan Wikman
5217836e83 Update 2.4.8 Change Date
Same as that of 2.3.17. Consequently, only the 2.4 specific files
are updated.
2020-03-16 11:25:59 +02:00
Johan Wikman
f576680ed9 Update 2.4.7 change date
Only the files that were not already updated as part of the
2.3.17 release.
2020-02-12 15:21:44 +02:00
Johan Wikman
714dece7dd Update 2.4.6 Change Date
We use same as for 2.3.16.
2020-01-21 13:22:25 +02:00
Johan Wikman
a9a2b753c0 Update 2.4.5 change date 2019-12-18 13:25:03 +02:00
Johan Wikman
f6731a898d Update change date 2019-11-13 08:37:17 +02:00
Johan Wikman
fdfbf3e133 Update 2.4.3 change date 2019-11-05 12:21:00 +02:00
Johan Wikman
5a7c68e3c9 MXS-2612 Ensure that destructor order does not matter
The new configuration system relieas upon static varibles being
used for declaring what arguments a particular module uses. To
ensure that the destruction order does not matter, we redundantly
store the needed data (the name).
2019-08-29 08:01:35 +03:00
Markus Mäkelä
d3e199ff1d
Use old default parameter definitions in config2.cc
This prevents problems when 2.3 is merged into 2.4 and it contains new
common parameters with defaults.
2019-08-05 15:06:25 +03:00
Johan Wikman
0ba779d5a2 Update 2.4.0 Change Date 2019-06-25 10:11:55 +03:00
Johan Wikman
04fdaf1fdb 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.
2019-06-11 11:05:15 +03:00
Johan Wikman
68af4cb62e MXS-2556 Rename configure -> post_configure
Rename config::Configuration::configure() to
config::Configuration::post_configure(). Latter name makes it
unambiguously clear at what point the function is called.
2019-06-11 09:46:04 +03:00
Johan Wikman
a6b456dfbd MXS-2556 Add support for routers to new config mechanism 2019-06-11 09:46:04 +03:00
Johan Wikman
77197d2ce1 MXS-2556 Add Server type to new config mechanism
- Add test as well
- Sort test so that the types are tested in alphabetical order
2019-06-11 09:46:04 +03:00
Johan Wikman
ceb58d615e MXS-2540 Add monitor support to new config system
The configuration system needs to be aware of standard monitor
parameters.
2019-06-05 11:10:28 +03:00
Markus Mäkelä
6b8ca35408
Format core source files
Formatted core .cc files according to current uncrustify configuration.
2019-05-06 16:05:50 +03:00
Johan Wikman
0c7a3240bd MXS-2346 Exclude core parameters
Core parameters are not handled by the module but by the core and
must hence be ignored when validating and configuring.
2019-04-12 15:03:02 +03:00
Johan Wikman
c381aefefc MXS-2346 Add config::ParamInteger and config::Integer 2019-04-12 15:03:02 +03:00
Johan Wikman
09702ab0a0 MXS-2346 Provide new configuration mechanism
The configuration mechanism consists of the following concepts:

Specification
  Specifies the available configuration parameters of a module,
  their names and their types.
Param
  Specifies a parameter, its name and its type.
Type
  Specifies the type of a configuration parameters; Bool, Size,
  Count, etc.
Configuration
  Specifies the configuration values of a particular instance of
  the module. Configuration walks hand in hand with Specification,
  the latter specifies what the former should contain.

A Specification is capable of configuring a Configuration from a
MXS_CONFIG_PARAMETER, checking in the process that all parameters
are of the correct type and that the required parameters are present.

A Specification is capable of persisting itself so that it later
can be read back.

The mechanism is closed for modification but open for extension in
the sense that if a module requires a custom parameter, all it needs
to do is to derive one class from Param and another from Type.

The canonical way for using this mechanism is as follows. Consider
a module xyx that has three parameters; a parameter called
"enabled" that is of boolean type, a parameter called "period"
that is of duration type, and a parameter "cache" that is of
size type. That would be declared as follows:

    // xyz.hh
    class XYZSession;

    class XYZ : public maxscale::Filter<XYZ, XYZSession>
    {
    public:
        static XYZ* create(const char* zName, MXS_CONFIG_PARAMETER* pParams);

    private:
        XYZ();

        static config::Specification                       s_specification;
        static config::ParamBool                           s_enabled;
        static config::ParamDuration<std::chrono::seconds> s_period;
        static config::ParamSize                           s_cache;

        config::Configuration                              m_configuration;
        config::Bool                                       m_enabled;
        config::Duration<std::chrono::seconds>             m_period;
        config::Size                                       m_cache;
    };

    // xyz.cc

    config::Specification XYZ::s_specification(MXS_MODULE_NAME);

    config::ParamBool XYZ::s_enabled(
        &s_specification,
        "enabled",
        "Specifies whether ... should be enabled or not."
        );
    config::ParamDuration<std::chrono::seconds> XYZ::s_period(
        &s_specification,
        "period",
        "Specifies the period. Rounded to the nearest second."
        );
    config::ParamSize XYZ::s_cache(
        &s_specification,
        "cache",
        "Specifies the size of the internal cache."
        );

    XYZ::XYZ()
        : m_configuration(&s_specification)
        , m_enabled(&m_configuration, &s_enabled)
        , m_period(&m_configuration, &s_period)
        , m_cache(&m_configuration, &s_cache)
    {
    }

    XYZ* XYZ::create(const char* zName, MXS_CONFIG_PARAMETER* pParams)
    {
        XYZ* pXyz = new XYZ;

        if (!s_specification.configure(pXyz->m_configuration, pParams))
        {
            delete pXyz;
            pXyz = nullptr;
        }

        return pXyz;
    }
2019-04-12 15:03:02 +03:00