Addition of the module info structure to allow module information to
be extracted from the modules. This gives a way to verify the API that the module provides as well as the version of that API. The hope is that this will make it possible for MaxScale to detect out of date plugins and either adapt to use them or reject loading them. Also added the ability to set a release state on a per module basis. This allows for production ready and non-production ready plugins to be identified.
This commit is contained in:
@ -19,6 +19,7 @@
|
||||
*/
|
||||
#include <spinlock.h>
|
||||
#include <buffer.h>
|
||||
#include <modinfo.h>
|
||||
#include <gwbitmask.h>
|
||||
#include <skygw_utils.h>
|
||||
#include <netinet/in.h>
|
||||
@ -93,6 +94,13 @@ typedef struct gw_protocol {
|
||||
int (*session)(struct dcb *, void *);
|
||||
} GWPROTOCOL;
|
||||
|
||||
/**
|
||||
* The GWPROTOCOL version data. The following should be updated whenever
|
||||
* the GWPROTOCOL structure is changed. See the rules defined in modinfo.h
|
||||
* that define how these numbers should change.
|
||||
*/
|
||||
#define GWPROTOCOL_VERSION {1, 0, 0}
|
||||
|
||||
/**
|
||||
* The statitics gathered on a descriptor control block
|
||||
*/
|
||||
|
||||
85
server/include/modinfo.h
Normal file
85
server/include/modinfo.h
Normal file
@ -0,0 +1,85 @@
|
||||
#ifndef _MODINFO_H
|
||||
#define _MODINFO_H
|
||||
/*
|
||||
* This file is distributed as part of MaxScale. It is free
|
||||
* software: you can redistribute it and/or modify it under the terms of the
|
||||
* GNU General Public License as published by the Free Software Foundation,
|
||||
* version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Copyright SkySQL Ab 2014
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file modinfo.h The module information interface
|
||||
*
|
||||
* @verbatim
|
||||
* Revision History
|
||||
*
|
||||
* Date Who Description
|
||||
* 02/06/14 Mark Riddoch Initial implementation
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
|
||||
/**
|
||||
* The status of the module. This gives some idea of the module
|
||||
* maturity.
|
||||
*/
|
||||
typedef enum {
|
||||
MODULE_IN_DEVELOPMENT = 0,
|
||||
MODULE_ALPHA_RELEASE,
|
||||
MODULE_BETA_RELEASE,
|
||||
MODULE_GA
|
||||
} MODULE_STATUS;
|
||||
|
||||
/**
|
||||
* The API implemented by the module
|
||||
*/
|
||||
typedef enum {
|
||||
MODULE_API_PROTOCOL = 0,
|
||||
MODULE_API_ROUTER,
|
||||
MODULE_API_MONITOR,
|
||||
MODULE_API_FILTER,
|
||||
MODULE_API_AUTHENTICATION
|
||||
} MODULE_API;
|
||||
|
||||
/**
|
||||
* The module version structure.
|
||||
*
|
||||
* The rules for changing these values are:
|
||||
*
|
||||
* Any change that affects an inexisting call in the API in question,
|
||||
* making the new API no longer compatible with the old,
|
||||
* must increment the major version.
|
||||
*
|
||||
* Any change that adds to the API, but does not alter the existing API
|
||||
* calls, must increment the minor version.
|
||||
*
|
||||
* Any change that is purely cosmetic and does not affect the calling
|
||||
* conventions of the API must increment only the patch version number.
|
||||
*/
|
||||
typedef struct {
|
||||
int major;
|
||||
int minor;
|
||||
int patch;
|
||||
} MODULE_VERSION;
|
||||
|
||||
/**
|
||||
* The module information structure
|
||||
*/
|
||||
typedef struct {
|
||||
MODULE_API modapi;
|
||||
MODULE_STATUS status;
|
||||
MODULE_VERSION api_version;
|
||||
char *description;
|
||||
} MODULE_INFO;
|
||||
#endif
|
||||
@ -18,6 +18,7 @@
|
||||
* Copyright SkySQL Ab 2013
|
||||
*/
|
||||
#include <dcb.h>
|
||||
#include <modinfo.h>
|
||||
|
||||
/**
|
||||
* @file modules.h Utilities for loading modules
|
||||
@ -39,6 +40,8 @@ typedef struct modules {
|
||||
char *version; /**< Module version */
|
||||
void *handle; /**< The handle returned by dlopen */
|
||||
void *modobj; /**< The module "object" this is the set of entry points */
|
||||
MODULE_INFO
|
||||
*info; /**< The module information */
|
||||
struct modules
|
||||
*next; /**< Next module in the linked list */
|
||||
} MODULES;
|
||||
|
||||
@ -72,6 +72,12 @@ typedef struct {
|
||||
void (*replicationHeartbeat)(void *, int);
|
||||
} MONITOR_OBJECT;
|
||||
|
||||
/**
|
||||
* The monitor API version number. Any change to the monitor module API
|
||||
* must change these versions usign the rules defined in modinfo.h
|
||||
*/
|
||||
#define MONITOR_VERSION {1, 0, 0}
|
||||
|
||||
/**
|
||||
* Representation of the running monitor.
|
||||
*/
|
||||
|
||||
@ -78,6 +78,13 @@ typedef struct router_object {
|
||||
uint8_t (*getCapabilities)(ROUTER *instance, void* router_session);
|
||||
} ROUTER_OBJECT;
|
||||
|
||||
/**
|
||||
* The router module API version. Any change that changes the router API
|
||||
* must update these versions numbers in accordance with the rules in
|
||||
* modinfo.h.
|
||||
*/
|
||||
#define ROUTER_VERSION { 1, 0, 0 }
|
||||
|
||||
typedef enum router_capability_t {
|
||||
RCAP_TYPE_UNDEFINED = 0,
|
||||
RCAP_TYPE_STMT_INPUT = (1 << 0),
|
||||
|
||||
Reference in New Issue
Block a user