MySQL 5.6.14 Source Code Document
|
#include <extension.h>
Public Attributes | |
const char *(* | get_name )(const void *cmd_cookie) |
bool(* | accept )(const void *cmd_cookie, void *cookie, int argc, token_t *argv, size_t *ndata, char **ptr) |
ENGINE_ERROR_CODE(* | execute )(const void *cmd_cookie, const void *cookie, int argc, token_t *argv, ENGINE_ERROR_CODE(*response_handler)(const void *cookie, int nbytes, const char *dta)) |
void(* | abort )(const void *cmd_cookie, const void *cookie) |
const void * | cookie |
struct extension_ascii_protocol_descriptor * | next |
ASCII protocol extensions must provide the following descriptor to extend the capabilities of the ascii protocol. The memcached core will probe each command in the order they are registered, so you should register the most likely command to be used first (or you could register only one descriptor and do a better dispatch routine inside your own implementation of accept / execute).
Definition at line 126 of file extension.h.
void(* extension_ascii_protocol_descriptor::abort)(const void *cmd_cookie, const void *cookie) |
abort the command.
cmd_cookie | cookie registered with the command |
cookie | identifying the client connection |
Definition at line 187 of file extension.h.
bool(* extension_ascii_protocol_descriptor::accept)(const void *cmd_cookie, void *cookie, int argc, token_t *argv, size_t *ndata, char **ptr) |
Called by the server to determine if the command in argc, argv should be process by this handler.
If the command accepts out-of-band data (like add / append / prepend / replace / set), the command must set the datapointer and ndata to the number of bytes it want to read (remember to account for the trailing "\r\n" ;-))
If you need extra data, you should copy all of the argc/argv info you may need to execute the command, because those parameters will be 0 and NULL when execute is invoked...
cmd_cookie | cookie registered with the command |
cookie | identifying the client connection |
argc | the number of arguments |
argv | the argument vector |
ndata | the number of bytes in out-of-band data (OUT) |
ptr | where the core shall write the data (OUT) |
noreply | is this a noreply command or not... |
Definition at line 157 of file extension.h.
const void* extension_ascii_protocol_descriptor::cookie |
cookie for the command. This is the cookie passed to accept and execute, so that you can register the same functions for multiple commands (but tell them apart during invokations).
Definition at line 194 of file extension.h.
ENGINE_ERROR_CODE(* extension_ascii_protocol_descriptor::execute)(const void *cmd_cookie, const void *cookie, int argc, token_t *argv, ENGINE_ERROR_CODE(*response_handler)(const void *cookie,int nbytes,const char *dta)) |
execute the command.
cmd_cookie | cookie registered with the command |
cookie | identifying the client connection |
argc | the number of arguments |
argv | the argument vector |
response_handler | callback to add data to the return buffer |
Definition at line 174 of file extension.h.
const char*(* extension_ascii_protocol_descriptor::get_name)(const void *cmd_cookie) |
Get the name of the descriptor. The memory area returned by this function has to be valid until the descriptor is unregistered.
cmd_cookie | cookie registered with the command |
Definition at line 133 of file extension.h.
struct extension_ascii_protocol_descriptor* extension_ascii_protocol_descriptor::next |
Deamon descriptors are stored in a linked list in the memcached core by using this pointer. Please do not modify this pointer by yourself until you have unregistered the descriptor. The only time it is safe for an extension to walk this list is during initialization of the modules.
Definition at line 203 of file extension.h.