author | Tero Marttila <terom@fixme.fi> |
Sat, 30 Aug 2008 19:13:15 +0300 | |
changeset 49 | 10c7dce1a043 |
parent 48 | 1c67f512779b |
permissions | -rw-r--r-- |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
#ifndef MEMCACHE_H |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
2 |
#define MEMCACHE_H |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
3 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
4 |
/* |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
5 |
* A libevent based memcached client that aims for high performance, concurrency and low latency. |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
6 |
*/ |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
7 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
8 |
#include "config.h" |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
9 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
10 |
/* |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
11 |
* Used to store the global information for a memcache context. A context contains both servers and active connections. |
45
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
12 |
* |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
13 |
* Each context has one callback function defined, which is used for all requests. |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
14 |
*/ |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
15 |
struct memcache; |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
16 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
17 |
/* |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
18 |
* A transaction. |
45
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
19 |
* |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
20 |
* Each request has one callback argument defined, which is used for that request's callbacks. |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
21 |
*/ |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
22 |
struct memcache_req; |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
23 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
24 |
/* |
45
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
25 |
* Object keys |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
26 |
*/ |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
27 |
struct memcache_key { |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
28 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
29 |
* Pointer to a char buffer containing the key itself. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
30 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
31 |
* A key is a text tring which should uniquely identify a cache entry. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
32 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
33 |
* The length limit for a key is usually 250 characters, but this is imposed by the server side (a longer key will |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
34 |
* presumeably cause a CLIENT_ERROR reply). |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
35 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
36 |
* The key should presumeably also not contain any spaces, carriage returns or newlines, as these are used to |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
37 |
* delimit tokens in the protocol itself. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
38 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
39 |
* The buffer does not need to be zero-terminated. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
40 |
*/ |
39
0e21a65074a6
memcache connect error handling and req queuein
Tero Marttila <terom@fixme.fi>
parents:
38
diff
changeset
|
41 |
char *buf; |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
42 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
43 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
44 |
* The length of the key buffer in bytes. This does not include a NUL byte. |
46
8a832c0e01ee
bugfixed, enum->string mappings, test does requests
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
45 |
* |
48
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
46 |
* If this is given as zero, then the length will be calculated from buf using strlen(). Empty keys are not |
46
8a832c0e01ee
bugfixed, enum->string mappings, test does requests
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
47 |
* allowed, so this will result in an error if buf is an empty string. |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
48 |
*/ |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
49 |
size_t len; |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
50 |
}; |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
51 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
52 |
/* |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
53 |
* Object attributes |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
54 |
*/ |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
55 |
struct memcache_obj { |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
56 |
/* |
48
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
57 |
* An arbitrary 16-bit (32-bit for >1.2.1) integer that the server stores transparently. |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
58 |
*/ |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
59 |
unsigned int flags; |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
60 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
61 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
62 |
* Expiration time. If non-zero, either an offset in seconds from current time (up to 60*60*24*30 seconds, or 30d), |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
63 |
* or an absolute 32-bit unix timestamp. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
64 |
*/ |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
65 |
time_t exptime; |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
66 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
67 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
68 |
* Number of bytes in the entry. This may be zero, in which case there will be no data. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
69 |
*/ |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
70 |
size_t bytes; |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
71 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
72 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
73 |
* Used for the CMD_STORE_CAS command. An unique 64-bit value that changes if the entry is modified. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
74 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
75 |
* Not needed for other commands, and may or may not be provided by CMD_FETCH_GET (will be set to zero). |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
76 |
*/ |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
77 |
unsigned long long cas; |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
78 |
}; |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
79 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
80 |
/* |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
81 |
* Object data |
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
82 |
*/ |
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
83 |
struct memcache_buf { |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
84 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
85 |
* The char buffer containing the data. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
86 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
87 |
char *data; |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
88 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
89 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
90 |
* The total length of the char buffer, and thence the cache entry. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
91 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
92 |
size_t len; |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
93 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
94 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
95 |
* The amount of data currently available in the buffer. This is used to provide streaming fetches. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
96 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
97 |
* This field is *IMPORTANT*! Don't disregard it, or you *will* get incomplete data. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
98 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
99 |
size_t offset; |
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
100 |
}; |
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
101 |
|
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
102 |
/* |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
103 |
* Available commands |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
104 |
*/ |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
105 |
enum memcache_command { |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
106 |
MEMCACHE_CMD_INVALID, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
107 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
108 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
109 |
* Retrieve the value of a key from the memcached server. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
110 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
111 |
* If the key exists, you will get a RPL_VALUE reply followed by a RPL_END reply. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
112 |
* If it does not exist, you will just get a RPL_END reply. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
113 |
*/ |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
114 |
MEMCACHE_CMD_FETCH_GET, |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
115 |
|
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
116 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
117 |
* Store this data. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
118 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
119 |
* Returns either RPL_STORED or RPL_NOT_STORED. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
120 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
121 |
MEMCACHE_CMD_STORE_SET, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
122 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
123 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
124 |
* Store this data, but only if the server doesn't already hold data for this key. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
125 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
126 |
* Returns either RPL_STORED or RPL_NOT_STORED. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
127 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
128 |
MEMCACHE_CMD_STORE_ADD, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
129 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
130 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
131 |
* Store this data, but only if the server does already hold data for this key. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
132 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
133 |
* Returns either RPL_STORED or RPL_NOT_STORED. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
134 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
135 |
MEMCACHE_CMD_STORE_REPLACE, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
136 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
137 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
138 |
* Add this data to an existing key after existing data. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
139 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
140 |
* obj.flags and obj.exptime are ignored. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
141 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
142 |
* Returns ??? |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
143 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
144 |
MEMCACHE_CMD_STORE_APPEND, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
145 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
146 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
147 |
* Add this data to an existing key before existing data. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
148 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
149 |
* obj.flags and obj.exptime are ignored. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
150 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
151 |
* Returns ??? |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
152 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
153 |
MEMCACHE_CMD_STORE_PREPEND, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
154 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
155 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
156 |
* Check and Set - store this data but only if no one else had updated it since I last fetched it. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
157 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
158 |
* obj.cas is required. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
159 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
160 |
* Returns RPL_STORED, RPL_NOT_STORED, RPL_EXISTS (data has been modified), or RPL_NOT_FOUND (the item does not |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
161 |
* exist or has been deleted). |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
162 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
163 |
MEMCACHE_CMD_STORE_CAS, |
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
164 |
|
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
165 |
MEMCACHE_CMD_MAX, |
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
166 |
}; |
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
167 |
|
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
168 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
169 |
* Replies from the server |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
170 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
171 |
enum memcache_reply { |
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
172 |
MEMCACHE_RPL_INVALID, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
173 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
174 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
175 |
* The library sent an unknown command. This probably means the server is not compatible with said command. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
176 |
*/ |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
177 |
MEMCACHE_RPL_ERROR, |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
178 |
|
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
179 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
180 |
* There was an error in the request that the library sent. The error message is printed out via ERROR. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
181 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
182 |
MEMCACHE_RPL_CLIENT_ERROR, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
183 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
184 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
185 |
* There was an error with the server when processing the request. The error message is printed out via ERROR. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
186 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
187 |
MEMCACHE_RPL_SERVER_ERROR, |
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
188 |
|
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
189 |
// CMD_FETCH_* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
190 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
191 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
192 |
* The given key was found in the cache. The obj attributes are now known, and the buf data is on the way. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
193 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
194 |
MEMCACHE_RPL_VALUE, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
195 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
196 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
197 |
* No more RPL_VALUE replies will be sent. This may be the only reply sent if the key was not found. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
198 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
199 |
MEMCACHE_RPL_END, |
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
200 |
|
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
201 |
// CMD_STORE_* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
202 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
203 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
204 |
* The object was succesfully stored in the cache. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
205 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
206 |
MEMCACHE_RPL_STORED, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
207 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
208 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
209 |
* The object was not stored in the cache. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
210 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
211 |
* This could be for a number of reasons, perhaps the object is too large, the cache is full, the key is in the |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
212 |
* delete queue, or some condition imposed by the STORE_* command was not met. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
213 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
214 |
MEMCACHE_RPL_NOT_STORED, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
215 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
216 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
217 |
* The item you were trying to store with a STORE_CAS request has been modified since you last fetched it (i.e. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
218 |
* obj.cas does not match). |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
219 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
220 |
MEMCACHE_RPL_EXISTS, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
221 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
222 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
223 |
* The item you were trying to store with a STORE_CAS request did not exist (or has been deleted). |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
224 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
225 |
MEMCACHE_RPL_NOT_FOUND, |
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
226 |
|
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
227 |
MEMCACHE_RPL_MAX, |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
228 |
}; |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
229 |
|
45
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
230 |
/* |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
231 |
* Request states |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
232 |
*/ |
48
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
233 |
enum memcache_state { |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
234 |
MEMCACHE_STATE_INVALID, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
235 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
236 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
237 |
* The request is queued, and has not been sent yet |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
238 |
*/ |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
239 |
MEMCACHE_STATE_QUEUED, |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
240 |
|
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
241 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
242 |
* The request is being sent, and the reply has not yet been received |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
243 |
*/ |
42
0e503189af2f
more reply-receiving code, but still incomplete
Tero Marttila <terom@fixme.fi>
parents:
41
diff
changeset
|
244 |
MEMCACHE_STATE_SEND, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
245 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
246 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
247 |
* The reply has been received. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
248 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
249 |
* req_reply and req_obj will return a non-NULL value, but there is no reply data yet. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
250 |
*/ |
42
0e503189af2f
more reply-receiving code, but still incomplete
Tero Marttila <terom@fixme.fi>
parents:
41
diff
changeset
|
251 |
MEMCACHE_STATE_REPLY, |
43
e5b714190dee
the request/reply code should be complete now, but still needs testing
Tero Marttila <terom@fixme.fi>
parents:
42
diff
changeset
|
252 |
|
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
253 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
254 |
* The reply and part of the reply data has been received. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
255 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
256 |
* req_reply, req_obj and req_buf will all return non-NULL values, but buf.offset will be smaller than buf.len. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
257 |
*/ |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
258 |
MEMCACHE_STATE_REPLY_DATA, |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
259 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
260 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
261 |
* The full reply has been received. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
262 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
263 |
* req_reply, req_obj will return a non-NULL value, but there is no reply data. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
264 |
*/ |
43
e5b714190dee
the request/reply code should be complete now, but still needs testing
Tero Marttila <terom@fixme.fi>
parents:
42
diff
changeset
|
265 |
MEMCACHE_STATE_DONE, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
266 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
267 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
268 |
* The full reply and reply data has been received. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
269 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
270 |
* req_reply, req_obj and req_buf will all return non-NULL values, and buf.offset will be equal to buf.len. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
271 |
*/ |
48
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
272 |
MEMCACHE_STATE_DONE_DATA, |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
273 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
274 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
275 |
* An error has occurred. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
276 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
277 |
* req_reply, req_obj and req_buf may or may not work. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
278 |
*/ |
41
540737bf6bac
sending requests, and partial support for receiving -- incomplete, not tested
Tero Marttila <terom@fixme.fi>
parents:
39
diff
changeset
|
279 |
MEMCACHE_STATE_ERROR, |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
280 |
}; |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
281 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
282 |
/* |
45
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
283 |
* Callback used. |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
284 |
* |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
285 |
* This is called whenever the request's state changes, including when new data is received in the STATE_REPLY_DATA |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
286 |
* state. |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
287 |
*/ |
46
8a832c0e01ee
bugfixed, enum->string mappings, test does requests
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
288 |
typedef void (*memcache_cb) (struct memcache_req *, void*); |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
289 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
290 |
/* |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
291 |
* Allocate a new memcache context for use with other methods. |
45
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
292 |
* |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
293 |
* The given callback function is used for all requests in this context. |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
294 |
*/ |
49
10c7dce1a043
autogenerate the memcache_test help output, and pipeline memcache requests
Tero Marttila <terom@fixme.fi>
parents:
48
diff
changeset
|
295 |
struct memcache *memcache_alloc (memcache_cb cb_fn, char pipeline_requests); |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
296 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
297 |
/* |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
298 |
* Add a server to the pool of available servers. |
45
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
299 |
* |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
300 |
* At most <max_connections> connections will be kept open to this server, and additional requests will be queued. |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
301 |
*/ |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
302 |
int memcache_add_server (struct memcache *mc, struct config_endpoint *endpoint, int max_connections); |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
303 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
304 |
/* |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
305 |
* Attempt to fetch a key from the cache. |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
306 |
* |
45
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
307 |
* The given callback argument will be used when invoking the context's callback for this request. |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
308 |
* |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
309 |
* The state machine will work as follows: |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
310 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
311 |
* req_state multi req_reply |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
312 |
* --------------------------------------------- |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
313 |
* STATE_QUEUE ? |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
314 |
* STATE_SEND |
48
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
315 |
* STATE_REPLY RPL_VALUE |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
316 |
* STATE_REPLY_DATA * RPL_VALUE |
48
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
317 |
* STATE_REPLY_DATA RPL_END |
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
318 |
* STATE_DONE_DATA RPL_END |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
319 |
* |
48
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
320 |
* STATE_REPLY RPL_END |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
321 |
* STATE_DONE RPL_END |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
322 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
323 |
* STATE_ERROR RPL_{ERROR,CLIENT_ERROR,SERVER_ERROR} |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
324 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
325 |
* The item attributes/data can be accessed via req_obj/req_buf as described in `enum memcache_state`. |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
326 |
*/ |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
327 |
struct memcache_req *memcache_fetch (struct memcache *mc, const struct memcache_key *key, void *cb_arg); |
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
328 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
329 |
/* |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
330 |
* Attempt to store an item into the cache. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
331 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
332 |
* The cmd argument can be used to specify what CMD_STORE_* command to use. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
333 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
334 |
* The given memcache_key is copied, including the char array pointed to by buf. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
335 |
* Both obj and buf are also copied, but buf.data will not be copied - the pointer must remain valid until the request is done. |
45
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
336 |
* |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
337 |
* The given callback argument will be used when invoking the context's callback for this request. |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
338 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
339 |
* The state machine will work as follows: |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
340 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
341 |
* req_state multi req_reply |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
342 |
* --------------------------------------------- |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
343 |
* STATE_QUEUE ? |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
344 |
* STATE_SEND |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
345 |
* STATE_REPLY RPL_{STORED,NOT_STORED,EXISTS,NOT_FOUND} |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
346 |
* STATE_DONE RPL_{STORED,NOT_STORED,EXISTS,NOT_FOUND} |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
347 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
348 |
* STATE_ERROR RPL_{ERROR,CLIENT_ERROR,SERVER_ERROR} |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
349 |
* |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
350 |
*/ |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
351 |
struct memcache_req *memcache_store (struct memcache *mc, enum memcache_command cmd, const struct memcache_key *key, const struct memcache_obj *obj, const struct memcache_buf *buf, void *cb_arg); |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
352 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
353 |
/* |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
354 |
* Request state. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
355 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
356 |
* Should always return a valid value. |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
357 |
*/ |
48
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
358 |
enum memcache_state memcache_req_state (struct memcache_req *req); |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
359 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
360 |
/* |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
361 |
* Request command. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
362 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
363 |
* Should always return a valid value. |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
364 |
*/ |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
365 |
enum memcache_command memcache_req_cmd (struct memcache_req *req); |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
366 |
|
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
367 |
/* |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
368 |
* Request reply. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
369 |
* |
48
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
370 |
* Will return a valid value in the STATE_REPLY, STATE_REPLY_DATA, STATE_DONE and STATE_DONE_DATA states. |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
371 |
*/ |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
372 |
enum memcache_reply memcache_req_reply (struct memcache_req *req); |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
373 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
374 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
375 |
* Request key. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
376 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
377 |
* Will return a valid valuein all states |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
378 |
*/ |
48
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
379 |
const struct memcache_key *memcache_req_key (struct memcache_req *req); |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
380 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
381 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
382 |
* Request data. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
383 |
* |
48
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
384 |
* Will return a valid value in the STATE_REPLY, STATE_REPLY_DATA, STATE_DONE and STATE_DONE_DATA states. |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
385 |
*/ |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
386 |
const struct memcache_obj *memcache_req_obj (struct memcache_req *req); |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
387 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
388 |
/* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
389 |
* Request buf. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
390 |
* |
48
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
391 |
* Will return a valid value in the STATE_REPLY_DATA and STATE_DONE_DATA states. |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
392 |
* |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
393 |
* Note that buf.offset may be less than buf.len in the STATE_REPLY_DATA state. |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
394 |
*/ |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
395 |
const struct memcache_buf *memcache_req_buf (struct memcache_req *req); |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
396 |
|
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
397 |
/* |
45
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
398 |
* Abort a running request, regardless of what state it is in. |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
399 |
* |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
400 |
* You do not need to call req_free after this. |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
401 |
* |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
402 |
* XXX: unimplemented |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
403 |
*/ |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
404 |
void memcache_req_abort (struct memcache_req *req); |
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
405 |
|
10d514029c64
documentation tweaks, add req_abort function prototype
Tero Marttila <terom@fixme.fi>
parents:
44
diff
changeset
|
406 |
/* |
48
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
407 |
* Free a req that is in the STATE_DONE, STATE_DONE_DATA or STATE_ERROR state. |
44
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
408 |
*/ |
03a7e064f833
stub functions and documentation
Tero Marttila <terom@fixme.fi>
parents:
43
diff
changeset
|
409 |
void memcache_req_free (struct memcache_req *req); |
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
410 |
|
46
8a832c0e01ee
bugfixed, enum->string mappings, test does requests
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
411 |
/* |
8a832c0e01ee
bugfixed, enum->string mappings, test does requests
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
412 |
* Translate commands/replies/states into strings. |
8a832c0e01ee
bugfixed, enum->string mappings, test does requests
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
413 |
*/ |
8a832c0e01ee
bugfixed, enum->string mappings, test does requests
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
414 |
const char *memcache_command_str (enum memcache_command cmd); |
8a832c0e01ee
bugfixed, enum->string mappings, test does requests
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
415 |
const char *memcache_reply_str (enum memcache_reply reply); |
48
1c67f512779b
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
416 |
const char *memcache_state_str (enum memcache_state state); |
46
8a832c0e01ee
bugfixed, enum->string mappings, test does requests
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
417 |
|
38
9894df13b779
added the beginnings of the memcache client module (only up to connect() yet)
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
418 |
#endif /* MEMCACHE_H */ |