memcached 1.2.6 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,152 @@
1
+ /*
2
+ Memcached library
3
+ */
4
+ #include "common.h"
5
+
6
+ memcached_st *memcached_create(memcached_st *ptr)
7
+ {
8
+ memcached_result_st *result_ptr;
9
+
10
+ if (ptr == NULL)
11
+ {
12
+ ptr= (memcached_st *)calloc(1, sizeof(memcached_st));
13
+
14
+ if (!ptr)
15
+ return NULL; /* MEMCACHED_MEMORY_ALLOCATION_FAILURE */
16
+
17
+ ptr->is_allocated= true;
18
+ }
19
+ else
20
+ {
21
+ memset(ptr, 0, sizeof(memcached_st));
22
+ }
23
+
24
+ memcached_set_memory_allocators(ptr, NULL, NULL, NULL, NULL);
25
+
26
+ result_ptr= memcached_result_create(ptr, &ptr->result);
27
+ WATCHPOINT_ASSERT(result_ptr);
28
+ ptr->poll_timeout= MEMCACHED_DEFAULT_TIMEOUT;
29
+ ptr->connect_timeout= MEMCACHED_DEFAULT_TIMEOUT;
30
+ ptr->retry_timeout= 0;
31
+ ptr->distribution= MEMCACHED_DISTRIBUTION_MODULA;
32
+
33
+ /* TODO, Document why we picked these defaults */
34
+ ptr->io_msg_watermark= 500;
35
+ ptr->io_bytes_watermark= 65 * 1024;
36
+
37
+ return ptr;
38
+ }
39
+
40
+ void memcached_free(memcached_st *ptr)
41
+ {
42
+ /* If we have anything open, lets close it now */
43
+ memcached_quit(ptr);
44
+ server_list_free(ptr, ptr->hosts);
45
+ memcached_result_free(&ptr->result);
46
+
47
+ if (ptr->on_cleanup)
48
+ ptr->on_cleanup(ptr);
49
+
50
+ if (ptr->continuum)
51
+ ptr->call_free(ptr, ptr->continuum);
52
+
53
+ if (ptr->live_host_indices)
54
+ ptr->call_free(ptr, ptr->live_host_indices);
55
+
56
+ if (ptr->is_allocated)
57
+ ptr->call_free(ptr, ptr);
58
+ else
59
+ memset(ptr, 0, sizeof(memcached_st));
60
+ }
61
+
62
+ /*
63
+ clone is the destination, while source is the structure to clone.
64
+ If source is NULL the call is the same as if a memcached_create() was
65
+ called.
66
+ */
67
+ memcached_st *memcached_clone(memcached_st *clone, memcached_st *source)
68
+ {
69
+ memcached_return rc= MEMCACHED_SUCCESS;
70
+ memcached_st *new_clone;
71
+
72
+ if (source == NULL)
73
+ return memcached_create(clone);
74
+
75
+ if (clone && clone->is_allocated)
76
+ {
77
+ return NULL;
78
+ }
79
+
80
+ new_clone= memcached_create(clone);
81
+
82
+ if (new_clone == NULL)
83
+ return NULL;
84
+
85
+ new_clone->flags= source->flags;
86
+ new_clone->send_size= source->send_size;
87
+ new_clone->recv_size= source->recv_size;
88
+ new_clone->poll_timeout= source->poll_timeout;
89
+ new_clone->connect_timeout= source->connect_timeout;
90
+ new_clone->retry_timeout= source->retry_timeout;
91
+ new_clone->distribution= source->distribution;
92
+ new_clone->hash= source->hash;
93
+ new_clone->hash_continuum= source->hash_continuum;
94
+ new_clone->user_data= source->user_data;
95
+
96
+ new_clone->snd_timeout= source->snd_timeout;
97
+ new_clone->rcv_timeout= source->rcv_timeout;
98
+
99
+ new_clone->on_clone= source->on_clone;
100
+ new_clone->on_cleanup= source->on_cleanup;
101
+ new_clone->call_free= source->call_free;
102
+ new_clone->call_malloc= source->call_malloc;
103
+ new_clone->call_realloc= source->call_realloc;
104
+ new_clone->call_calloc= source->call_calloc;
105
+ new_clone->get_key_failure= source->get_key_failure;
106
+ new_clone->delete_trigger= source->delete_trigger;
107
+ new_clone->server_failure_limit= source->server_failure_limit;
108
+ new_clone->io_msg_watermark= source->io_msg_watermark;
109
+ new_clone->io_bytes_watermark= source->io_bytes_watermark;
110
+ new_clone->io_key_prefetch= source->io_key_prefetch;
111
+
112
+ if (source->hosts)
113
+ rc= memcached_server_push(new_clone, source->hosts);
114
+
115
+ if (rc != MEMCACHED_SUCCESS)
116
+ {
117
+ memcached_free(new_clone);
118
+
119
+ return NULL;
120
+ }
121
+
122
+
123
+ if (source->prefix_key[0] != 0)
124
+ {
125
+ strcpy(new_clone->prefix_key, source->prefix_key);
126
+ new_clone->prefix_key_length= source->prefix_key_length;
127
+ }
128
+
129
+ rc= run_distribution(new_clone);
130
+ if (rc != MEMCACHED_SUCCESS)
131
+ {
132
+ memcached_free(new_clone);
133
+
134
+ return NULL;
135
+ }
136
+
137
+ if (source->on_clone)
138
+ source->on_clone(source, new_clone);
139
+
140
+ return new_clone;
141
+ }
142
+ void *memcached_get_user_data(memcached_st *ptr)
143
+ {
144
+ return ptr->user_data;
145
+ }
146
+
147
+ void *memcached_set_user_data(memcached_st *ptr, void *data)
148
+ {
149
+ void *ret= ptr->user_data;
150
+ ptr->user_data= data;
151
+ return ret;
152
+ }
@@ -0,0 +1,302 @@
1
+ /*
2
+ * Summary: interface for memcached server
3
+ * Description: main include file for libmemcached
4
+ *
5
+ * Copy: See Copyright for the status of this software.
6
+ *
7
+ * Author: Brian Aker
8
+ */
9
+
10
+ #ifndef LIBMEMCACHED_MEMCACHED_H
11
+ #define LIBMEMCACHED_MEMCACHED_H
12
+
13
+ #include <stdlib.h>
14
+ #include <inttypes.h>
15
+ #if !defined(__cplusplus)
16
+ # include <stdbool.h>
17
+ #endif
18
+ #include <sys/types.h>
19
+ #include <netinet/in.h>
20
+
21
+ #include <libmemcached/visibility.h>
22
+ #include <libmemcached/memcached_configure.h>
23
+ #include <libmemcached/memcached_constants.h>
24
+ #include <libmemcached/memcached_types.h>
25
+ #include <libmemcached/memcached_get.h>
26
+ #include <libmemcached/memcached_server.h>
27
+ #include <libmemcached/memcached_string.h>
28
+ #include <libmemcached/memcached_result.h>
29
+ #include <libmemcached/memcached_storage.h>
30
+ #include <libmemcached/memcached_sasl.h>
31
+
32
+ #ifdef __cplusplus
33
+ extern "C" {
34
+ #endif
35
+
36
+ #define MEMCACHED_VERSION_STRING_LENGTH 24
37
+ #define LIBMEMCACHED_VERSION_STRING "0.32"
38
+
39
+ struct memcached_analysis_st {
40
+ uint32_t average_item_size;
41
+ uint32_t longest_uptime;
42
+ uint32_t least_free_server;
43
+ uint32_t most_consumed_server;
44
+ uint32_t oldest_server;
45
+ double pool_hit_ratio;
46
+ uint64_t most_used_bytes;
47
+ uint64_t least_remaining_bytes;
48
+ };
49
+
50
+ struct memcached_stat_st {
51
+ uint32_t connection_structures;
52
+ uint32_t curr_connections;
53
+ uint32_t curr_items;
54
+ uint32_t pid;
55
+ uint32_t pointer_size;
56
+ uint32_t rusage_system_microseconds;
57
+ uint32_t rusage_system_seconds;
58
+ uint32_t rusage_user_microseconds;
59
+ uint32_t rusage_user_seconds;
60
+ uint32_t threads;
61
+ uint32_t time;
62
+ uint32_t total_connections;
63
+ uint32_t total_items;
64
+ uint32_t uptime;
65
+ uint64_t bytes;
66
+ uint64_t bytes_read;
67
+ uint64_t bytes_written;
68
+ uint64_t cmd_get;
69
+ uint64_t cmd_set;
70
+ uint64_t evictions;
71
+ uint64_t get_hits;
72
+ uint64_t get_misses;
73
+ uint64_t limit_maxbytes;
74
+ char version[MEMCACHED_VERSION_STRING_LENGTH];
75
+ };
76
+
77
+ struct memcached_st {
78
+ uint8_t purging;
79
+ bool is_allocated;
80
+ uint8_t distribution;
81
+ uint8_t hash;
82
+ uint32_t continuum_points_counter;
83
+ memcached_server_st *hosts;
84
+ int32_t snd_timeout;
85
+ int32_t rcv_timeout;
86
+ uint32_t server_failure_limit;
87
+ uint32_t io_msg_watermark;
88
+ uint32_t io_bytes_watermark;
89
+ uint32_t io_key_prefetch;
90
+ uint32_t number_of_hosts;
91
+ uint32_t cursor_server;
92
+ int cached_errno;
93
+ uint32_t flags;
94
+ int32_t poll_timeout;
95
+ int32_t connect_timeout;
96
+ int32_t retry_timeout;
97
+ uint32_t continuum_count;
98
+ int send_size;
99
+ int recv_size;
100
+ void *user_data;
101
+ time_t next_distribution_rebuild;
102
+ size_t prefix_key_length;
103
+ memcached_hash hash_continuum;
104
+ memcached_result_st result;
105
+ memcached_continuum_item_st *continuum;
106
+ memcached_clone_func on_clone;
107
+ memcached_cleanup_func on_cleanup;
108
+ memcached_free_function call_free;
109
+ memcached_malloc_function call_malloc;
110
+ memcached_realloc_function call_realloc;
111
+ memcached_calloc_function call_calloc;
112
+ memcached_trigger_key get_key_failure;
113
+ memcached_trigger_delete_key delete_trigger;
114
+ char prefix_key[MEMCACHED_PREFIX_KEY_MAX_SIZE];
115
+ uint32_t number_of_live_hosts;
116
+ uint32_t *live_host_indices;
117
+ uint32_t live_host_indices_size;
118
+ #ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
119
+ const sasl_callback_t *sasl_callbacks;
120
+ #endif
121
+ int last_server_key;
122
+ };
123
+
124
+ LIBMEMCACHED_API
125
+ memcached_return memcached_version(memcached_st *ptr);
126
+
127
+ /* Public API */
128
+
129
+ LIBMEMCACHED_API
130
+ const char * memcached_lib_version(void);
131
+
132
+ LIBMEMCACHED_API
133
+ memcached_st *memcached_create(memcached_st *ptr);
134
+ LIBMEMCACHED_API
135
+ void memcached_free(memcached_st *ptr);
136
+ LIBMEMCACHED_API
137
+ memcached_st *memcached_clone(memcached_st *clone, memcached_st *ptr);
138
+
139
+ LIBMEMCACHED_API
140
+ memcached_return memcached_delete(memcached_st *ptr, const char *key, size_t key_length,
141
+ time_t expiration);
142
+ LIBMEMCACHED_API
143
+ memcached_return memcached_increment(memcached_st *ptr,
144
+ const char *key, size_t key_length,
145
+ uint32_t offset,
146
+ uint64_t *value);
147
+ LIBMEMCACHED_API
148
+ memcached_return memcached_decrement(memcached_st *ptr,
149
+ const char *key, size_t key_length,
150
+ uint32_t offset,
151
+ uint64_t *value);
152
+ LIBMEMCACHED_API
153
+ memcached_return memcached_increment_with_initial(memcached_st *ptr,
154
+ const char *key,
155
+ size_t key_length,
156
+ uint64_t offset,
157
+ uint64_t initial,
158
+ time_t expiration,
159
+ uint64_t *value);
160
+ LIBMEMCACHED_API
161
+ memcached_return memcached_decrement_with_initial(memcached_st *ptr,
162
+ const char *key,
163
+ size_t key_length,
164
+ uint64_t offset,
165
+ uint64_t initial,
166
+ time_t expiration,
167
+ uint64_t *value);
168
+ LIBMEMCACHED_API
169
+ void memcached_stat_free(memcached_st *, memcached_stat_st *);
170
+ LIBMEMCACHED_API
171
+ memcached_stat_st *memcached_stat(memcached_st *ptr, char *args, memcached_return *error);
172
+ LIBMEMCACHED_API
173
+ memcached_return memcached_stat_servername(memcached_stat_st *memc_stat, char *args,
174
+ char *hostname, unsigned int port);
175
+ LIBMEMCACHED_API
176
+ memcached_return memcached_flush(memcached_st *ptr, time_t expiration);
177
+ LIBMEMCACHED_API
178
+ memcached_return memcached_verbosity(memcached_st *ptr, unsigned int verbosity);
179
+ LIBMEMCACHED_API
180
+ void memcached_quit(memcached_st *ptr);
181
+ LIBMEMCACHED_API
182
+ const char *memcached_strerror(memcached_st *ptr, memcached_return rc);
183
+ LIBMEMCACHED_API
184
+ memcached_return memcached_behavior_set(memcached_st *ptr, memcached_behavior flag, uint64_t data);
185
+ LIBMEMCACHED_API
186
+ uint64_t memcached_behavior_get(memcached_st *ptr, memcached_behavior flag);
187
+
188
+ /* The two public hash bits */
189
+ LIBMEMCACHED_API
190
+ uint32_t memcached_generate_hash_value(const char *key, size_t key_length, memcached_hash hash_algorithm);
191
+ LIBMEMCACHED_API
192
+ uint32_t memcached_generate_hash(memcached_st *ptr, const char *key, size_t key_length);
193
+
194
+ LIBMEMCACHED_API
195
+ memcached_return memcached_flush_buffers(memcached_st *mem);
196
+
197
+ /* Server Public functions */
198
+
199
+ LIBMEMCACHED_API
200
+ memcached_return memcached_server_add_udp(memcached_st *ptr,
201
+ const char *hostname,
202
+ unsigned int port);
203
+ LIBMEMCACHED_API
204
+ memcached_return memcached_server_add_unix_socket(memcached_st *ptr,
205
+ const char *filename);
206
+ LIBMEMCACHED_API
207
+ memcached_return memcached_server_add(memcached_st *ptr, const char *hostname,
208
+ unsigned int port);
209
+
210
+ LIBMEMCACHED_API
211
+ memcached_return memcached_server_add_udp_with_weight(memcached_st *ptr,
212
+ const char *hostname,
213
+ unsigned int port,
214
+ uint32_t weight);
215
+ LIBMEMCACHED_API
216
+ memcached_return memcached_server_add_unix_socket_with_weight(memcached_st *ptr,
217
+ const char *filename,
218
+ uint32_t weight);
219
+ LIBMEMCACHED_API
220
+ memcached_return memcached_server_add_with_weight(memcached_st *ptr, const char *hostname,
221
+ unsigned int port,
222
+ uint32_t weight);
223
+ LIBMEMCACHED_API
224
+ void memcached_server_list_free(memcached_server_st *ptr);
225
+ LIBMEMCACHED_API
226
+ memcached_return memcached_server_push(memcached_st *ptr, memcached_server_st *list);
227
+
228
+ LIBMEMCACHED_API
229
+ memcached_server_st *memcached_server_list_append(memcached_server_st *ptr,
230
+ const char *hostname,
231
+ unsigned int port,
232
+ memcached_return *error);
233
+ LIBMEMCACHED_API
234
+ memcached_server_st *memcached_server_list_append_with_weight(memcached_server_st *ptr,
235
+ const char *hostname,
236
+ unsigned int port,
237
+ uint32_t weight,
238
+ memcached_return *error);
239
+ LIBMEMCACHED_API
240
+ unsigned int memcached_server_list_count(memcached_server_st *ptr);
241
+ LIBMEMCACHED_API
242
+ memcached_server_st *memcached_servers_parse(const char *server_strings);
243
+
244
+ LIBMEMCACHED_API
245
+ char *memcached_stat_get_value(memcached_st *ptr, memcached_stat_st *memc_stat,
246
+ const char *key, memcached_return *error);
247
+ LIBMEMCACHED_API
248
+ char ** memcached_stat_get_keys(memcached_st *ptr, memcached_stat_st *memc_stat,
249
+ memcached_return *error);
250
+
251
+ LIBMEMCACHED_API
252
+ memcached_return memcached_delete_by_key(memcached_st *ptr,
253
+ const char *master_key, size_t master_key_length,
254
+ const char *key, size_t key_length,
255
+ time_t expiration);
256
+
257
+ LIBMEMCACHED_API
258
+ memcached_return memcached_fetch_execute(memcached_st *ptr,
259
+ memcached_execute_function *callback,
260
+ void *context,
261
+ unsigned int number_of_callbacks);
262
+
263
+ LIBMEMCACHED_API
264
+ memcached_return memcached_callback_set(memcached_st *ptr,
265
+ memcached_callback flag,
266
+ void *data);
267
+ LIBMEMCACHED_API
268
+ void *memcached_callback_get(memcached_st *ptr,
269
+ memcached_callback flag,
270
+ memcached_return *error);
271
+
272
+ LIBMEMCACHED_API
273
+ memcached_return memcached_dump(memcached_st *ptr, memcached_dump_func *function, void *context, uint32_t number_of_callbacks);
274
+
275
+
276
+ LIBMEMCACHED_API
277
+ memcached_return memcached_set_memory_allocators(memcached_st *ptr,
278
+ memcached_malloc_function mem_malloc,
279
+ memcached_free_function mem_free,
280
+ memcached_realloc_function mem_realloc,
281
+ memcached_calloc_function mem_calloc);
282
+
283
+ LIBMEMCACHED_API
284
+ void memcached_get_memory_allocators(memcached_st *ptr,
285
+ memcached_malloc_function *mem_malloc,
286
+ memcached_free_function *mem_free,
287
+ memcached_realloc_function *mem_realloc,
288
+ memcached_calloc_function *mem_calloc);
289
+
290
+ LIBMEMCACHED_API
291
+ void *memcached_get_user_data(memcached_st *ptr);
292
+ LIBMEMCACHED_API
293
+ void *memcached_set_user_data(memcached_st *ptr, void *data);
294
+
295
+ LIBMEMCACHED_API
296
+ memcached_return run_distribution(memcached_st *ptr);
297
+ #ifdef __cplusplus
298
+ }
299
+ #endif
300
+
301
+
302
+ #endif /* LIBMEMCACHED_MEMCACHED_H */