Add [process|thread] [init|finish] functions to modules

The MXS_MODULDE object now contains optinal pointers for functions
to be called att process and thread startup and shutdown. Since the
functions were added to the end, strictly speaking, all structures
would not have needed to have been modified, but better to be
explicit. In a subsequent change, these will be called.

C++ does not support flexible arrays, so for the time being C++
modules are restricted to 10 parameters. Better approach is to
factor out the parameters to a separate array and then just store
a pointer to that array in MXS_MODULE.
This commit is contained in:
Johan Wikman
2017-01-05 11:25:51 +02:00
parent 6a695c9407
commit a2a38f952a
49 changed files with 400 additions and 58 deletions

View File

@ -200,10 +200,10 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
{ MODULECMD_ARG_OUTPUT, "The output dcb" },
{ MODULECMD_ARG_FILTER, "Cache name" }
};
modulecmd_register_command("cache", "show", cache_command_show,
MXS_ARRAY_NELEMS(show_argv), show_argv);
MXS_NOTICE("Initialized cache module %s.\n", VERSION_STRING);
static MXS_MODULE info =
@ -213,7 +213,14 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"A caching filter that is capable of caching and returning cached data.",
VERSION_STRING,
&CacheFilter::s_object
&CacheFilter::s_object,
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;

View File

@ -123,7 +123,14 @@ MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"A routing hint filter that send queries to the master after data modification",
"V1.1.0",
&MyObject
&MyObject,
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;

View File

@ -817,7 +817,14 @@ MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"Firewall Filter",
"V1.2.0",
&MyObject
&MyObject,
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;

View File

@ -64,7 +64,14 @@ MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"A hint parsing filter",
"V1.0.0",
&MyObject
&MyObject,
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;

View File

@ -96,7 +96,15 @@ MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"Lua Filter",
"V1.0.0",
&MyObject
&MyObject,
NULL, /* Parameters */
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;

View File

@ -29,7 +29,14 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"A masking filter that is capable of masking/obfuscating returned column values.",
"V1.0.0",
&MaskingFilter::s_object
&MaskingFilter::s_object,
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;

View File

@ -88,7 +88,14 @@ MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"A filter that is capable of limiting the resultset number of rows.",
"V1.0.0",
&object
&object,
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;

View File

@ -269,7 +269,14 @@ MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"A RabbitMQ query logging filter",
"V1.0.2",
&MyObject
&MyObject,
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;

View File

@ -104,7 +104,14 @@ MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"A routing hint filter that uses regular expressions to direct queries",
"V1.1.0",
&MyObject
&MyObject,
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;

View File

@ -163,7 +163,14 @@ MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"A simple query logging filter",
"V1.1.1",
&MyObject
&MyObject,
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;

View File

@ -114,7 +114,14 @@ MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"A query rewrite filter that uses regular expressions to rewrite queries",
"V1.1.0",
&MyObject
&MyObject,
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;

View File

@ -318,7 +318,14 @@ MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"A tee piece in the filter plumbing",
"V1.0.0",
&MyObject
&MyObject,
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;

View File

@ -93,7 +93,14 @@ MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"A simple query counting filter",
"V2.0.0",
&MyObject
&MyObject,
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;

View File

@ -147,7 +147,14 @@ MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"A top N query logging filter",
"V1.0.1",
&MyObject
&MyObject,
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;

View File

@ -166,7 +166,14 @@ MXS_MODULE* MXS_CREATE_MODULE()
FILTER_VERSION,
"Transaction Performance Monitoring filter",
"V1.0.1",
&MyObject
&MyObject,
NULL, /* Process init. */
NULL, /* Process finish. */
NULL, /* Thread init. */
NULL, /* Thread finish. */
{
{MXS_END_MODULE_PARAMS}
}
};
return &info;