memcached 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. data/CHANGELOG +2 -0
  2. data/Manifest +206 -12
  3. data/Rakefile +32 -1
  4. data/ext/extconf.rb +10 -35
  5. data/ext/libmemcached-0.32/AUTHORS +7 -0
  6. data/ext/libmemcached-0.32/COPYING +32 -0
  7. data/ext/libmemcached-0.32/ChangeLog +303 -0
  8. data/ext/libmemcached-0.32/INSTALL +302 -0
  9. data/ext/libmemcached-0.32/Makefile.am +36 -0
  10. data/ext/libmemcached-0.32/Makefile.in +828 -0
  11. data/ext/libmemcached-0.32/NEWS +1 -0
  12. data/ext/libmemcached-0.32/README +33 -0
  13. data/ext/libmemcached-0.32/THANKS +14 -0
  14. data/ext/libmemcached-0.32/TODO +11 -0
  15. data/ext/libmemcached-0.32/aclocal.m4 +1852 -0
  16. data/ext/libmemcached-0.32/clients/Makefile.am +73 -0
  17. data/ext/libmemcached-0.32/clients/Makefile.in +770 -0
  18. data/ext/libmemcached-0.32/clients/client_options.h +32 -0
  19. data/ext/libmemcached-0.32/clients/execute.c +64 -0
  20. data/ext/libmemcached-0.32/clients/execute.h +5 -0
  21. data/ext/libmemcached-0.32/clients/generator.c +74 -0
  22. data/ext/libmemcached-0.32/clients/generator.h +20 -0
  23. data/ext/libmemcached-0.32/clients/memcat.c +178 -0
  24. data/ext/libmemcached-0.32/clients/memcp.c +251 -0
  25. data/ext/libmemcached-0.32/clients/memdump.c +170 -0
  26. data/ext/libmemcached-0.32/clients/memerror.c +80 -0
  27. data/ext/libmemcached-0.32/clients/memflush.c +143 -0
  28. data/ext/libmemcached-0.32/clients/memrm.c +160 -0
  29. data/ext/libmemcached-0.32/clients/memslap.c +441 -0
  30. data/ext/libmemcached-0.32/clients/memstat.c +326 -0
  31. data/ext/libmemcached-0.32/clients/utilities.c +207 -0
  32. data/ext/libmemcached-0.32/clients/utilities.h +41 -0
  33. data/ext/libmemcached-0.32/config.h.in +252 -0
  34. data/ext/libmemcached-0.32/config/compile +143 -0
  35. data/ext/libmemcached-0.32/config/config.guess +1561 -0
  36. data/ext/libmemcached-0.32/config/config.rpath +666 -0
  37. data/ext/libmemcached-0.32/config/config.sub +1686 -0
  38. data/ext/libmemcached-0.32/config/depcomp +630 -0
  39. data/ext/libmemcached-0.32/config/install-sh +520 -0
  40. data/ext/libmemcached-0.32/config/ltmain.sh +8406 -0
  41. data/ext/libmemcached-0.32/config/missing +376 -0
  42. data/ext/libmemcached-0.32/configure +23048 -0
  43. data/ext/libmemcached-0.32/configure.ac +122 -0
  44. data/ext/libmemcached-0.32/docs/Makefile.am +415 -0
  45. data/ext/libmemcached-0.32/docs/Makefile.in +918 -0
  46. data/ext/libmemcached-0.32/docs/libmemcached.pod +123 -0
  47. data/ext/libmemcached-0.32/docs/libmemcached_examples.pod +115 -0
  48. data/ext/libmemcached-0.32/docs/libmemcachedutil.pod +40 -0
  49. data/ext/libmemcached-0.32/docs/memcached_analyze.pod +52 -0
  50. data/ext/libmemcached-0.32/docs/memcached_auto.pod +97 -0
  51. data/ext/libmemcached-0.32/docs/memcached_behavior.pod +224 -0
  52. data/ext/libmemcached-0.32/docs/memcached_callback.pod +123 -0
  53. data/ext/libmemcached-0.32/docs/memcached_create.pod +61 -0
  54. data/ext/libmemcached-0.32/docs/memcached_delete.pod +54 -0
  55. data/ext/libmemcached-0.32/docs/memcached_dump.pod +53 -0
  56. data/ext/libmemcached-0.32/docs/memcached_flush.pod +46 -0
  57. data/ext/libmemcached-0.32/docs/memcached_flush_buffers.pod +42 -0
  58. data/ext/libmemcached-0.32/docs/memcached_generate_hash_value.pod +57 -0
  59. data/ext/libmemcached-0.32/docs/memcached_get.pod +161 -0
  60. data/ext/libmemcached-0.32/docs/memcached_memory_allocators.pod +73 -0
  61. data/ext/libmemcached-0.32/docs/memcached_pool.pod +77 -0
  62. data/ext/libmemcached-0.32/docs/memcached_quit.pod +47 -0
  63. data/ext/libmemcached-0.32/docs/memcached_sasl.pod +63 -0
  64. data/ext/libmemcached-0.32/docs/memcached_server_st.pod +75 -0
  65. data/ext/libmemcached-0.32/docs/memcached_servers.pod +102 -0
  66. data/ext/libmemcached-0.32/docs/memcached_set.pod +187 -0
  67. data/ext/libmemcached-0.32/docs/memcached_stats.pod +82 -0
  68. data/ext/libmemcached-0.32/docs/memcached_strerror.pod +46 -0
  69. data/ext/libmemcached-0.32/docs/memcached_user_data.pod +49 -0
  70. data/ext/libmemcached-0.32/docs/memcached_verbosity.pod +41 -0
  71. data/ext/libmemcached-0.32/docs/memcached_version.pod +56 -0
  72. data/ext/libmemcached-0.32/docs/memcat.pod +37 -0
  73. data/ext/libmemcached-0.32/docs/memcp.pod +40 -0
  74. data/ext/libmemcached-0.32/docs/memdump.pod +31 -0
  75. data/ext/libmemcached-0.32/docs/memerror.pod +30 -0
  76. data/ext/libmemcached-0.32/docs/memflush.pod +35 -0
  77. data/ext/libmemcached-0.32/docs/memrm.pod +34 -0
  78. data/ext/libmemcached-0.32/docs/memslap.pod +33 -0
  79. data/ext/libmemcached-0.32/docs/memstat.pod +35 -0
  80. data/ext/libmemcached-0.32/libmemcached/Makefile.am +107 -0
  81. data/ext/libmemcached-0.32/libmemcached/Makefile.in +1050 -0
  82. data/ext/libmemcached-0.32/libmemcached/byteorder.c +31 -0
  83. data/ext/libmemcached-0.32/libmemcached/common.h +183 -0
  84. data/ext/libmemcached-0.32/libmemcached/crc.c +86 -0
  85. data/ext/libmemcached-0.32/libmemcached/hsieh_hash.c +68 -0
  86. data/ext/libmemcached-0.32/libmemcached/jenkins_hash.c +213 -0
  87. data/ext/libmemcached-0.32/libmemcached/libmemcached.ver +1 -0
  88. data/ext/libmemcached-0.32/libmemcached/libmemcached_probes.d +28 -0
  89. data/ext/libmemcached-0.32/libmemcached/libmemcached_probes.h +78 -0
  90. data/ext/libmemcached-0.32/libmemcached/md5.c +354 -0
  91. data/ext/libmemcached-0.32/libmemcached/memcached.c +152 -0
  92. data/ext/libmemcached-0.32/libmemcached/memcached.h +302 -0
  93. data/ext/libmemcached-0.32/libmemcached/memcached.hpp +799 -0
  94. data/ext/libmemcached-0.32/libmemcached/memcached/README.txt +7 -0
  95. data/ext/libmemcached-0.32/libmemcached/memcached/protocol_binary.h +366 -0
  96. data/ext/libmemcached-0.32/libmemcached/memcached_allocators.c +72 -0
  97. data/ext/libmemcached-0.32/libmemcached/memcached_analyze.c +100 -0
  98. data/ext/libmemcached-0.32/libmemcached/memcached_auto.c +207 -0
  99. data/ext/libmemcached-0.32/libmemcached/memcached_behavior.c +285 -0
  100. data/ext/libmemcached-0.32/libmemcached/memcached_callback.c +175 -0
  101. data/ext/libmemcached-0.32/libmemcached/memcached_configure.h.in +23 -0
  102. data/ext/libmemcached-0.32/libmemcached/memcached_connect.c +361 -0
  103. data/ext/libmemcached-0.32/libmemcached/memcached_constants.h +145 -0
  104. data/ext/libmemcached-0.32/libmemcached/memcached_delete.c +0 -0
  105. data/ext/libmemcached-0.32/libmemcached/memcached_do.c +34 -0
  106. data/ext/libmemcached-0.32/libmemcached/memcached_dump.c +79 -0
  107. data/ext/libmemcached-0.32/libmemcached/memcached_fetch.c +102 -0
  108. data/ext/libmemcached-0.32/libmemcached/memcached_flush.c +89 -0
  109. data/ext/libmemcached-0.32/libmemcached/memcached_flush_buffers.c +22 -0
  110. data/ext/libmemcached-0.32/libmemcached/memcached_get.c +495 -0
  111. data/ext/libmemcached-0.32/libmemcached/memcached_get.h +87 -0
  112. data/ext/libmemcached-0.32/libmemcached/memcached_hash.c +252 -0
  113. data/ext/libmemcached-0.32/libmemcached/memcached_hosts.c +510 -0
  114. data/ext/libmemcached-0.32/libmemcached/memcached_internal.h +31 -0
  115. data/ext/libmemcached-0.32/libmemcached/memcached_io.c +547 -0
  116. data/ext/libmemcached-0.32/libmemcached/memcached_io.h +59 -0
  117. data/ext/libmemcached-0.32/libmemcached/memcached_key.c +28 -0
  118. data/ext/libmemcached-0.32/libmemcached/memcached_parse.c +74 -0
  119. data/ext/libmemcached-0.32/libmemcached/memcached_pool.h +38 -0
  120. data/ext/libmemcached-0.32/libmemcached/memcached_purge.c +76 -0
  121. data/ext/libmemcached-0.32/libmemcached/memcached_quit.c +75 -0
  122. data/ext/libmemcached-0.32/libmemcached/memcached_response.c +528 -0
  123. data/ext/libmemcached-0.32/libmemcached/memcached_result.c +57 -0
  124. data/ext/libmemcached-0.32/libmemcached/memcached_result.h +59 -0
  125. data/ext/libmemcached-0.32/libmemcached/memcached_sasl.c +225 -0
  126. data/ext/libmemcached-0.32/libmemcached/memcached_sasl.h +44 -0
  127. data/ext/libmemcached-0.32/libmemcached/memcached_server.c +159 -0
  128. data/ext/libmemcached-0.32/libmemcached/memcached_server.h +93 -0
  129. data/ext/libmemcached-0.32/libmemcached/memcached_stats.c +454 -0
  130. data/ext/libmemcached-0.32/libmemcached/memcached_storage.c +514 -0
  131. data/ext/libmemcached-0.32/libmemcached/memcached_storage.h +107 -0
  132. data/ext/libmemcached-0.32/libmemcached/memcached_strerror.c +92 -0
  133. data/ext/libmemcached-0.32/libmemcached/memcached_string.c +138 -0
  134. data/ext/libmemcached-0.32/libmemcached/memcached_string.h +53 -0
  135. data/ext/libmemcached-0.32/libmemcached/memcached_types.h +44 -0
  136. data/ext/libmemcached-0.32/libmemcached/memcached_util.h +15 -0
  137. data/ext/libmemcached-0.32/libmemcached/memcached_verbosity.c +36 -0
  138. data/ext/libmemcached-0.32/libmemcached/memcached_version.c +112 -0
  139. data/ext/libmemcached-0.32/libmemcached/memcached_watchpoint.h +38 -0
  140. data/ext/libmemcached-0.32/libmemcached/murmur_hash.c +76 -0
  141. data/ext/libmemcached-0.32/libmemcached/visibility.h +51 -0
  142. data/ext/libmemcached-0.32/libmemcachedutil/Makefile.am +11 -0
  143. data/ext/libmemcached-0.32/libmemcachedutil/Makefile.in +602 -0
  144. data/ext/libmemcached-0.32/libmemcachedutil/libmemcachedutil.ver +1 -0
  145. data/ext/libmemcached-0.32/libmemcachedutil/memcached_pool.c +170 -0
  146. data/ext/libmemcached-0.32/m4/ac_cxx_compile_stdcxx_0x.m4 +103 -0
  147. data/ext/libmemcached-0.32/m4/ac_cxx_header_stdcxx_98.m4 +67 -0
  148. data/ext/libmemcached-0.32/m4/acx_pthread.m4 +276 -0
  149. data/ext/libmemcached-0.32/m4/byteorder.m4 +40 -0
  150. data/ext/libmemcached-0.32/m4/deprecated.m4 +17 -0
  151. data/ext/libmemcached-0.32/m4/enable_utillib.m4 +16 -0
  152. data/ext/libmemcached-0.32/m4/extensions.m4 +94 -0
  153. data/ext/libmemcached-0.32/m4/hsieh.m4 +18 -0
  154. data/ext/libmemcached-0.32/m4/lib-prefix.m4 +221 -0
  155. data/ext/libmemcached-0.32/m4/libtool.m4 +7360 -0
  156. data/ext/libmemcached-0.32/m4/ltoptions.m4 +368 -0
  157. data/ext/libmemcached-0.32/m4/ltsugar.m4 +123 -0
  158. data/ext/libmemcached-0.32/m4/ltversion.m4 +23 -0
  159. data/ext/libmemcached-0.32/m4/lt~obsolete.m4 +92 -0
  160. data/ext/libmemcached-0.32/m4/memcached.m4 +30 -0
  161. data/ext/libmemcached-0.32/m4/pandora_64bit.m4 +55 -0
  162. data/ext/libmemcached-0.32/m4/pandora_canonical.m4 +151 -0
  163. data/ext/libmemcached-0.32/m4/pandora_check_compiler_version.m4 +37 -0
  164. data/ext/libmemcached-0.32/m4/pandora_check_cxx_standard.m4 +16 -0
  165. data/ext/libmemcached-0.32/m4/pandora_enable_dtrace.m4 +41 -0
  166. data/ext/libmemcached-0.32/m4/pandora_ensure_gcc_version.m4 +36 -0
  167. data/ext/libmemcached-0.32/m4/pandora_have_better_malloc.m4 +54 -0
  168. data/ext/libmemcached-0.32/m4/pandora_have_sasl.m4 +133 -0
  169. data/ext/libmemcached-0.32/m4/pandora_header_assert.m4 +23 -0
  170. data/ext/libmemcached-0.32/m4/pandora_libtool.m4 +15 -0
  171. data/ext/libmemcached-0.32/m4/pandora_optimize.m4 +79 -0
  172. data/ext/libmemcached-0.32/m4/pandora_shared_ptr.m4 +56 -0
  173. data/ext/libmemcached-0.32/m4/pandora_vc_build.m4 +32 -0
  174. data/ext/libmemcached-0.32/m4/pandora_warnings.m4 +262 -0
  175. data/ext/libmemcached-0.32/m4/pod2man.m4 +7 -0
  176. data/ext/libmemcached-0.32/m4/protocol_binary.m4 +23 -0
  177. data/ext/libmemcached-0.32/m4/setsockopt.m4 +57 -0
  178. data/ext/libmemcached-0.32/m4/visibility.m4 +52 -0
  179. data/ext/libmemcached-0.32/support/Makefile.am +4 -0
  180. data/ext/libmemcached-0.32/support/Makefile.in +485 -0
  181. data/ext/libmemcached-0.32/support/libmemcached-fc.spec.in +105 -0
  182. data/ext/libmemcached-0.32/support/libmemcached.pc.in +10 -0
  183. data/ext/libmemcached-0.32/support/libmemcached.spec +105 -0
  184. data/ext/libmemcached-0.32/support/libmemcached.spec.in +105 -0
  185. data/ext/libmemcached-0.32/support/set_benchmark.sh +5 -0
  186. data/ext/libmemcached-0.32/tests/Makefile.am +105 -0
  187. data/ext/libmemcached-0.32/tests/Makefile.in +748 -0
  188. data/ext/libmemcached-0.32/tests/atomsmasher.c +245 -0
  189. data/ext/libmemcached-0.32/tests/function.c +4781 -0
  190. data/ext/libmemcached-0.32/tests/ketama_test_cases.h +108 -0
  191. data/ext/libmemcached-0.32/tests/output.cmp +7 -0
  192. data/ext/libmemcached-0.32/tests/output.res +7 -0
  193. data/ext/libmemcached-0.32/tests/output2.res +46 -0
  194. data/ext/libmemcached-0.32/tests/plus.cpp +293 -0
  195. data/ext/libmemcached-0.32/tests/r/memcat.res +19 -0
  196. data/ext/libmemcached-0.32/tests/r/memcp.res +27 -0
  197. data/ext/libmemcached-0.32/tests/r/memrm.res +19 -0
  198. data/ext/libmemcached-0.32/tests/r/memslap.res +33 -0
  199. data/ext/libmemcached-0.32/tests/r/memstat.res +33 -0
  200. data/ext/libmemcached-0.32/tests/server.c +118 -0
  201. data/ext/libmemcached-0.32/tests/server.h +25 -0
  202. data/ext/libmemcached-0.32/tests/start.c +16 -0
  203. data/ext/libmemcached-0.32/tests/t/memcat.test +4 -0
  204. data/ext/libmemcached-0.32/tests/t/memcp.test +3 -0
  205. data/ext/libmemcached-0.32/tests/t/memrm.test +3 -0
  206. data/ext/libmemcached-0.32/tests/t/memslap.test +5 -0
  207. data/ext/libmemcached-0.32/tests/t/memstat.test +3 -0
  208. data/ext/libmemcached-0.32/tests/test.c +137 -0
  209. data/ext/libmemcached-0.32/tests/test.h +46 -0
  210. data/ext/libmemcached-0.32/tests/udp.c +76 -0
  211. data/memcached.gemspec +4 -4
  212. data/test/unit/memcached_test.rb +30 -0
  213. metadata +213 -16
  214. data/ext/libmemcached-0.32.tar.gz +0 -0
  215. data/ext/libmemcached-1.patch +0 -270
  216. data/ext/libmemcached-10.patch +0 -12
  217. data/ext/libmemcached-2.patch +0 -116
  218. data/ext/libmemcached-3.patch +0 -8
  219. data/ext/libmemcached-4.patch +0 -40
  220. data/ext/libmemcached-5.patch +0 -832
  221. data/ext/libmemcached-6.patch +0 -20
  222. data/ext/libmemcached-7.patch +0 -2989
  223. data/ext/libmemcached-8.patch +0 -137
  224. data/ext/libmemcached-9.patch +0 -13
  225. data/ext/sasl.patch +0 -29283
