Router has now capability value which currently tells whether router session expects stream or individual, complete statements. With read con
nection router stream is used and with read/write split router individual statements are passed to router. Added new function to ROUTER_OBJECT : uint8_t (*getCapabilities)(ROUTER *instance, void* router_session); which is implemented in every route r. Added support for multi-statement packets in rwsplit router. In other words, if network packet includes multiple mysql statements, they are separated and passed to router one by one. Multi-packet statements (those which exceeds network packet boundaries) are _not_ supported yet.
This commit is contained in:
@ -41,9 +41,18 @@
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
#include <skygw_debug.h>
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GWBUF_TYPE_UNDEFINED = 0x0,
|
||||
GWBUF_TYPE_PLAINSQL = 0x1,
|
||||
GWBUF_TYPE_MYSQL = 0x2
|
||||
} gwbuf_type_t;
|
||||
|
||||
/**
|
||||
* A structure to encapsualte the data in a form that the data itself can be
|
||||
* A structure to encapsulate the data in a form that the data itself can be
|
||||
* shared between multiple GWBUF's without the need to make multiple copies
|
||||
* but still maintain separate data pointers.
|
||||
*/
|
||||
@ -64,8 +73,9 @@ typedef struct gwbuf {
|
||||
struct gwbuf *next; /*< Next buffer in a linked chain of buffers */
|
||||
void *start; /*< Start of the valid data */
|
||||
void *end; /*< First byte after the valid data */
|
||||
SHARED_BUF *sbuf; /*< The shared buffer with the real data */
|
||||
SHARED_BUF *sbuf; /*< The shared buffer with the real data */
|
||||
int command;/*< The command type for the queue */
|
||||
gwbuf_type_t gwbuf_type; /*< buffer's data type information */
|
||||
} GWBUF;
|
||||
|
||||
/*<
|
||||
@ -83,6 +93,7 @@ typedef struct gwbuf {
|
||||
/*< Consume a number of bytes in the buffer */
|
||||
#define GWBUF_CONSUME(b, bytes) (b)->start += bytes
|
||||
|
||||
#define GWBUF_TYPE(b) (b)->gwbuf_type
|
||||
/*<
|
||||
* Function prototypes for the API to maniplate the buffers
|
||||
*/
|
||||
@ -93,5 +104,6 @@ extern GWBUF *gwbuf_append(GWBUF *head, GWBUF *tail);
|
||||
extern GWBUF *gwbuf_consume(GWBUF *head, unsigned int length);
|
||||
extern unsigned int gwbuf_length(GWBUF *head);
|
||||
extern GWBUF *gwbuf_clone_portion(GWBUF *head, size_t offset, size_t len);
|
||||
|
||||
extern GWBUF *gwbuf_clone_transform(GWBUF *head, gwbuf_type_t type);
|
||||
extern bool gwbuf_set_type(GWBUF *head, gwbuf_type_t type);
|
||||
#endif
|
||||
|
||||
@ -87,7 +87,6 @@ typedef struct gw_protocol {
|
||||
int (*listen)(struct dcb *, char *);
|
||||
int (*auth)(struct dcb *, struct server *, struct session *, GWBUF *);
|
||||
int (*session)(struct dcb *, void *);
|
||||
void* (*getstmt)(void* buf);
|
||||
} GWPROTOCOL;
|
||||
|
||||
/**
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
#include <service.h>
|
||||
#include <session.h>
|
||||
#include <buffer.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* The ROUTER handle points to module specific data, so the best we can do
|
||||
@ -74,10 +75,13 @@ typedef struct router_object {
|
||||
void (*diagnostics)(ROUTER *instance, DCB *dcb);
|
||||
void (*clientReply)(ROUTER* instance, void* router_session, GWBUF* queue, DCB *backend_dcb);
|
||||
void (*errorReply)(ROUTER* instance, void* router_session, char* message, DCB *backend_dcb, int action);
|
||||
uint8_t (*getCapabilities)(ROUTER *instance, void* router_session);
|
||||
} ROUTER_OBJECT;
|
||||
|
||||
/* Router commands */
|
||||
#define ROUTER_DEFAULT 0 /**< Standard routing */
|
||||
#define ROUTER_CHANGE_SESSION 1 /**< Route a change session */
|
||||
typedef enum router_capability_t {
|
||||
RCAP_TYPE_UNDEFINED = 0,
|
||||
RCAP_TYPE_STMT_INPUT = (1 << 0),
|
||||
RCAP_TYPE_PACKET_INPUT = (1 << 1)
|
||||
} router_capability_t;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user