MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Storage Engine API

Classes

struct  item_observer_cb_data
struct  server_handle_v1_t
struct  feature_info
struct  engine_info
struct  engine_interface_v1

Macros

#define ENGINE_INTERFACE_VERSION   1

Typedefs

typedef void(* ADD_STAT )(const char *key, const uint16_t klen, const char *val, const uint32_t vlen, const void *cookie)
typedef bool(* ADD_RESPONSE )(const void *key, uint16_t keylen, const void *ext, uint8_t extlen, const void *body, uint32_t bodylen, uint8_t datatype, uint16_t status, uint64_t cas, const void *cookie)
typedef tap_event_t(* TAP_ITERATOR )(ENGINE_HANDLE *handle, const void *cookie, item **item, void **engine_specific, uint16_t *nengine_specific, uint8_t *ttl, uint16_t *flags, uint32_t *seqno, uint16_t *vbucket)
typedef ENGINE_ERROR_CODE(* CREATE_INSTANCE )(uint64_t interface, GET_SERVER_API get_server_api, ENGINE_HANDLE **handle)
typedef struct engine_interface_v1 ENGINE_HANDLE_V1

Enumerations

enum  tap_event_t {
  TAP_MUTATION = 1, TAP_DELETION, TAP_FLUSH, TAP_OPAQUE,
  TAP_VBUCKET_SET, TAP_ACK, TAP_DISCONNECT, TAP_NOOP,
  TAP_PAUSE, TAP_CHECKPOINT_START, TAP_CHECKPOINT_END
}
enum  engine_feature_t {
  ENGINE_FEATURE_CAS, ENGINE_FEATURE_PERSISTENT_STORAGE, ENGINE_FEATURE_SECONDARY_ENGINE, ENGINE_FEATURE_ACCESS_CONTROL,
  ENGINE_FEATURE_MULTI_TENANCY, ENGINE_FEATURE_LRU
}

Detailed Description

Most interesting here is to implement engine_interface_v1 for your engine.

Typedef Documentation

typedef bool(* ADD_RESPONSE)(const void *key, uint16_t keylen, const void *ext, uint8_t extlen, const void *body, uint32_t bodylen, uint8_t datatype, uint16_t status, uint64_t cas, const void *cookie)

Callback for adding a response backet

Parameters
keyThe key to put in the response
keylenThe length of the key
extThe data to put in the extended field in the response
extlenThe number of bytes in the ext field
bodyThe data body
bodylenThe number of bytes in the body
datatypeThis is currently not used and should be set to 0
statusThe status code of the return packet (see in protocol_binary for the legal values)
casThe cas to put in the return packet
cookieThe cookie provided by the frontend
Returns
true if return message was successfully created, false if an error occured that prevented the message from being sent

Definition at line 80 of file engine.h.

typedef void(* ADD_STAT)(const char *key, const uint16_t klen, const char *val, const uint32_t vlen, const void *cookie)

Callback for any function producing stats.

Parameters
keythe stat's key
klenlength of the key
valthe stat's value in an ascii form (e.g. text form of a number)
vlenlength of the value
cookiemagic callback cookie

Definition at line 60 of file engine.h.

typedef ENGINE_ERROR_CODE(* CREATE_INSTANCE)(uint64_t interface, GET_SERVER_API get_server_api, ENGINE_HANDLE **handle)

The signature for the "create_instance" function exported from the module.

This function should fill out an engine inteface structure according to the interface parameter (Note: it is possible to return a lower version number).

Parameters
interfaceThe highest interface level the server supports
get_server_apifunction to get the server API from
Whereto store the interface handle
Returns
See description of ENGINE_ERROR_CODE

Definition at line 166 of file engine.h.

Definition of the first version of the engine interface

typedef tap_event_t(* TAP_ITERATOR)(ENGINE_HANDLE *handle, const void *cookie, item **item, void **engine_specific, uint16_t *nengine_specific, uint8_t *ttl, uint16_t *flags, uint32_t *seqno, uint16_t *vbucket)

An iterator for the tap stream. The memcached core will keep on calling this function as long as a tap client is connected to the server. Each event returned by the iterator will be encoded in the binary protocol with the appropriate command opcode.

If the engine needs to store extra information in the tap stream it should do so by returning the data through the engine_specific pointer. This data should be valid for the core to use (read only) until the next invocation of the iterator, of if the connection is closed.

Parameters
handlethe engine handle
cookieidentification for the tap stream
itemitem to send returned here (check tap_event_t)
engine_specificengine specific data returned here
nengine_specificnumber of bytes of engine specific data
ttlttl for this item (Tap stream hops)
flagstap flags for this object
seqnosequence number to send
vbucketthe virtual bucket id
Returns
the tap event to send (or TAP_PAUSE if there isn't any events)

Definition at line 144 of file engine.h.

Enumeration Type Documentation

Enumerator:
ENGINE_FEATURE_CAS 

has compare-and-set operation

ENGINE_FEATURE_PERSISTENT_STORAGE 

has persistent storage support

ENGINE_FEATURE_SECONDARY_ENGINE 

performs as pseudo engine

ENGINE_FEATURE_ACCESS_CONTROL 

has access control feature

Definition at line 170 of file engine.h.