Add getCapabilities to filters
Common capabilities are now defined in routing.h. The common capabilities can be defined using bits 0 - 15. Router capabilities are defined using bits 16-31 and filter capabilities (should there ever be such) using bits 32-47. So, to find out the capabilities of a service you only need to OR the capabilities of the router and all filters together. For instance, if a single filter needs statement based routing, then that is what is done.
This commit is contained in:
@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/routing.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/session.h>
|
||||
#include <maxscale/buffer.h>
|
||||
@ -83,6 +84,7 @@ typedef struct filter_object
|
||||
int (*routeQuery)(FILTER *instance, void *fsession, GWBUF *queue);
|
||||
int (*clientReply)(FILTER *instance, void *fsession, GWBUF *queue);
|
||||
void (*diagnostics)(FILTER *instance, void *fsession, DCB *dcb);
|
||||
uint64_t (*getCapabilities)();
|
||||
} FILTER_OBJECT;
|
||||
|
||||
/**
|
||||
@ -90,7 +92,7 @@ typedef struct filter_object
|
||||
* is changed these values must be updated in line with the rules in the
|
||||
* file modinfo.h.
|
||||
*/
|
||||
#define FILTER_VERSION {2, 1, 0}
|
||||
#define FILTER_VERSION {2, 2, 0}
|
||||
/**
|
||||
* The definition of a filter from the configuration file.
|
||||
* This is basically the link between a plugin to load and the
|
||||
@ -121,6 +123,22 @@ void dprintAllFilters(DCB *);
|
||||
void dprintFilter(DCB *, FILTER_DEF *);
|
||||
void dListFilters(DCB *);
|
||||
|
||||
/**
|
||||
* Specifies capabilities specific for filters. Common capabilities
|
||||
* are defined by @c routing_capability_t.
|
||||
*
|
||||
* @see routing_capability_t
|
||||
*
|
||||
* @note The values of the capabilities here *must* be between 0x000100000000
|
||||
* and 0x800000000000, that is, bits 32 to 47.
|
||||
*/
|
||||
|
||||
/*
|
||||
typedef enum filter_capability
|
||||
{
|
||||
} filter_capability_t;
|
||||
*/
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/routing.h>
|
||||
#include <maxscale/service.h>
|
||||
#include <maxscale/session.h>
|
||||
#include <maxscale/buffer.h>
|
||||
@ -93,14 +94,19 @@ typedef struct router_object
|
||||
#define ROUTER_VERSION { 2, 0, 0 }
|
||||
|
||||
/**
|
||||
* Router capability type. Indicates what kind of input router accepts.
|
||||
* Specifies capabilities specific for routers. Common capabilities
|
||||
* are defined by @c routing_capability_t.
|
||||
*
|
||||
* @see routing_capability_t
|
||||
*
|
||||
* @note The values of the capabilities here *must* be between 0x00010000
|
||||
* and 0x80000000, that is, bits 16 to 31.
|
||||
*/
|
||||
typedef enum router_capability_t
|
||||
typedef enum router_capability
|
||||
{
|
||||
RCAP_TYPE_UNDEFINED = 0x00,
|
||||
RCAP_TYPE_STMT_INPUT = 0x01, /**< Statement per buffer */
|
||||
RCAP_TYPE_PACKET_INPUT = 0x02, /**< Data as it was read from DCB */
|
||||
RCAP_TYPE_NO_RSESSION = 0x04 /**< Router does not use router sessions */
|
||||
RCAP_TYPE_NO_RSESSION = 0x00010000, /**< Router does not use router sessions */
|
||||
RCAP_TYPE_NO_USERS_INIT = 0x00020000, /**< Prevent the loading of authenticator
|
||||
users when the service is started */
|
||||
} router_capability_t;
|
||||
|
||||
MXS_END_DECLS
|
||||
|
38
include/maxscale/routing.h
Normal file
38
include/maxscale/routing.h
Normal file
@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
||||
*
|
||||
* Change Date: 2019-07-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file routing.h - Common definitions and declarations for routers and filters.
|
||||
*/
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* Routing capability type. Indicates what kind of input a router or
|
||||
* a filter accepts.
|
||||
*
|
||||
* @note The values of the capabilities here *must* be between 0x0000
|
||||
* and 0x8000, that is, bits 0 to 15.
|
||||
*/
|
||||
typedef enum routing_capability
|
||||
{
|
||||
RCAP_TYPE_STMT_INPUT = 0x0001, /**< Statement per buffer. */
|
||||
} routing_capability_t;
|
||||
|
||||
#define RCAP_TYPE_NONE 0
|
||||
|
||||
MXS_END_DECLS
|
||||
|
Reference in New Issue
Block a user