MXS-2253 Add MXS_MODULE_PARAM_DURATION

Added a new module parameter type to be used for parameters
that specify a duration. With the suffixes 'h', 'm', 's' and
'ms' the duration can be specified in hours, minutes, seconds
or milliseconds, respectively.

Irrespective of how the duration is specified, it is always
returned as milliseconds.

For backward compatibility, when a duration value is read it must
be specifed how a value *not* defined using a suffix should be
interpreted; as seconds or milliseconds.

  value = param->get_duration(name, mxs::config::INTERPRET_AS_SECONDS);
This commit is contained in:
Johan Wikman
2019-02-12 11:59:22 +02:00
parent a0d715a39f
commit c116452c25
5 changed files with 203 additions and 9 deletions

View File

@ -85,7 +85,8 @@ enum mxs_module_param_type
MXS_MODULE_PARAM_SERVICE, /**< Service name */
MXS_MODULE_PARAM_SERVER, /**< Server name */
MXS_MODULE_PARAM_SERVERLIST, /**< List of server names, separated by ',' */
MXS_MODULE_PARAM_REGEX /**< A regex string enclosed in '/' */
MXS_MODULE_PARAM_REGEX, /**< A regex string enclosed in '/' */
MXS_MODULE_PARAM_DURATION, /**< Duration in milliseconds */
};
/** Maximum and minimum values for integer types */