@@ -0,0 +1,145 @@
1
+ /*
2
+ * Summary: Constants for libmemcached
3
+ *
4
+ * Copy: See Copyright for the status of this software.
5
+ *
6
+ * Author: Brian Aker
7
+ */
8
+
9
+ #ifndef __MEMCACHED_CONSTANTS_H__
10
+ #define __MEMCACHED_CONSTANTS_H__
11
+
12
+ /* Public defines */
13
+ #define MEMCACHED_DEFAULT_PORT 11211
14
+ #define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */
15
+ #define MEMCACHED_MAX_BUFFER 8196
16
+ #define MEMCACHED_MAX_HOST_LENGTH 64
17
+ #define MEMCACHED_MAX_HOST_SORT_LENGTH 86 /* Used for Ketama */
18
+ #define MEMCACHED_POINTS_PER_SERVER 100
19
+ #define MEMCACHED_POINTS_PER_SERVER_KETAMA 160
20
+ #define MEMCACHED_CONTINUUM_SIZE MEMCACHED_POINTS_PER_SERVER*100 /* This would then set max hosts to 100 */
21
+ #define MEMCACHED_STRIDE 4
22
+ #define MEMCACHED_DEFAULT_TIMEOUT 1000
23
+ #define MEMCACHED_CONTINUUM_ADDITION 10 /* How many extra slots we should build for in the continuum */
24
+ #define MEMCACHED_PREFIX_KEY_MAX_SIZE 128
25
+ #define MEMCACHED_EXPIRATION_NOT_ADD 0xffffffffU
26
+
27
+ typedef enum {
28
+ MEMCACHED_SUCCESS,
29
+ MEMCACHED_FAILURE,
30
+ MEMCACHED_HOST_LOOKUP_FAILURE,
31
+ MEMCACHED_CONNECTION_FAILURE,
32
+ MEMCACHED_CONNECTION_BIND_FAILURE,
33
+ MEMCACHED_WRITE_FAILURE,
34
+ MEMCACHED_READ_FAILURE,
35
+ MEMCACHED_UNKNOWN_READ_FAILURE,
36
+ MEMCACHED_PROTOCOL_ERROR,
37
+ MEMCACHED_CLIENT_ERROR,
38
+ MEMCACHED_SERVER_ERROR,
39
+ MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE,
40
+ MEMCACHED_DATA_EXISTS,
41
+ MEMCACHED_DATA_DOES_NOT_EXIST,
42
+ MEMCACHED_NOTSTORED,
43
+ MEMCACHED_STORED,
44
+ MEMCACHED_NOTFOUND,
45
+ MEMCACHED_MEMORY_ALLOCATION_FAILURE,
46
+ MEMCACHED_PARTIAL_READ,
47
+ MEMCACHED_SOME_ERRORS,
48
+ MEMCACHED_NO_SERVERS,
49
+ MEMCACHED_END,
50
+ MEMCACHED_DELETED,
51
+ MEMCACHED_VALUE,
52
+ MEMCACHED_STAT,
53
+ MEMCACHED_ITEM,
54
+ MEMCACHED_ERRNO,
55
+ MEMCACHED_FAIL_UNIX_SOCKET,
56
+ MEMCACHED_NOT_SUPPORTED,
57
+ MEMCACHED_NO_KEY_PROVIDED, /* Deprecated. Use MEMCACHED_BAD_KEY_PROVIDED! */
58
+ MEMCACHED_FETCH_NOTFINISHED,
59
+ MEMCACHED_TIMEOUT,
60
+ MEMCACHED_BUFFERED,
61
+ MEMCACHED_BAD_KEY_PROVIDED,
62
+ MEMCACHED_INVALID_HOST_PROTOCOL,
63
+ MEMCACHED_SERVER_MARKED_DEAD,
64
+ MEMCACHED_UNKNOWN_STAT_KEY,
65
+ MEMCACHED_AUTH_PROBLEM,
66
+ MEMCACHED_AUTH_FAILURE,
67
+ MEMCACHED_AUTH_CONTINUE,
68
+ MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */
69
+ } memcached_return;
70
+
71
+ typedef enum {
72
+ MEMCACHED_DISTRIBUTION_MODULA,
73
+ MEMCACHED_DISTRIBUTION_CONSISTENT,
74
+ MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA,
75
+ MEMCACHED_DISTRIBUTION_RANDOM
76
+ } memcached_server_distribution;
77
+
78
+ typedef enum {
79
+ MEMCACHED_BEHAVIOR_NO_BLOCK,
80
+ MEMCACHED_BEHAVIOR_TCP_NODELAY,
81
+ MEMCACHED_BEHAVIOR_HASH,
82
+ MEMCACHED_BEHAVIOR_KETAMA,
83
+ MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE,
84
+ MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE,
85
+ MEMCACHED_BEHAVIOR_CACHE_LOOKUPS,
86
+ MEMCACHED_BEHAVIOR_SUPPORT_CAS,
87
+ MEMCACHED_BEHAVIOR_POLL_TIMEOUT,
88
+ MEMCACHED_BEHAVIOR_DISTRIBUTION,
89
+ MEMCACHED_BEHAVIOR_BUFFER_REQUESTS,
90
+ MEMCACHED_BEHAVIOR_USER_DATA,
91
+ MEMCACHED_BEHAVIOR_SORT_HOSTS,
92
+ MEMCACHED_BEHAVIOR_VERIFY_KEY,
93
+ MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT,
94
+ MEMCACHED_BEHAVIOR_RETRY_TIMEOUT,
95
+ MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED,
96
+ MEMCACHED_BEHAVIOR_KETAMA_HASH,
97
+ MEMCACHED_BEHAVIOR_BINARY_PROTOCOL,
98
+ MEMCACHED_BEHAVIOR_SND_TIMEOUT,
99
+ MEMCACHED_BEHAVIOR_RCV_TIMEOUT,
100
+ MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT,
101
+ MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK,
102
+ MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK,
103
+ MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH,
104
+ MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY,
105
+ MEMCACHED_BEHAVIOR_NOREPLY,
106
+ MEMCACHED_BEHAVIOR_USE_UDP,
107
+ MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS
108
+ } memcached_behavior;
109
+
110
+ typedef enum {
111
+ MEMCACHED_CALLBACK_PREFIX_KEY = 0,
112
+ MEMCACHED_CALLBACK_USER_DATA = 1,
113
+ MEMCACHED_CALLBACK_CLEANUP_FUNCTION = 2,
114
+ MEMCACHED_CALLBACK_CLONE_FUNCTION = 3,
115
+ #ifdef MEMCACHED_ENABLE_DEPRECATED
116
+ MEMCACHED_CALLBACK_MALLOC_FUNCTION = 4,
117
+ MEMCACHED_CALLBACK_REALLOC_FUNCTION = 5,
118
+ MEMCACHED_CALLBACK_FREE_FUNCTION = 6,
119
+ #endif
120
+ MEMCACHED_CALLBACK_GET_FAILURE = 7,
121
+ MEMCACHED_CALLBACK_DELETE_TRIGGER = 8
122
+ } memcached_callback;
123
+
124
+ typedef enum {
125
+ MEMCACHED_HASH_DEFAULT= 0,
126
+ MEMCACHED_HASH_MD5,
127
+ MEMCACHED_HASH_CRC,
128
+ MEMCACHED_HASH_FNV1_64,
129
+ MEMCACHED_HASH_FNV1A_64,
130
+ MEMCACHED_HASH_FNV1_32,
131
+ MEMCACHED_HASH_FNV1A_32,
132
+ MEMCACHED_HASH_HSIEH,
133
+ MEMCACHED_HASH_MURMUR,
134
+ MEMCACHED_HASH_JENKINS,
135
+ MEMCACHED_HASH_NONE
136
+ } memcached_hash;
137
+
138
+ typedef enum {
139
+ MEMCACHED_CONNECTION_UNKNOWN,
140
+ MEMCACHED_CONNECTION_TCP,
141
+ MEMCACHED_CONNECTION_UDP,
142
+ MEMCACHED_CONNECTION_UNIX_SOCKET
143
+ } memcached_connection;
144
+
145
+ #endif /* __MEMCACHED_CONSTANTS_H__ */
@@ -0,0 +1,34 @@
1
+ #include "common.h"
2
+
3
+ memcached_return memcached_do(memcached_server_st *ptr, const void *command,
4
+ size_t command_length, uint8_t with_flush)
5
+ {
6
+ memcached_return rc;
7
+ ssize_t sent_length;
8
+
9
+ WATCHPOINT_ASSERT(command_length);
10
+ WATCHPOINT_ASSERT(command);
11
+
12
+ if ((rc= memcached_connect(ptr)) != MEMCACHED_SUCCESS)
13
+ {
14
+ WATCHPOINT_ERROR(rc);
15
+ return rc;
16
+ }
17
+
18
+ /*
19
+ ** Since non buffering ops in UDP mode dont check to make sure they will fit
20
+ ** before they start writing, if there is any data in buffer, clear it out,
21
+ ** otherwise we might get a partial write.
22
+ **/
23
+ if (ptr->type == MEMCACHED_CONNECTION_UDP && with_flush && ptr->write_buffer_offset > UDP_DATAGRAM_HEADER_LENGTH)
24
+ memcached_io_write(ptr, NULL, 0, 1);
25
+
26
+ sent_length= memcached_io_write(ptr, command, command_length, (char) with_flush);
27
+
28
+ if (sent_length == -1 || (size_t)sent_length != command_length)
29
+ rc= MEMCACHED_WRITE_FAILURE;
30
+ else if ((ptr->root->flags & MEM_NOREPLY) == 0)
31
+ memcached_server_response_increment(ptr);
32
+
33
+ return rc;
34
+ }
@@ -0,0 +1,79 @@
1
+ /*
2
+ We use this to dump all keys.
3
+
4
+ At this point we only support a callback method. This could be optimized by first
5
+ calling items and finding active slabs. For the moment though we just loop through
6
+ all slabs on servers and "grab" the keys.
7
+ */
8
+
9
+ #include "common.h"
10
+ static memcached_return ascii_dump(memcached_st *ptr, memcached_dump_func *callback, void *context, uint32_t number_of_callbacks)
11
+ {
12
+ memcached_return rc= 0;
13
+ char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
14
+ size_t send_length;
15
+ uint32_t server_key;
16
+ uint32_t x;
17
+
18
+ unlikely (ptr->number_of_hosts == 0)
19
+ return MEMCACHED_NO_SERVERS;
20
+
21
+ for (server_key= 0; server_key < ptr->number_of_hosts; server_key++)
22
+ {
23
+ /* 256 I BELIEVE is the upper limit of slabs */
24
+ for (x= 0; x < 256; x++)
25
+ {
26
+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
27
+ "stats cachedump %u 0 0\r\n", x);
28
+
29
+ rc= memcached_do(&ptr->hosts[server_key], buffer, send_length, 1);
30
+
31
+ unlikely (rc != MEMCACHED_SUCCESS)
32
+ goto error;
33
+
34
+ while (1)
35
+ {
36
+ uint32_t callback_counter;
37
+ rc= memcached_response(&ptr->hosts[server_key], buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
38
+
39
+ if (rc == MEMCACHED_ITEM)
40
+ {
41
+ char *string_ptr, *end_ptr;
42
+ char *key;
43
+
44
+ string_ptr= buffer;
45
+ string_ptr+= 5; /* Move past ITEM */
46
+ for (end_ptr= string_ptr; isgraph(*end_ptr); end_ptr++);
47
+ key= string_ptr;
48
+ key[(size_t)(end_ptr-string_ptr)]= 0;
49
+ for (callback_counter= 0; callback_counter < number_of_callbacks; callback_counter++)
50
+ {
51
+ rc= (*callback[callback_counter])(ptr, key, (size_t)(end_ptr-string_ptr), context);
52
+ if (rc != MEMCACHED_SUCCESS)
53
+ break;
54
+ }
55
+ }
56
+ else if (rc == MEMCACHED_END)
57
+ break;
58
+ else
59
+ goto error;
60
+ }
61
+ }
62
+ }
63
+
64
+ error:
65
+ if (rc == MEMCACHED_END)
66
+ return MEMCACHED_SUCCESS;
67
+ else
68
+ return rc;
69
+ }
70
+
71
+ memcached_return memcached_dump(memcached_st *ptr, memcached_dump_func *callback, void *context, uint32_t number_of_callbacks)
72
+ {
73
+ /* No support for Binary protocol yet */
74
+ if (ptr->flags & MEM_BINARY_PROTOCOL)
75
+ return MEMCACHED_FAILURE;
76
+
77
+ return ascii_dump(ptr, callback, context, number_of_callbacks);
78
+ }
79
+
@@ -0,0 +1,102 @@
1
+ #include "common.h"
2
+ #include "memcached_io.h"
3
+
4
+ char *memcached_fetch(memcached_st *ptr, char *key, size_t *key_length,
5
+ size_t *value_length,
6
+ uint32_t *flags,
7
+ memcached_return *error)
8
+ {
9
+ memcached_result_st *result_buffer= &ptr->result;
10
+
11
+ unlikely (ptr->flags & MEM_USE_UDP)
12
+ {
13
+ *error= MEMCACHED_NOT_SUPPORTED;
14
+ return NULL;
15
+ }
16
+
17
+ result_buffer= memcached_fetch_result(ptr, result_buffer, error);
18
+
19
+ if (result_buffer == NULL || *error != MEMCACHED_SUCCESS)
20
+ {
21
+ WATCHPOINT_ASSERT(result_buffer == NULL);
22
+ *value_length= 0;
23
+ return NULL;
24
+ }
25
+
26
+ *value_length= memcached_string_length(&result_buffer->value);
27
+
28
+ if (key)
29
+ {
30
+ strncpy(key, result_buffer->key, result_buffer->key_length);
31
+ *key_length= result_buffer->key_length;
32
+ }
33
+
34
+ if (result_buffer->flags)
35
+ *flags= result_buffer->flags;
36
+ else
37
+ *flags= 0;
38
+
39
+ return memcached_string_c_copy(&result_buffer->value);
40
+ }
41
+
42
+ memcached_result_st *memcached_fetch_result(memcached_st *ptr,
43
+ memcached_result_st *result,
44
+ memcached_return *error)
45
+ {
46
+ memcached_server_st *server;
47
+
48
+ unlikely (ptr->flags & MEM_USE_UDP)
49
+ {
50
+ *error= MEMCACHED_NOT_SUPPORTED;
51
+ return NULL;
52
+ }
53
+
54
+ if (result == NULL)
55
+ if ((result= memcached_result_create(ptr, NULL)) == NULL)
56
+ return NULL;
57
+
58
+ while ((server = memcached_io_get_readable_server(ptr)) != NULL)
59
+ {
60
+ char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
61
+ *error= memcached_response(server, buffer, sizeof(buffer), result);
62
+
63
+ if (*error == MEMCACHED_SUCCESS)
64
+ return result;
65
+ else if (*error == MEMCACHED_END)
66
+ memcached_server_response_reset(server);
67
+ else
68
+ break;
69
+ }
70
+
71
+ /* We have completed reading data */
72
+ if (result->is_allocated)
73
+ memcached_result_free(result);
74
+ else
75
+ memcached_string_reset(&result->value);
76
+
77
+ return NULL;
78
+ }
79
+
80
+ memcached_return memcached_fetch_execute(memcached_st *ptr,
81
+ memcached_execute_function *callback,
82
+ void *context,
83
+ unsigned int number_of_callbacks)
84
+ {
85
+ memcached_result_st *result= &ptr->result;
86
+ memcached_return rc= MEMCACHED_FAILURE;
87
+ unsigned int x;
88
+
89
+ while ((result= memcached_fetch_result(ptr, result, &rc)) != NULL)
90
+ {
91
+ if (rc == MEMCACHED_SUCCESS)
92
+ {
93
+ for (x= 0; x < number_of_callbacks; x++)
94
+ {
95
+ rc= (*callback[x])(ptr, result, context);
96
+ if (rc != MEMCACHED_SUCCESS)
97
+ break;
98
+ }
99
+ }
100
+ }
101
+ return rc;
102
+ }
@@ -0,0 +1,89 @@
1
+ #include "common.h"
2
+
3
+ static memcached_return memcached_flush_binary(memcached_st *ptr,
4
+ time_t expiration);
5
+ static memcached_return memcached_flush_textual(memcached_st *ptr,
6
+ time_t expiration);
7
+
8
+ memcached_return memcached_flush(memcached_st *ptr, time_t expiration)
9
+ {
10
+ memcached_return rc;
11
+
12
+ LIBMEMCACHED_MEMCACHED_FLUSH_START();
13
+ if (ptr->flags & MEM_BINARY_PROTOCOL)
14
+ rc= memcached_flush_binary(ptr, expiration);
15
+ else
16
+ rc= memcached_flush_textual(ptr, expiration);
17
+ LIBMEMCACHED_MEMCACHED_FLUSH_END();
18
+ return rc;
19
+ }
20
+
21
+ static memcached_return memcached_flush_textual(memcached_st *ptr,
22
+ time_t expiration)
23
+ {
24
+ unsigned int x;
25
+ size_t send_length;
26
+ memcached_return rc;
27
+ char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
28
+
29
+ unlikely (ptr->number_of_hosts == 0)
30
+ return MEMCACHED_NO_SERVERS;
31
+
32
+ for (x= 0; x < ptr->number_of_hosts; x++)
33
+ {
34
+ bool no_reply= (ptr->flags & MEM_NOREPLY);
35
+ if (expiration)
36
+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
37
+ "flush_all %llu%s\r\n",
38
+ (unsigned long long)expiration, no_reply ? " noreply" : "");
39
+ else
40
+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
41
+ "flush_all%s\r\n", no_reply ? " noreply" : "");
42
+
43
+ rc= memcached_do(&ptr->hosts[x], buffer, send_length, 1);
44
+
45
+ if (rc == MEMCACHED_SUCCESS && !no_reply)
46
+ (void)memcached_response(&ptr->hosts[x], buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL);
47
+ }
48
+
49
+ return MEMCACHED_SUCCESS;
50
+ }
51
+
52
+ static memcached_return memcached_flush_binary(memcached_st *ptr,
53
+ time_t expiration)
54
+ {
55
+ unsigned int x;
56
+ protocol_binary_request_flush request= {.bytes= {0}};
57
+
58
+ unlikely (ptr->number_of_hosts == 0)
59
+ return MEMCACHED_NO_SERVERS;
60
+
61
+ request.message.header.request.magic= (uint8_t)PROTOCOL_BINARY_REQ;
62
+ request.message.header.request.opcode= PROTOCOL_BINARY_CMD_FLUSH;
63
+ request.message.header.request.extlen= 4;
64
+ request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
65
+ request.message.header.request.bodylen= htonl(request.message.header.request.extlen);
66
+ request.message.body.expiration= htonl((uint32_t) expiration);
67
+
68
+ for (x= 0; x < ptr->number_of_hosts; x++)
69
+ {
70
+ if (ptr->flags & MEM_NOREPLY)
71
+ request.message.header.request.opcode= PROTOCOL_BINARY_CMD_FLUSHQ;
72
+ else
73
+ request.message.header.request.opcode= PROTOCOL_BINARY_CMD_FLUSH;
74
+ if (memcached_do(&ptr->hosts[x], request.bytes,
75
+ sizeof(request.bytes), 1) != MEMCACHED_SUCCESS)
76
+ {
77
+ memcached_io_reset(&ptr->hosts[x]);
78
+ return MEMCACHED_WRITE_FAILURE;
79
+ }
80
+ }
81
+
82
+ for (x= 0; x < ptr->number_of_hosts; x++)
83
+ {
84
+ if (memcached_server_response_count(&ptr->hosts[x]) > 0)
85
+ (void)memcached_response(&ptr->hosts[x], NULL, 0, NULL);
86
+ }
87
+
88
+ return MEMCACHED_SUCCESS;
89
+ }