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,107 @@
1
+ /*
2
+ * Summary: Storage functions for libmemcached
3
+ *
4
+ * Copy: See Copyright for the status of this software.
5
+ *
6
+ * Author: Brian Aker
7
+ */
8
+
9
+ #ifndef __MEMCACHED_STORAGE_H__
10
+ #define __MEMCACHED_STORAGE_H__
11
+
12
+ #include "libmemcached/memcached_types.h"
13
+
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif
17
+
18
+ /* All of the functions for adding data to the server */
19
+ LIBMEMCACHED_API
20
+ memcached_return memcached_set(memcached_st *ptr, const char *key, size_t key_length,
21
+ const char *value, size_t value_length,
22
+ time_t expiration,
23
+ uint32_t flags);
24
+ LIBMEMCACHED_API
25
+ memcached_return memcached_add(memcached_st *ptr, const char *key, size_t key_length,
26
+ const char *value, size_t value_length,
27
+ time_t expiration,
28
+ uint32_t flags);
29
+ LIBMEMCACHED_API
30
+ memcached_return memcached_replace(memcached_st *ptr, const char *key, size_t key_length,
31
+ const char *value, size_t value_length,
32
+ time_t expiration,
33
+ uint32_t flags);
34
+ LIBMEMCACHED_API
35
+ memcached_return memcached_append(memcached_st *ptr,
36
+ const char *key, size_t key_length,
37
+ const char *value, size_t value_length,
38
+ time_t expiration,
39
+ uint32_t flags);
40
+ LIBMEMCACHED_API
41
+ memcached_return memcached_prepend(memcached_st *ptr,
42
+ const char *key, size_t key_length,
43
+ const char *value, size_t value_length,
44
+ time_t expiration,
45
+ uint32_t flags);
46
+ LIBMEMCACHED_API
47
+ memcached_return memcached_cas(memcached_st *ptr,
48
+ const char *key, size_t key_length,
49
+ const char *value, size_t value_length,
50
+ time_t expiration,
51
+ uint32_t flags,
52
+ uint64_t cas);
53
+
54
+ LIBMEMCACHED_API
55
+ memcached_return memcached_set_by_key(memcached_st *ptr,
56
+ const char *master_key, size_t master_key_length,
57
+ const char *key, size_t key_length,
58
+ const char *value, size_t value_length,
59
+ time_t expiration,
60
+ uint32_t flags);
61
+
62
+ LIBMEMCACHED_API
63
+ memcached_return memcached_add_by_key(memcached_st *ptr,
64
+ const char *master_key, size_t master_key_length,
65
+ const char *key, size_t key_length,
66
+ const char *value, size_t value_length,
67
+ time_t expiration,
68
+ uint32_t flags);
69
+
70
+ LIBMEMCACHED_API
71
+ memcached_return memcached_replace_by_key(memcached_st *ptr,
72
+ const char *master_key, size_t master_key_length,
73
+ const char *key, size_t key_length,
74
+ const char *value, size_t value_length,
75
+ time_t expiration,
76
+ uint32_t flags);
77
+
78
+ LIBMEMCACHED_API
79
+ memcached_return memcached_prepend_by_key(memcached_st *ptr,
80
+ const char *master_key, size_t master_key_length,
81
+ const char *key, size_t key_length,
82
+ const char *value, size_t value_length,
83
+ time_t expiration,
84
+ uint32_t flags);
85
+
86
+ LIBMEMCACHED_API
87
+ memcached_return memcached_append_by_key(memcached_st *ptr,
88
+ const char *master_key, size_t master_key_length,
89
+ const char *key, size_t key_length,
90
+ const char *value, size_t value_length,
91
+ time_t expiration,
92
+ uint32_t flags);
93
+
94
+ LIBMEMCACHED_API
95
+ memcached_return memcached_cas_by_key(memcached_st *ptr,
96
+ const char *master_key, size_t master_key_length,
97
+ const char *key, size_t key_length,
98
+ const char *value, size_t value_length,
99
+ time_t expiration,
100
+ uint32_t flags,
101
+ uint64_t cas);
102
+
103
+ #ifdef __cplusplus
104
+ }
105
+ #endif
106
+
107
+ #endif /* __MEMCACHED_STORAGE_H__ */
@@ -0,0 +1,92 @@
1
+ #include "common.h"
2
+
3
+ const char *memcached_strerror(memcached_st *ptr __attribute__((unused)), memcached_return rc)
4
+ {
5
+ switch (rc)
6
+ {
7
+ case MEMCACHED_SUCCESS:
8
+ return "SUCCESS";
9
+ case MEMCACHED_FAILURE:
10
+ return "FAILURE";
11
+ case MEMCACHED_HOST_LOOKUP_FAILURE:
12
+ return "HOSTNAME LOOKUP FAILURE";
13
+ case MEMCACHED_CONNECTION_FAILURE:
14
+ return "CONNECTION FAILURE";
15
+ case MEMCACHED_CONNECTION_BIND_FAILURE:
16
+ return "CONNECTION BIND FAILURE";
17
+ case MEMCACHED_READ_FAILURE:
18
+ return "READ FAILURE";
19
+ case MEMCACHED_UNKNOWN_READ_FAILURE:
20
+ return "UNKNOWN READ FAILURE";
21
+ case MEMCACHED_PROTOCOL_ERROR:
22
+ return "PROTOCOL ERROR";
23
+ case MEMCACHED_CLIENT_ERROR:
24
+ return "CLIENT ERROR";
25
+ case MEMCACHED_SERVER_ERROR:
26
+ return "SERVER ERROR";
27
+ case MEMCACHED_WRITE_FAILURE:
28
+ return "WRITE FAILURE";
29
+ case MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE:
30
+ return "CONNECTION SOCKET CREATE FAILURE";
31
+ case MEMCACHED_DATA_EXISTS:
32
+ return "CONNECTION DATA EXISTS";
33
+ case MEMCACHED_DATA_DOES_NOT_EXIST:
34
+ return "CONNECTION DATA DOES NOT EXIST";
35
+ case MEMCACHED_NOTSTORED:
36
+ return "NOT STORED";
37
+ case MEMCACHED_STORED:
38
+ return "STORED";
39
+ case MEMCACHED_NOTFOUND:
40
+ return "NOT FOUND";
41
+ case MEMCACHED_MEMORY_ALLOCATION_FAILURE:
42
+ return "MEMORY ALLOCATION FAILURE";
43
+ case MEMCACHED_PARTIAL_READ:
44
+ return "PARTIAL READ";
45
+ case MEMCACHED_SOME_ERRORS:
46
+ return "SOME ERRORS WERE REPORTED";
47
+ case MEMCACHED_NO_SERVERS:
48
+ return "NO SERVERS DEFINED";
49
+ case MEMCACHED_END:
50
+ return "SERVER END";
51
+ case MEMCACHED_DELETED:
52
+ return "SERVER DELETE";
53
+ case MEMCACHED_VALUE:
54
+ return "SERVER VALUE";
55
+ case MEMCACHED_STAT:
56
+ return "STAT VALUE";
57
+ case MEMCACHED_ITEM:
58
+ return "ITEM VALUE";
59
+ case MEMCACHED_ERRNO:
60
+ return "SYSTEM ERROR";
61
+ case MEMCACHED_FAIL_UNIX_SOCKET:
62
+ return "COULD NOT OPEN UNIX SOCKET";
63
+ case MEMCACHED_NOT_SUPPORTED:
64
+ return "ACTION NOT SUPPORTED";
65
+ case MEMCACHED_FETCH_NOTFINISHED:
66
+ return "FETCH WAS NOT COMPLETED";
67
+ case MEMCACHED_NO_KEY_PROVIDED:
68
+ return "A KEY LENGTH OF ZERO WAS PROVIDED";
69
+ case MEMCACHED_BUFFERED:
70
+ return "ACTION QUEUED";
71
+ case MEMCACHED_TIMEOUT:
72
+ return "A TIMEOUT OCCURRED";
73
+ case MEMCACHED_BAD_KEY_PROVIDED:
74
+ return "A BAD KEY WAS PROVIDED/CHARACTERS OUT OF RANGE";
75
+ case MEMCACHED_INVALID_HOST_PROTOCOL:
76
+ return "THE HOST TRANSPORT PROTOCOL DOES NOT MATCH THAT OF THE CLIENT";
77
+ case MEMCACHED_SERVER_MARKED_DEAD:
78
+ return "SERVER IS MARKED DEAD";
79
+ case MEMCACHED_UNKNOWN_STAT_KEY:
80
+ return "ENCOUNTERED AN UNKNOWN STAT KEY";
81
+ case MEMCACHED_AUTH_PROBLEM:
82
+ return "FAILED TO SEND AUTHENTICATION TO SERVER";
83
+ case MEMCACHED_AUTH_FAILURE:
84
+ return "AUTHENTICATION FAILURE";
85
+ case MEMCACHED_AUTH_CONTINUE:
86
+ return "CONTINUE AUTHENTICATION";
87
+ case MEMCACHED_MAXIMUM_RETURN:
88
+ return "Gibberish returned!";
89
+ default:
90
+ return "Gibberish returned!";
91
+ }
92
+ }
@@ -0,0 +1,138 @@
1
+ #include "common.h"
2
+
3
+ memcached_return memcached_string_check(memcached_string_st *string, size_t need)
4
+ {
5
+ if (need && need > (size_t)(string->current_size - (size_t)(string->end - string->string)))
6
+ {
7
+ size_t current_offset= (size_t) (string->end - string->string);
8
+ char *new_value;
9
+ size_t adjust;
10
+ size_t new_size;
11
+
12
+ /* This is the block multiplier. To keep it larger and surive division errors we must round it up */
13
+ adjust= (need - (size_t)(string->current_size - (size_t)(string->end - string->string))) / string->block_size;
14
+ adjust++;
15
+
16
+ new_size= sizeof(char) * (size_t)((adjust * string->block_size) + string->current_size);
17
+ /* Test for overflow */
18
+ if (new_size < need)
19
+ return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
20
+
21
+ new_value= string->root->call_realloc(string->root, string->string, new_size);
22
+
23
+ if (new_value == NULL)
24
+ return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
25
+
26
+ string->string= new_value;
27
+ string->end= string->string + current_offset;
28
+
29
+ string->current_size+= (string->block_size * adjust);
30
+ }
31
+
32
+ return MEMCACHED_SUCCESS;
33
+ }
34
+
35
+ memcached_string_st *memcached_string_create(memcached_st *ptr, memcached_string_st *string, size_t initial_size)
36
+ {
37
+ memcached_return rc;
38
+
39
+ /* Saving malloc calls :) */
40
+ if (string)
41
+ memset(string, 0, sizeof(memcached_string_st));
42
+ else
43
+ {
44
+ string= ptr->call_calloc(ptr, 1, sizeof(memcached_string_st));
45
+
46
+ if (string == NULL)
47
+ return NULL;
48
+ string->is_allocated= true;
49
+ }
50
+ string->block_size= MEMCACHED_BLOCK_SIZE;
51
+ string->root= ptr;
52
+
53
+ rc= memcached_string_check(string, initial_size);
54
+ if (rc != MEMCACHED_SUCCESS)
55
+ {
56
+ ptr->call_free(ptr, string);
57
+ return NULL;
58
+ }
59
+
60
+ WATCHPOINT_ASSERT(string->string == string->end);
61
+
62
+ return string;
63
+ }
64
+
65
+ memcached_return memcached_string_append_character(memcached_string_st *string,
66
+ char character)
67
+ {
68
+ memcached_return rc;
69
+
70
+ rc= memcached_string_check(string, 1);
71
+
72
+ if (rc != MEMCACHED_SUCCESS)
73
+ return rc;
74
+
75
+ *string->end= character;
76
+ string->end++;
77
+
78
+ return MEMCACHED_SUCCESS;
79
+ }
80
+
81
+ memcached_return memcached_string_append(memcached_string_st *string,
82
+ const char *value, size_t length)
83
+ {
84
+ memcached_return rc;
85
+
86
+ rc= memcached_string_check(string, length);
87
+
88
+ if (rc != MEMCACHED_SUCCESS)
89
+ return rc;
90
+
91
+ WATCHPOINT_ASSERT(length <= string->current_size);
92
+ WATCHPOINT_ASSERT(string->string);
93
+ WATCHPOINT_ASSERT(string->end >= string->string);
94
+
95
+ memcpy(string->end, value, length);
96
+ string->end+= length;
97
+
98
+ return MEMCACHED_SUCCESS;
99
+ }
100
+
101
+ char *memcached_string_c_copy(memcached_string_st *string)
102
+ {
103
+ char *c_ptr;
104
+
105
+ if (memcached_string_length(string) == 0)
106
+ return NULL;
107
+
108
+ c_ptr= string->root->call_malloc(string->root, (memcached_string_length(string)+1) * sizeof(char));
109
+
110
+ if (c_ptr == NULL)
111
+ return NULL;
112
+
113
+ memcpy(c_ptr, memcached_string_value(string), memcached_string_length(string));
114
+ c_ptr[memcached_string_length(string)]= 0;
115
+
116
+ return c_ptr;
117
+ }
118
+
119
+ memcached_return memcached_string_reset(memcached_string_st *string)
120
+ {
121
+ string->end= string->string;
122
+
123
+ return MEMCACHED_SUCCESS;
124
+ }
125
+
126
+ void memcached_string_free(memcached_string_st *ptr)
127
+ {
128
+ if (ptr == NULL)
129
+ return;
130
+
131
+ if (ptr->string)
132
+ ptr->root->call_free(ptr->root, ptr->string);
133
+
134
+ if (ptr->is_allocated)
135
+ ptr->root->call_free(ptr->root, ptr);
136
+ else
137
+ memset(ptr, 0, sizeof(memcached_string_st));
138
+ }
@@ -0,0 +1,53 @@
1
+ /*
2
+ * Summary: String structure used for libmemcached.
3
+ *
4
+ * Copy: See Copyright for the status of this software.
5
+ *
6
+ * Author: Brian Aker
7
+ */
8
+
9
+ #ifndef __MEMCACHED_STRING_H__
10
+ #define __MEMCACHED_STRING_H__
11
+
12
+ #ifdef __cplusplus
13
+ extern "C" {
14
+ #endif
15
+
16
+ struct memcached_string_st {
17
+ memcached_st *root;
18
+ char *end;
19
+ char *string;
20
+ size_t current_size;
21
+ size_t block_size;
22
+ bool is_allocated;
23
+ };
24
+
25
+ #define memcached_string_length(A) (size_t)((A)->end - (A)->string)
26
+ #define memcached_string_set_length(A, B) (A)->end= (A)->string + B
27
+ #define memcached_string_size(A) (A)->current_size
28
+ #define memcached_string_value(A) (A)->string
29
+
30
+ LIBMEMCACHED_API
31
+ memcached_string_st *memcached_string_create(memcached_st *ptr,
32
+ memcached_string_st *string,
33
+ size_t initial_size);
34
+ LIBMEMCACHED_API
35
+ memcached_return memcached_string_check(memcached_string_st *string, size_t need);
36
+ LIBMEMCACHED_API
37
+ char *memcached_string_c_copy(memcached_string_st *string);
38
+ LIBMEMCACHED_API
39
+ memcached_return memcached_string_append_character(memcached_string_st *string,
40
+ char character);
41
+ LIBMEMCACHED_API
42
+ memcached_return memcached_string_append(memcached_string_st *string,
43
+ const char *value, size_t length);
44
+ LIBMEMCACHED_API
45
+ memcached_return memcached_string_reset(memcached_string_st *string);
46
+ LIBMEMCACHED_API
47
+ void memcached_string_free(memcached_string_st *string);
48
+
49
+ #ifdef __cplusplus
50
+ }
51
+ #endif
52
+
53
+ #endif /* __MEMCACHED_STRING_H__ */
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Summary: Typpes for libmemcached
3
+ *
4
+ * Copy: See Copyright for the status of this software.
5
+ *
6
+ * Author: Brian Aker
7
+ */
8
+
9
+ #ifndef __MEMCACHED_TYPES_H__
10
+ #define __MEMCACHED_TYPES_H__
11
+
12
+ #ifdef __cplusplus
13
+ extern "C" {
14
+ #endif
15
+
16
+ typedef struct memcached_st memcached_st;
17
+ typedef struct memcached_stat_st memcached_stat_st;
18
+ typedef struct memcached_analysis_st memcached_analysis_st;
19
+ typedef struct memcached_result_st memcached_result_st;
20
+ typedef struct memcached_string_st memcached_string_st;
21
+ typedef struct memcached_server_st memcached_server_st;
22
+ typedef struct memcached_continuum_item_st memcached_continuum_item_st;
23
+ typedef memcached_return (*memcached_clone_func)(memcached_st *parent, memcached_st *clone);
24
+ typedef memcached_return (*memcached_cleanup_func)(memcached_st *ptr);
25
+ typedef void (*memcached_free_function)(memcached_st *ptr, void *mem);
26
+ typedef void *(*memcached_malloc_function)(memcached_st *ptr, const size_t size);
27
+ typedef void *(*memcached_realloc_function)(memcached_st *ptr, void *mem, const size_t size);
28
+ typedef void *(*memcached_calloc_function)(memcached_st *ptr, size_t nelem, const size_t elsize);
29
+ typedef memcached_return (*memcached_execute_function)(memcached_st *ptr, memcached_result_st *result, void *context);
30
+ typedef memcached_return (*memcached_server_function)(memcached_st *ptr, memcached_server_st *server, void *context);
31
+ typedef memcached_return (*memcached_trigger_key)(memcached_st *ptr,
32
+ const char *key, size_t key_length,
33
+ memcached_result_st *result);
34
+ typedef memcached_return (*memcached_trigger_delete_key)(memcached_st *ptr,
35
+ const char *key, size_t key_length);
36
+
37
+ typedef memcached_return (*memcached_dump_func)(memcached_st *ptr,
38
+ const char *key, size_t key_length, void *context);
39
+
40
+ #ifdef __cplusplus
41
+ }
42
+ #endif
43
+
44
+ #endif /* __MEMCACHED_TYPES_H__ */
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Summary: interface for libmemcached utility library
3
+ * Description: main include file for libmemcachedutil
4
+ *
5
+ * Copy: See Copyright for the status of this software.
6
+ *
7
+ * Author: Trond Norbye
8
+ */
9
+
10
+ #ifndef MEMCACHED_UTIL_H
11
+ #define MEMCACHED_UTIL_H
12
+
13
+ #include <libmemcached/memcached_pool.h>
14
+
15
+ #endif /* MEMCACHED_UTIL_H */