MySQL  8.0.18
Source Code Documentation
mock_server.c File Reference
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <pthread.h>
#include <memcached/engine.h>
#include <memcached/extension.h>
#include <memcached/extension_loggers.h>
#include <mock_server.h>

Classes

struct  mock_extensions
 

Macros

#define REALTIME_MAXDELTA   60*60*24*3
 
#define CONN_MAGIC   16369814453946373207ULL
 

Functions

static void mock_get_auth_data (const void *cookie, auth_data_t *data)
 SERVER CORE API FUNCTIONS. More...
 
static void mock_store_engine_specific (const void *cookie, void *engine_data)
 
static void * mock_get_engine_specific (const void *cookie)
 
static int mock_get_socket_fd (const void *cookie)
 
static void mock_set_tap_nack_mode (const void *cookie, bool enable)
 
static void mock_cookie_reserve (const void *cookie)
 
static void mock_cookie_release (const void *cookie)
 
static const char * mock_get_server_version ()
 
static uint32_t mock_hash (const void *key, size_t length, const uint32_t initval)
 
static rel_time_t mock_get_current_time (void)
 
static rel_time_t mock_realtime (const time_t exptime)
 
static void mock_notify_io_complete (const void *cookie, ENGINE_ERROR_CODE status)
 
static time_t mock_abstime (const rel_time_t exptime)
 
void mock_time_travel (int by)
 
static int mock_parse_config (const char *str, struct config_item items[], FILE *error)
 
static void * mock_new_independent_stats (void)
 SERVER STAT API FUNCTIONS. More...
 
static void mock_release_independent_stats (void *stats)
 
static void mock_count_eviction (const void *cookie, const void *key, const int nkey)
 
static bool mock_register_extension (extension_type_t type, void *extension)
 SERVER STAT API FUNCTIONS. More...
 
static void mock_unregister_extension (extension_type_t type, void *extension)
 
static void * mock_get_extension (extension_type_t type)
 
static void mock_register_callback (ENGINE_HANDLE *eh, ENGINE_EVENT_TYPE type, EVENT_CALLBACK cb, const void *cb_data)
 SERVER CALLBACK API FUNCTIONS. More...
 
static void mock_perform_callbacks (ENGINE_EVENT_TYPE type, const void *data, const void *c)
 
SERVER_HANDLE_V1 * get_mock_server_api (void)
 
void init_mock_server (ENGINE_HANDLE *server_engine)
 
struct mock_connstructmk_mock_connection (const char *user, const char *config)
 
const void * create_mock_cookie (void)
 
void destroy_mock_cookie (const void *cookie)
 
void mock_set_ewouldblock_handling (const void *cookie, bool enable)
 
void lock_mock_cookie (const void *cookie)
 
void unlock_mock_cookie (const void *cookie)
 
void waitfor_mock_cookie (const void *cookie)
 
void disconnect_mock_connection (struct mock_connstruct *c)
 
void disconnect_all_mock_connections (struct mock_connstruct *c)
 
void destroy_mock_event_callbacks_rec (struct mock_callbacks *h)
 
void destroy_mock_event_callbacks (void)
 

Variables

struct mock_callbacksmock_event_handlers [MAX_ENGINE_EVENT_TYPE+1]
 
time_t process_started
 
rel_time_t time_travel_offset
 
rel_time_t current_time
 
struct mock_connstructconnstructs
 
struct mock_extensions extensions
 
EXTENSION_LOGGER_DESCRIPTOR * null_logger = NULL
 
EXTENSION_LOGGER_DESCRIPTOR * stderr_logger = NULL
 
ENGINE_HANDLE * engine = NULL
 

Macro Definition Documentation

◆ CONN_MAGIC

#define CONN_MAGIC   16369814453946373207ULL

◆ REALTIME_MAXDELTA

#define REALTIME_MAXDELTA   60*60*24*3

Function Documentation

◆ create_mock_cookie()

const void* create_mock_cookie ( void  )

◆ destroy_mock_cookie()

void destroy_mock_cookie ( const void *  cookie)

◆ destroy_mock_event_callbacks()

void destroy_mock_event_callbacks ( void  )

◆ destroy_mock_event_callbacks_rec()

void destroy_mock_event_callbacks_rec ( struct mock_callbacks h)

◆ disconnect_all_mock_connections()

void disconnect_all_mock_connections ( struct mock_connstruct c)

