MySQL  8.0.19
Source Code Documentation
mock_server.h
Go to the documentation of this file.
1 #ifndef MEMCACHED_MOCK_SERVER_H
2 #define MEMCACHED_MOCK_SERVER_H
3 
4 #include <memcached/engine.h>
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
11  uint64_t magic;
12  const char *uname;
13  const char *config;
14  void *engine_data;
15  bool connected;
17  int sfd;
18  ENGINE_ERROR_CODE status;
19  uint64_t evictions;
20  int nblocks; /* number of ewouldblocks */
22  pthread_mutex_t mutex;
23  pthread_cond_t cond;
24 };
25 
27  EVENT_CALLBACK cb;
28  const void *cb_data;
30 };
31 
32 struct mock_stats {
33  uint64_t astat;
34 };
35 
36 MEMCACHED_PUBLIC_API SERVER_HANDLE_V1 *get_mock_server_api(void);
37 
38 MEMCACHED_PUBLIC_API void init_mock_server(ENGINE_HANDLE *server_engine);
39 
40 MEMCACHED_PUBLIC_API
41 struct mock_connstruct *mk_mock_connection(const char *user,
42  const char *config);
43 
44 MEMCACHED_PUBLIC_API const void *create_mock_cookie(void);
45 
46 MEMCACHED_PUBLIC_API void destroy_mock_cookie(const void *cookie);
47 
48 MEMCACHED_PUBLIC_API void mock_set_ewouldblock_handling(const void *cookie, bool enable);
49 
50 MEMCACHED_PUBLIC_API void lock_mock_cookie(const void *cookie);
51 
52 MEMCACHED_PUBLIC_API void unlock_mock_cookie(const void *cookie);
53 
54 MEMCACHED_PUBLIC_API void waitfor_mock_cookie(const void *cookie);
55 
56 MEMCACHED_PUBLIC_API void mock_time_travel(int by);
57 
58 MEMCACHED_PUBLIC_API void disconnect_mock_connection(struct mock_connstruct *c);
59 
60 MEMCACHED_PUBLIC_API void disconnect_all_mock_connections(struct mock_connstruct *c);
61 
62 MEMCACHED_PUBLIC_API void destroy_mock_event_callbacks_rec(struct mock_callbacks *h);
63 
64 MEMCACHED_PUBLIC_API void destroy_mock_event_callbacks(void);
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #endif /* MEMCACHED_MOCK_SERVER_H */
get_mock_server_api
MEMCACHED_PUBLIC_API SERVER_HANDLE_V1 * get_mock_server_api(void)
Definition: mock_server.c:260
unlock_mock_cookie
MEMCACHED_PUBLIC_API void unlock_mock_cookie(const void *cookie)
Definition: mock_server.c:371
mock_connstruct::next
struct mock_connstruct * next
Definition: mock_server.h:16
config
Definition: default_engine.h:52
mock_connstruct::handle_ewouldblock
bool handle_ewouldblock
Definition: mock_server.h:21
mock_time_travel
MEMCACHED_PUBLIC_API void mock_time_travel(int by)
Definition: mock_server.c:125
mock_connstruct::sfd
int sfd
Definition: mock_server.h:17
mock_stats::astat
uint64_t astat
Definition: mock_server.h:33
mock_connstruct::cond
pthread_cond_t cond
Definition: mock_server.h:23
mock_connstruct::engine_data
void * engine_data
Definition: mock_server.h:14
create_mock_cookie
const MEMCACHED_PUBLIC_API void * create_mock_cookie(void)
Definition: mock_server.c:344
destroy_mock_cookie
MEMCACHED_PUBLIC_API void destroy_mock_cookie(const void *cookie)
Definition: mock_server.c:357
mock_connstruct::status
ENGINE_ERROR_CODE status
Definition: mock_server.h:18
mock_connstruct::connected
bool connected
Definition: mock_server.h:15
mock_connstruct::uname
const char * uname
Definition: mock_server.h:12
mock_connstruct::nblocks
int nblocks
Definition: mock_server.h:20
disconnect_mock_connection
MEMCACHED_PUBLIC_API void disconnect_mock_connection(struct mock_connstruct *c)
Definition: mock_server.c:381
mock_connstruct::magic
uint64_t magic
Definition: mock_server.h:11
user
char * user
Definition: mysqladmin.cc:59
init_mock_server
MEMCACHED_PUBLIC_API void init_mock_server(ENGINE_HANDLE *server_engine)
Definition: mock_server.c:311
mk_mock_connection
MEMCACHED_PUBLIC_API struct mock_connstruct * mk_mock_connection(const char *user, const char *config)
Definition: mock_server.c:319
mock_callbacks
Definition: mock_server.h:26
mock_connstruct
Definition: mock_server.h:10
mock_callbacks::cb
EVENT_CALLBACK cb
Definition: mock_server.h:27
disconnect_all_mock_connections
MEMCACHED_PUBLIC_API void disconnect_all_mock_connections(struct mock_connstruct *c)
Definition: mock_server.c:386
mock_connstruct::config
const char * config
Definition: mock_server.h:13
mock_callbacks::next
struct mock_callbacks * next
Definition: mock_server.h:29
mock_set_ewouldblock_handling
MEMCACHED_PUBLIC_API void mock_set_ewouldblock_handling(const void *cookie, bool enable)
Definition: mock_server.c:361
destroy_mock_event_callbacks
MEMCACHED_PUBLIC_API void destroy_mock_event_callbacks(void)
Definition: mock_server.c:403
mock_connstruct::evictions
uint64_t evictions
Definition: mock_server.h:19
waitfor_mock_cookie
MEMCACHED_PUBLIC_API void waitfor_mock_cookie(const void *cookie)
Definition: mock_server.c:376
lock_mock_cookie
MEMCACHED_PUBLIC_API void lock_mock_cookie(const void *cookie)
Definition: mock_server.c:366
mock_connstruct::mutex
pthread_mutex_t mutex
Definition: mock_server.h:22
mock_stats
Definition: mock_server.h:32
destroy_mock_event_callbacks_rec
MEMCACHED_PUBLIC_API void destroy_mock_event_callbacks_rec(struct mock_callbacks *h)
Definition: mock_server.c:396
mock_callbacks::cb_data
const void * cb_data
Definition: mock_server.h:28