Added command type to:

gwbuf struct
dcb struct

This int field will hold the last command executed or sent to backend.

It will be 0 for most cases, setting it with a different value could help route differently the data from backend to client or some custom error messages.
This commit is contained in:
Massimiliano Pinto
2013-07-16 19:32:00 +02:00
parent bfc45c570e
commit 17e33d2ef9
4 changed files with 16 additions and 6 deletions

View File

@ -30,6 +30,7 @@
* Date Who Description * Date Who Description
* 10/06/13 Mark Riddoch Initial implementation * 10/06/13 Mark Riddoch Initial implementation
* 11/07/13 Mark Riddoch Add reference count mechanism * 11/07/13 Mark Riddoch Add reference count mechanism
* 16/07/2013 Massimiliano Pinto Added command type to gwbuf struct
* *
* @endverbatim * @endverbatim
*/ */
@ -80,6 +81,7 @@ SHARED_BUF *sbuf;
sbuf->refcount = 1; sbuf->refcount = 1;
rval->sbuf = sbuf; rval->sbuf = sbuf;
rval->next = NULL; rval->next = NULL;
rval->command = 0;
return rval; return rval;
} }
@ -126,6 +128,8 @@ GWBUF *rval;
rval->start = buf->start; rval->start = buf->start;
rval->end = buf->end; rval->end = buf->end;
rval->next = NULL; rval->next = NULL;
rval->command = buf->command;
return rval; return rval;
} }
/** /**

View File

@ -38,6 +38,7 @@
* 02/07/2013 Massimiliano Pinto Addition of delayqlock, delayq and authlock * 02/07/2013 Massimiliano Pinto Addition of delayqlock, delayq and authlock
* for handling backend asynchronous protocol connection * for handling backend asynchronous protocol connection
* and a generic lock for backend authentication * and a generic lock for backend authentication
* 16/07/2013 Massimiliano Pinto Added command type for dcb
* *
* @endverbatim * @endverbatim
*/ */
@ -94,6 +95,7 @@ DCB *rval;
memset(&rval->stats, 0, sizeof(DCBSTATS)); // Zero the statistics memset(&rval->stats, 0, sizeof(DCBSTATS)); // Zero the statistics
bitmask_init(&rval->memdata.bitmask); bitmask_init(&rval->memdata.bitmask);
rval->memdata.next = NULL; rval->memdata.next = NULL;
rval->command = 0;
spinlock_acquire(&dcbspin); spinlock_acquire(&dcbspin);
if (allDCBs == NULL) if (allDCBs == NULL)

View File

@ -35,8 +35,9 @@
* Revision History * Revision History
* *
* Date Who Description * Date Who Description
* 10/06/13 Mark Riddoch Initial implementation * 10/06/2013 Mark Riddoch Initial implementation
* 11/07/13 Mark Riddoch Addition of reference count in the gwbuf * 11/07/2013 Mark Riddoch Addition of reference count in the gwbuf
* 16/07/2013 Massimiliano Pinto Added command type for the queue
* *
* @endverbatim * @endverbatim
*/ */
@ -64,6 +65,7 @@ typedef struct gwbuf {
void *start; /**< Start of the valid data */ void *start; /**< Start of the valid data */
void *end; /**< First byte after 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; } GWBUF;
/* /*

View File

@ -44,6 +44,7 @@ struct service;
* and a generic lock for backend authentication * and a generic lock for backend authentication
* 12/07/2013 Massimiliano Pinto Added auth entry point * 12/07/2013 Massimiliano Pinto Added auth entry point
* 15/07/2013 Massimiliano Pinto Added session entry point * 15/07/2013 Massimiliano Pinto Added session entry point
* 16/07/2013 Massimiliano Pinto Added command type for dcb
* *
* @endverbatim * @endverbatim
*/ */
@ -151,6 +152,7 @@ typedef struct dcb {
struct service *service; /**< The related service */ struct service *service; /**< The related service */
void *data; /**< Specific client data */ void *data; /**< Specific client data */
DCBMM memdata; /**< The data related to DCB memory management */ DCBMM memdata; /**< The data related to DCB memory management */
int command; /**< Specific client command type */
} DCB; } DCB;
/* DCB states */ /* DCB states */