◆ disconnect_mock_connection()

void disconnect_mock_connection ( struct mock_connstruct c)

◆ get_mock_server_api()

SERVER_HANDLE_V1* get_mock_server_api ( void  )

◆ init_mock_server()

void init_mock_server ( ENGINE_HANDLE *  server_engine)

◆ lock_mock_cookie()

void lock_mock_cookie ( const void *  cookie)

◆ mk_mock_connection()

struct mock_connstruct* mk_mock_connection ( const char *  user,
const char *  config 
)

◆ mock_abstime()

static time_t mock_abstime ( const rel_time_t  exptime)
static

◆ mock_cookie_release()

static void mock_cookie_release ( const void *  cookie)
static

◆ mock_cookie_reserve()

static void mock_cookie_reserve ( const void *  cookie)
static

◆ mock_count_eviction()

static void mock_count_eviction ( const void *  cookie,
const void *  key,
const int  nkey 
)
static

◆ mock_get_auth_data()

static void mock_get_auth_data ( const void *  cookie,
auth_data_t *  data 
)
static

SERVER CORE API FUNCTIONS.

◆ mock_get_current_time()

static rel_time_t mock_get_current_time ( void  )
static

◆ mock_get_engine_specific()

static void* mock_get_engine_specific ( const void *  cookie)
static

◆ mock_get_extension()

static void* mock_get_extension ( extension_type_t  type)
static

◆ mock_get_server_version()

static const char* mock_get_server_version ( )
static

◆ mock_get_socket_fd()

static int mock_get_socket_fd ( const void *  cookie)
static

◆ mock_hash()

static uint32_t mock_hash ( const void *  key,
size_t  length,
const uint32_t  initval 
)
static

◆ mock_new_independent_stats()

static void* mock_new_independent_stats ( void  )
static

SERVER STAT API FUNCTIONS.

◆ mock_notify_io_complete()

static void mock_notify_io_complete ( const void *  cookie,
ENGINE_ERROR_CODE  status 
)
static

◆ mock_parse_config()

static int mock_parse_config ( const char *  str,
struct config_item  items[],
FILE *  error 
)
static

◆ mock_perform_callbacks()

static void mock_perform_callbacks ( ENGINE_EVENT_TYPE  type,
const void *  data,
const void *  c 
)
static

◆ mock_realtime()

static rel_time_t mock_realtime ( const time_t  exptime)
static

◆ mock_register_callback()

static void mock_register_callback ( ENGINE_HANDLE *  eh,
ENGINE_EVENT_TYPE  type,
EVENT_CALLBACK  cb,
const void *  cb_data 
)
static

SERVER CALLBACK API FUNCTIONS.

◆ mock_register_extension()

static bool mock_register_extension ( extension_type_t  type,
void *  extension 
)
static

SERVER STAT API FUNCTIONS.

◆ mock_release_independent_stats()

static void mock_release_independent_stats ( void *  stats)
static

◆ mock_set_ewouldblock_handling()

void mock_set_ewouldblock_handling ( const void *  cookie,
bool  enable 
)

◆ mock_set_tap_nack_mode()

static void mock_set_tap_nack_mode ( const void *  cookie,
bool  enable 
)
static

◆ mock_store_engine_specific()

static void mock_store_engine_specific ( const void *  cookie,
void *  engine_data 
)
static

◆ mock_time_travel()

void mock_time_travel ( int  by)

◆ mock_unregister_extension()

static void mock_unregister_extension ( extension_type_t  type,
void *  extension 
)
static

◆ unlock_mock_cookie()

void unlock_mock_cookie ( const void *  cookie)

◆ waitfor_mock_cookie()

void waitfor_mock_cookie ( const void *  cookie)

Variable Documentation

◆ connstructs

struct mock_connstruct* connstructs

◆ current_time

rel_time_t current_time

◆ engine

ENGINE_HANDLE* engine = NULL

◆ extensions

struct mock_extensions extensions

◆ mock_event_handlers

struct mock_callbacks* mock_event_handlers[MAX_ENGINE_EVENT_TYPE+1]

◆ null_logger

EXTENSION_LOGGER_DESCRIPTOR* null_logger = NULL

◆ process_started

time_t process_started

◆ stderr_logger

EXTENSION_LOGGER_DESCRIPTOR* stderr_logger = NULL

◆ time_travel_offset

rel_time_t time_travel_offset