Addition of routing module diagnostics and options
readconnroute now support the options slave and master to restrict the set of servers it will connect to
This commit is contained in:
32
include/gw.h
32
include/gw.h
@ -49,19 +49,19 @@
|
||||
#include "mysql_protocol.h"
|
||||
#include "dcb.h"
|
||||
|
||||
void gw_daemonize(void);
|
||||
int do_read_dcb(DCB *dcb);
|
||||
int handle_event_errors(DCB *dcb);
|
||||
int handle_event_errors_backend(DCB *dcb);
|
||||
void MySQLListener(int epfd, char *config_bind);
|
||||
int MySQLAccept(DCB *listener);
|
||||
int gw_mysql_do_authentication(DCB *dcb, GWBUF *);
|
||||
void gw_mysql_close(MySQLProtocol **ptr);
|
||||
char *gw_strend(register const char *s);
|
||||
int do_read_dcb(DCB *dcb);
|
||||
int do_read_10(DCB *dcb, uint8_t *buffer);
|
||||
MySQLProtocol * gw_mysql_init(MySQLProtocol *ptr);
|
||||
int MySQLWrite(DCB *dcb, GWBUF *queue);
|
||||
int gw_write_backend_event(DCB *dcb);
|
||||
int gw_read_backend_event(DCB *dcb);
|
||||
int setnonblocking(int fd);
|
||||
extern void gw_daemonize(void);
|
||||
extern int do_read_dcb(DCB *dcb);
|
||||
extern int handle_event_errors(DCB *dcb);
|
||||
extern int handle_event_errors_backend(DCB *dcb);
|
||||
extern void MySQLListener(int epfd, char *config_bind);
|
||||
extern int MySQLAccept(DCB *listener);
|
||||
extern int gw_mysql_do_authentication(DCB *dcb, GWBUF *);
|
||||
extern void gw_mysql_close(MySQLProtocol **ptr);
|
||||
extern char *gw_strend(register const char *s);
|
||||
extern int do_read_dcb(DCB *dcb);
|
||||
extern int do_read_10(DCB *dcb, uint8_t *buffer);
|
||||
extern MySQLProtocol * gw_mysql_init(MySQLProtocol *ptr);
|
||||
extern int MySQLWrite(DCB *dcb, GWBUF *queue);
|
||||
extern int gw_write_backend_event(DCB *dcb);
|
||||
extern int gw_read_backend_event(DCB *dcb);
|
||||
extern int setnonblocking(int fd);
|
||||
|
||||
@ -25,14 +25,16 @@
|
||||
*
|
||||
* Date Who Description
|
||||
* 14/06/13 Mark Riddoch Initial implementation
|
||||
* 26/06/13 Mark Riddoch Addition of router options
|
||||
* and the diagnostic entry point
|
||||
*
|
||||
*/
|
||||
#include <service.h>
|
||||
#include <session.h>
|
||||
#include <buffer.h>
|
||||
|
||||
/*
|
||||
* the ROUTER handle points to module specific data, so the best we can do
|
||||
/**
|
||||
* The ROUTER handle points to module specific data, so the best we can do
|
||||
* is to make it a void * externally.
|
||||
*/
|
||||
typedef void *ROUTER;
|
||||
@ -50,14 +52,17 @@ typedef void *ROUTER;
|
||||
* closeSession Called when a session is closed
|
||||
* routeQuery Called on each query that requires
|
||||
* routing
|
||||
* diagnostics Called to force the router to print
|
||||
* diagnostic output
|
||||
* @endverbatim
|
||||
*
|
||||
* @see load_module
|
||||
*/
|
||||
typedef struct router_object {
|
||||
ROUTER *(*createInstance)(SERVICE *service);
|
||||
ROUTER *(*createInstance)(SERVICE *service, char **options);
|
||||
void *(*newSession)(ROUTER *instance, SESSION *session);
|
||||
void (*closeSession)(ROUTER *instance, void *router_session);
|
||||
int (*routeQuery)(ROUTER *instance, void *router_session, GWBUF *queue);
|
||||
void (*diagnostics)(ROUTER *instance, DCB *dcb);
|
||||
} ROUTER_OBJECT;
|
||||
#endif
|
||||
|
||||
@ -91,6 +91,7 @@ typedef struct service {
|
||||
* that this service will listen on.
|
||||
*/
|
||||
char *routerModule; /**< Name of router module to use */
|
||||
char **routerOptions;/**< Router specific option strings */
|
||||
struct router_object
|
||||
*router; /**< The router we are using */
|
||||
void *router_instance;
|
||||
@ -110,6 +111,7 @@ extern SERVICE *service_alloc(char *, char *);
|
||||
extern int service_free(SERVICE *);
|
||||
extern int serviceAddProtocol(SERVICE *, char *, unsigned short);
|
||||
extern void serviceAddBackend(SERVICE *, SERVER *);
|
||||
extern void serviceAddRouterOption(SERVICE *, char *);
|
||||
extern int serviceStart(SERVICE *);
|
||||
extern int serviceStartAll();
|
||||
extern int serviceStop(SERVICE *);
|
||||
|
||||
Reference in New Issue
Block a user