nutcracker 0.2.3 → 0.2.4.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (296) hide show
  1. data/README.md +53 -5
  2. data/Rakefile +14 -19
  3. data/bin/nutcracker +6 -1
  4. data/ext/nutcracker/ChangeLog +9 -0
  5. data/ext/nutcracker/LICENSE +0 -0
  6. data/ext/nutcracker/Makefile +643 -0
  7. data/ext/nutcracker/Makefile.am +0 -0
  8. data/ext/nutcracker/Makefile.in +66 -149
  9. data/ext/nutcracker/NOTICE +0 -0
  10. data/ext/nutcracker/README.md +13 -11
  11. data/ext/nutcracker/aclocal.m4 +112 -201
  12. data/ext/nutcracker/autom4te.cache/output.0 +18664 -0
  13. data/ext/nutcracker/autom4te.cache/output.1 +18664 -0
  14. data/ext/nutcracker/autom4te.cache/output.2 +18664 -0
  15. data/ext/nutcracker/autom4te.cache/requests +494 -0
  16. data/ext/nutcracker/autom4te.cache/traces.0 +2415 -0
  17. data/ext/nutcracker/autom4te.cache/traces.1 +945 -0
  18. data/ext/nutcracker/autom4te.cache/traces.2 +2415 -0
  19. data/ext/nutcracker/conf/nutcracker.leaf.yml +0 -0
  20. data/ext/nutcracker/conf/nutcracker.root.yml +0 -0
  21. data/ext/nutcracker/conf/nutcracker.yml +0 -0
  22. data/ext/nutcracker/config.h +332 -0
  23. data/ext/nutcracker/config.h.in +15 -0
  24. data/ext/nutcracker/config.log +2684 -0
  25. data/ext/nutcracker/config.status +2317 -0
  26. data/ext/nutcracker/config/config.guess +23 -84
  27. data/ext/nutcracker/config/config.sub +23 -93
  28. data/ext/nutcracker/config/depcomp +35 -81
  29. data/ext/nutcracker/config/install-sh +109 -122
  30. data/ext/nutcracker/config/ltmain.sh +1053 -721
  31. data/ext/nutcracker/config/missing +20 -29
  32. data/ext/nutcracker/configure +2122 -2320
  33. data/ext/nutcracker/configure.ac +35 -3
  34. data/ext/nutcracker/contrib/Makefile +494 -0
  35. data/ext/nutcracker/contrib/Makefile.am +0 -0
  36. data/ext/nutcracker/contrib/Makefile.in +41 -107
  37. data/ext/nutcracker/contrib/yaml-0.1.4.tar.gz +0 -0
  38. data/ext/nutcracker/contrib/yaml-0.1.4/Makefile +736 -0
  39. data/ext/nutcracker/contrib/yaml-0.1.4/autom4te.cache/output.0 +13102 -0
  40. data/ext/nutcracker/contrib/yaml-0.1.4/autom4te.cache/output.1 +13085 -0
  41. data/ext/nutcracker/contrib/yaml-0.1.4/autom4te.cache/output.2 +13085 -0
  42. data/ext/nutcracker/contrib/yaml-0.1.4/autom4te.cache/requests +476 -0
  43. data/ext/nutcracker/contrib/yaml-0.1.4/autom4te.cache/traces.0 +2339 -0
  44. data/ext/nutcracker/contrib/yaml-0.1.4/autom4te.cache/traces.1 +545 -0
  45. data/ext/nutcracker/contrib/yaml-0.1.4/autom4te.cache/traces.2 +2339 -0
  46. data/ext/nutcracker/contrib/yaml-0.1.4/config.h +81 -0
  47. data/ext/nutcracker/contrib/yaml-0.1.4/config.h.in~ +80 -0
  48. data/ext/nutcracker/contrib/yaml-0.1.4/config.log +688 -0
  49. data/ext/nutcracker/contrib/yaml-0.1.4/config.status +2032 -0
  50. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/annotated.html +51 -0
  51. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/bc_s.png +0 -0
  52. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/classes.html +41 -0
  53. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/closed.png +0 -0
  54. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/doxygen.css +656 -0
  55. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/doxygen.png +0 -0
  56. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/files.html +40 -0
  57. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions.html +91 -0
  58. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x62.html +84 -0
  59. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x63.html +87 -0
  60. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x64.html +83 -0
  61. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x65.html +110 -0
  62. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x66.html +79 -0
  63. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x68.html +80 -0
  64. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x69.html +92 -0
  65. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x6b.html +71 -0
  66. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x6c.html +88 -0
  67. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x6d.html +96 -0
  68. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x6e.html +71 -0
  69. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x6f.html +80 -0
  70. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x70.html +100 -0
  71. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x71.html +71 -0
  72. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x72.html +87 -0
  73. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x73.html +163 -0
  74. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x74.html +115 -0
  75. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x75.html +71 -0
  76. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x76.html +80 -0
  77. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_0x77.html +77 -0
  78. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars.html +91 -0
  79. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x62.html +84 -0
  80. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x63.html +87 -0
  81. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x64.html +83 -0
  82. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x65.html +110 -0
  83. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x66.html +79 -0
  84. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x68.html +80 -0
  85. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x69.html +92 -0
  86. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x6b.html +71 -0
  87. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x6c.html +88 -0
  88. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x6d.html +96 -0
  89. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x6e.html +71 -0
  90. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x6f.html +80 -0
  91. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x70.html +100 -0
  92. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x71.html +71 -0
  93. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x72.html +87 -0
  94. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x73.html +163 -0
  95. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x74.html +115 -0
  96. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x75.html +71 -0
  97. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x76.html +80 -0
  98. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/functions_vars_0x77.html +77 -0
  99. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/globals.html +667 -0
  100. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/globals_defs.html +81 -0
  101. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/globals_enum.html +78 -0
  102. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/globals_eval.html +373 -0
  103. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/globals_func.html +196 -0
  104. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/globals_type.html +126 -0
  105. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/group__basic.html +320 -0
  106. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/group__emitter.html +819 -0
  107. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/group__events.html +664 -0
  108. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/group__export.html +60 -0
  109. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/group__nodes.html +795 -0
  110. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/group__parser.html +606 -0
  111. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/group__styles.html +222 -0
  112. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/group__tokens.html +246 -0
  113. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/group__version.html +106 -0
  114. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/index.html +31 -0
  115. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/modules.html +42 -0
  116. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/nav_f.png +0 -0
  117. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/nav_h.png +0 -0
  118. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/open.png +0 -0
  119. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/structyaml__alias__data__s.html +108 -0
  120. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/structyaml__document__s.html +235 -0
  121. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/structyaml__emitter__s.html +1300 -0
  122. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/structyaml__event__s.html +496 -0
  123. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/structyaml__mark__s.html +108 -0
  124. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/structyaml__node__pair__s.html +91 -0
  125. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/structyaml__node__s.html +420 -0
  126. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/structyaml__parser__s.html +1229 -0
  127. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/structyaml__simple__key__s.html +97 -0
  128. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/structyaml__tag__directive__s.html +91 -0
  129. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/structyaml__token__s.html +413 -0
  130. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/structyaml__version__directive__s.html +91 -0
  131. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/tab_a.png +0 -0
  132. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/tab_b.png +0 -0
  133. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/tab_h.png +0 -0
  134. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/tab_s.png +0 -0
  135. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/tabs.css +59 -0
  136. data/ext/nutcracker/contrib/yaml-0.1.4/doc/html/yaml_8h.html +525 -0
  137. data/ext/nutcracker/contrib/yaml-0.1.4/include/Makefile.am +17 -0
  138. data/ext/nutcracker/contrib/yaml-0.1.4/include/Makefile.in +470 -0
  139. data/ext/nutcracker/contrib/yaml-0.1.4/libtool +8890 -0
  140. data/ext/nutcracker/contrib/yaml-0.1.4/src/Makefile +484 -0
  141. data/ext/nutcracker/contrib/yaml-0.1.4/src/api.lo +12 -0
  142. data/ext/nutcracker/contrib/yaml-0.1.4/src/api.o +0 -0
  143. data/ext/nutcracker/contrib/yaml-0.1.4/src/dumper.lo +12 -0
  144. data/ext/nutcracker/contrib/yaml-0.1.4/src/dumper.o +0 -0
  145. data/ext/nutcracker/contrib/yaml-0.1.4/src/emitter.lo +12 -0
  146. data/ext/nutcracker/contrib/yaml-0.1.4/src/emitter.o +0 -0
  147. data/ext/nutcracker/contrib/yaml-0.1.4/src/libyaml.la +41 -0
  148. data/ext/nutcracker/contrib/yaml-0.1.4/src/loader.lo +12 -0
  149. data/ext/nutcracker/contrib/yaml-0.1.4/src/loader.o +0 -0
  150. data/ext/nutcracker/contrib/yaml-0.1.4/src/parser.lo +12 -0
  151. data/ext/nutcracker/contrib/yaml-0.1.4/src/parser.o +0 -0
  152. data/ext/nutcracker/contrib/yaml-0.1.4/src/reader.lo +12 -0
  153. data/ext/nutcracker/contrib/yaml-0.1.4/src/reader.o +0 -0
  154. data/ext/nutcracker/contrib/yaml-0.1.4/src/scanner.lo +12 -0
  155. data/ext/nutcracker/contrib/yaml-0.1.4/src/scanner.o +0 -0
  156. data/ext/nutcracker/contrib/yaml-0.1.4/src/writer.lo +12 -0
  157. data/ext/nutcracker/contrib/yaml-0.1.4/src/writer.o +0 -0
  158. data/ext/nutcracker/contrib/yaml-0.1.4/stamp-h1 +1 -0
  159. data/ext/nutcracker/contrib/yaml-0.1.4/tests/Makefile +675 -0
  160. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-deconstructor +0 -0
  161. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-deconstructor-alt +0 -0
  162. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-deconstructor-alt.o +0 -0
  163. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-deconstructor.o +0 -0
  164. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-reformatter +0 -0
  165. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-reformatter-alt +0 -0
  166. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-reformatter-alt.o +0 -0
  167. data/ext/nutcracker/contrib/yaml-0.1.4/tests/example-reformatter.o +0 -0
  168. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-dumper +0 -0
  169. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-dumper.o +0 -0
  170. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-emitter +0 -0
  171. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-emitter.o +0 -0
  172. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-loader +0 -0
  173. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-loader.o +0 -0
  174. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-parser +0 -0
  175. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-parser.o +0 -0
  176. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-scanner +0 -0
  177. data/ext/nutcracker/contrib/yaml-0.1.4/tests/run-scanner.o +0 -0
  178. data/ext/nutcracker/contrib/yaml-0.1.4/yaml-0.1.pc +10 -0
  179. data/ext/nutcracker/contrib/yaml-0.1.4/yaml-0.1.pc.in +10 -0
  180. data/ext/nutcracker/extconf.rb +0 -5
  181. data/ext/nutcracker/libtool +9403 -0
  182. data/ext/nutcracker/m4/libtool.m4 +553 -492
  183. data/ext/nutcracker/m4/ltoptions.m4 +7 -6
  184. data/ext/nutcracker/m4/ltversion.m4 +5 -5
  185. data/ext/nutcracker/m4/lt~obsolete.m4 +9 -3
  186. data/ext/nutcracker/notes/c-styleguide.txt +0 -0
  187. data/ext/nutcracker/notes/debug.txt +0 -0
  188. data/ext/nutcracker/notes/memcache.txt +0 -0
  189. data/ext/nutcracker/notes/recommendation.md +21 -2
  190. data/ext/nutcracker/notes/redis.md +9 -9
  191. data/ext/nutcracker/notes/socket.txt +0 -0
  192. data/ext/nutcracker/scripts/nutcracker.init +0 -0
  193. data/ext/nutcracker/scripts/nutcracker.spec +0 -0
  194. data/ext/nutcracker/scripts/redis-check.py +0 -0
  195. data/ext/nutcracker/scripts/redis-check.sh +9 -0
  196. data/ext/nutcracker/src/Makefile +647 -0
  197. data/ext/nutcracker/src/Makefile.am +1 -1
  198. data/ext/nutcracker/src/Makefile.in +74 -153
  199. data/ext/nutcracker/src/hashkit/Makefile +476 -0
  200. data/ext/nutcracker/src/hashkit/Makefile.am +1 -0
  201. data/ext/nutcracker/src/hashkit/Makefile.in +39 -64
  202. data/ext/nutcracker/src/hashkit/libhashkit.a +0 -0
  203. data/ext/nutcracker/src/hashkit/nc_crc16.c +66 -0
  204. data/ext/nutcracker/src/hashkit/nc_crc16.o +0 -0
  205. data/ext/nutcracker/src/hashkit/nc_crc32.c +0 -0
  206. data/ext/nutcracker/src/hashkit/nc_crc32.o +0 -0
  207. data/ext/nutcracker/src/hashkit/nc_fnv.c +0 -0
  208. data/ext/nutcracker/src/hashkit/nc_fnv.o +0 -0
  209. data/ext/nutcracker/src/hashkit/nc_hashkit.h +2 -0
  210. data/ext/nutcracker/src/hashkit/nc_hsieh.c +0 -0
  211. data/ext/nutcracker/src/hashkit/nc_hsieh.o +0 -0
  212. data/ext/nutcracker/src/hashkit/nc_jenkins.c +0 -0
  213. data/ext/nutcracker/src/hashkit/nc_jenkins.o +0 -0
  214. data/ext/nutcracker/src/hashkit/nc_ketama.c +0 -0
  215. data/ext/nutcracker/src/hashkit/nc_ketama.o +0 -0
  216. data/ext/nutcracker/src/hashkit/nc_md5.c +0 -0
  217. data/ext/nutcracker/src/hashkit/nc_md5.o +0 -0
  218. data/ext/nutcracker/src/hashkit/nc_modula.c +18 -6
  219. data/ext/nutcracker/src/hashkit/nc_modula.o +0 -0
  220. data/ext/nutcracker/src/hashkit/nc_murmur.c +0 -0
  221. data/ext/nutcracker/src/hashkit/nc_murmur.o +0 -0
  222. data/ext/nutcracker/src/hashkit/nc_one_at_a_time.c +0 -0
  223. data/ext/nutcracker/src/hashkit/nc_one_at_a_time.o +0 -0
  224. data/ext/nutcracker/src/hashkit/nc_random.c +0 -0
  225. data/ext/nutcracker/src/hashkit/nc_random.o +0 -0
  226. data/ext/nutcracker/src/nc.c +0 -0
  227. data/ext/nutcracker/src/nc.o +0 -0
  228. data/ext/nutcracker/src/nc_array.c +0 -0
  229. data/ext/nutcracker/src/nc_array.h +0 -0
  230. data/ext/nutcracker/src/nc_array.o +0 -0
  231. data/ext/nutcracker/src/nc_client.c +0 -0
  232. data/ext/nutcracker/src/nc_client.h +0 -0
  233. data/ext/nutcracker/src/nc_client.o +0 -0
  234. data/ext/nutcracker/src/nc_conf.c +14 -35
  235. data/ext/nutcracker/src/nc_conf.h +1 -1
  236. data/ext/nutcracker/src/nc_conf.o +0 -0
  237. data/ext/nutcracker/src/nc_connection.c +0 -0
  238. data/ext/nutcracker/src/nc_connection.h +0 -0
  239. data/ext/nutcracker/src/nc_connection.o +0 -0
  240. data/ext/nutcracker/src/nc_core.c +29 -26
  241. data/ext/nutcracker/src/nc_core.h +13 -5
  242. data/ext/nutcracker/src/nc_core.o +0 -0
  243. data/ext/nutcracker/src/{nc_event.c → nc_epoll.c} +94 -30
  244. data/ext/nutcracker/src/nc_epoll.o +0 -0
  245. data/ext/nutcracker/src/nc_event.h +33 -13
  246. data/ext/nutcracker/src/nc_kqueue.c +296 -0
  247. data/ext/nutcracker/src/nc_kqueue.o +0 -0
  248. data/ext/nutcracker/src/nc_log.c +0 -0
  249. data/ext/nutcracker/src/nc_log.h +0 -0
  250. data/ext/nutcracker/src/nc_log.o +0 -0
  251. data/ext/nutcracker/src/nc_mbuf.c +0 -0
  252. data/ext/nutcracker/src/nc_mbuf.h +0 -0
  253. data/ext/nutcracker/src/nc_mbuf.o +0 -0
  254. data/ext/nutcracker/src/nc_message.c +0 -0
  255. data/ext/nutcracker/src/nc_message.h +2 -0
  256. data/ext/nutcracker/src/nc_message.o +0 -0
  257. data/ext/nutcracker/src/nc_proxy.c +8 -8
  258. data/ext/nutcracker/src/nc_proxy.h +0 -0
  259. data/ext/nutcracker/src/nc_proxy.o +0 -0
  260. data/ext/nutcracker/src/nc_queue.h +0 -0
  261. data/ext/nutcracker/src/nc_rbtree.c +0 -0
  262. data/ext/nutcracker/src/nc_rbtree.h +0 -0
  263. data/ext/nutcracker/src/nc_rbtree.o +0 -0
  264. data/ext/nutcracker/src/nc_request.c +3 -3
  265. data/ext/nutcracker/src/nc_request.o +0 -0
  266. data/ext/nutcracker/src/nc_response.c +4 -6
  267. data/ext/nutcracker/src/nc_response.o +0 -0
  268. data/ext/nutcracker/src/nc_server.c +14 -12
  269. data/ext/nutcracker/src/nc_server.h +0 -0
  270. data/ext/nutcracker/src/nc_server.o +0 -0
  271. data/ext/nutcracker/src/nc_signal.c +0 -0
  272. data/ext/nutcracker/src/nc_signal.h +0 -0
  273. data/ext/nutcracker/src/nc_signal.o +0 -0
  274. data/ext/nutcracker/src/nc_stats.c +16 -21
  275. data/ext/nutcracker/src/nc_stats.h +3 -4
  276. data/ext/nutcracker/src/nc_stats.o +0 -0
  277. data/ext/nutcracker/src/nc_string.c +0 -0
  278. data/ext/nutcracker/src/nc_string.h +0 -0
  279. data/ext/nutcracker/src/nc_string.o +0 -0
  280. data/ext/nutcracker/src/nc_util.c +16 -0
  281. data/ext/nutcracker/src/nc_util.h +1 -0
  282. data/ext/nutcracker/src/nc_util.o +0 -0
  283. data/ext/nutcracker/src/nutcracker +0 -0
  284. data/ext/nutcracker/src/proto/Makefile +454 -0
  285. data/ext/nutcracker/src/proto/Makefile.am +0 -0
  286. data/ext/nutcracker/src/proto/Makefile.in +32 -60
  287. data/ext/nutcracker/src/proto/libproto.a +0 -0
  288. data/ext/nutcracker/src/proto/nc_memcache.c +0 -0
  289. data/ext/nutcracker/src/proto/nc_memcache.o +0 -0
  290. data/ext/nutcracker/src/proto/nc_proto.h +0 -0
  291. data/ext/nutcracker/src/proto/nc_redis.c +17 -4
  292. data/ext/nutcracker/src/proto/nc_redis.o +0 -0
  293. data/ext/nutcracker/stamp-h1 +1 -0
  294. data/lib/nutcracker.rb +64 -2
  295. data/lib/nutcracker/version.rb +1 -1
  296. metadata +237 -9
Binary file
@@ -20,20 +20,40 @@
20
20
 
21
21
  #include <nc_core.h>
22
22
 
23
- /*
24
- * A hint to the kernel that is used to size the event backing store
25
- * of a given epoll instance
26
- */
27
- #define EVENT_SIZE_HINT 1024
23
+ #define NC_EVENT_SIZE 1024
24
+ #define EV_READ 0xff
25
+ #define EV_WRITE 0xff00
26
+ #define EV_ERR 0xff0000
28
27
 
29
- int event_init(struct context *ctx, int size);
30
- void event_deinit(struct context *ctx);
28
+ #ifdef NC_HAVE_KQUEUE
29
+ struct evbase {
30
+ int kq;
31
+ struct kevent *changes; /* list of changes to be made */
32
+ struct kevent *kevents; /* list of events returned from kevent */
33
+ int n_changes; /* number of changes in our list */
34
+ int n_returned; /* number of events returned from kevent */
35
+ int n_processed;
36
+ int nevent;
37
+ void (*callback_fp)(void *, uint32_t);
38
+ };
39
+ #endif
40
+ #ifdef NC_HAVE_EPOLL
41
+ struct evbase {
42
+ int ep;
43
+ int nevent;
44
+ struct epoll_event *event;
45
+ void (*callback_fp)(void *, uint32_t);
46
+ };
47
+ #endif
31
48
 
32
- int event_add_out(int ep, struct conn *c);
33
- int event_del_out(int ep, struct conn *c);
34
- int event_add_conn(int ep, struct conn *c);
35
- int event_del_conn(int ep, struct conn *c);
49
+ struct evbase *evbase_create(int size, void (*callback_fp)(void *, uint32_t));
50
+ void evbase_destroy(struct evbase *evb);
36
51
 
37
- int event_wait(int ep, struct epoll_event *event, int nevent, int timeout);
52
+ int event_add_out(struct evbase *evb, struct conn *c);
53
+ int event_del_out(struct evbase *evb, struct conn *c);
54
+ int event_add_conn(struct evbase *evb, struct conn *c);
55
+ int event_del_conn(struct evbase *evb, struct conn *c);
56
+ int event_wait(struct evbase *evb, int timeout);
57
+ int event_add_st(struct evbase *evb, int fd);
38
58
 
39
- #endif
59
+ #endif /* _NC_EVENT_H */
@@ -0,0 +1,296 @@
1
+ /*
2
+ * twemproxy - A fast and lightweight proxy for memcached protocol.
3
+ * Copyright (C) 2011 Twitter, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+
19
+ #include <unistd.h>
20
+ #include <nc_core.h>
21
+ #include <nc_event.h>
22
+
23
+ #ifdef NC_HAVE_KQUEUE
24
+ #include <sys/event.h>
25
+
26
+ struct evbase *
27
+ evbase_create(int nevent, void (*callback_fp)(void *, uint32_t))
28
+ {
29
+
30
+ struct evbase *evb;
31
+ int status, kq;
32
+ struct kevent *changes, *kevents;
33
+
34
+ if (nevent <= 0) {
35
+ log_error("nevent has to be positive %d", nevent);
36
+ return NULL;
37
+ }
38
+
39
+ /* Initialize the kernel queue */
40
+ if ((kq = kqueue()) == -1) {
41
+ log_error("kernel queue create failed: %s", kq, strerror(errno));
42
+ return NULL;
43
+ }
44
+
45
+ changes = nc_calloc(nevent, sizeof(*changes));
46
+ if (changes == NULL) {
47
+ status = close(kq);
48
+ if (status < 0) {
49
+ log_error("close kq %d failed, ignored: %s", kq, strerror(errno));
50
+ }
51
+ return NULL;
52
+ }
53
+
54
+ kevents = nc_calloc(nevent, sizeof(*kevents));
55
+ if (kevents == NULL) {
56
+ nc_free(changes);
57
+ status = close(kq);
58
+ if (status < 0) {
59
+ log_error("close kq %d failed, ignored: %s", kq, strerror(errno));
60
+ }
61
+ return NULL;
62
+ }
63
+
64
+ evb = (struct evbase *) nc_alloc(sizeof(*evb));
65
+ if (evb == NULL) {
66
+ nc_free(changes);
67
+ nc_free(kevents);
68
+ status = close(kq);
69
+ if (status < 0) {
70
+ log_error("close kq %d failed, ignored: %s", kq, strerror(errno));
71
+ }
72
+ return NULL;
73
+ }
74
+
75
+ evb->kq = kq;
76
+ evb->changes = changes;
77
+ evb->kevents = kevents;
78
+ evb->nevent = nevent;
79
+ evb->callback_fp = callback_fp;
80
+ evb->n_changes = 0;
81
+
82
+ log_debug(LOG_INFO, "kq %d with nevent %d", evb->kq,
83
+ evb->nevent);
84
+
85
+ return evb;
86
+ }
87
+
88
+ void
89
+ evbase_destroy(struct evbase *evb)
90
+ {
91
+ int status;
92
+
93
+ if (evb == NULL) return;
94
+
95
+ ASSERT(evb->kq >= 0);
96
+
97
+ nc_free(evb->changes);
98
+ nc_free(evb->kevents);
99
+
100
+ status = close(evb->kq);
101
+ if (status < 0) {
102
+ log_error("close kq %d failed, ignored: %s", evb->kq, strerror(errno));
103
+ }
104
+ nc_free(evb);
105
+ }
106
+
107
+ int
108
+ event_add_out(struct evbase *evb, struct conn *c)
109
+ {
110
+ struct kevent *event;
111
+ int kq = evb->kq;
112
+
113
+ ASSERT(kq > 0);
114
+ ASSERT(c != NULL);
115
+ ASSERT(c->sd > 0);
116
+ ASSERT(c->recv_active);
117
+ ASSERT(evb->n_changes < evb->nevent);
118
+
119
+ if (c->send_active) {
120
+ return 0;
121
+ }
122
+
123
+ event = &evb->changes[(evb->n_changes)++];
124
+ EV_SET(event, c->sd, EVFILT_WRITE, EV_ADD | EV_CLEAR, 0, 0, (void *)c);
125
+
126
+ c->send_active = 1;
127
+
128
+ return 0;
129
+ }
130
+
131
+ int
132
+ event_del_out(struct evbase *evb, struct conn *c)
133
+ {
134
+ struct kevent *event;
135
+ int kq = evb->kq;
136
+
137
+ ASSERT(kq > 0);
138
+ ASSERT(c != NULL);
139
+ ASSERT(c->sd > 0);
140
+ ASSERT(c->recv_active);
141
+ ASSERT(evb->n_changes < evb->nevent);
142
+
143
+ if (!c->send_active) {
144
+ return 0;
145
+ }
146
+
147
+ event = &evb->changes[(evb->n_changes)++];
148
+ EV_SET(event, c->sd, EVFILT_WRITE, EV_DELETE, 0, 0, (void *)c);
149
+
150
+ c->send_active = 0;
151
+
152
+ return 0;
153
+ }
154
+
155
+ int
156
+ event_add_conn(struct evbase *evb, struct conn *c)
157
+ {
158
+ struct kevent *event;
159
+ int kq = evb->kq;
160
+
161
+ ASSERT(kq > 0);
162
+ ASSERT(c != NULL);
163
+ ASSERT(c->sd > 0);
164
+ ASSERT(evb->n_changes < evb->nevent);
165
+
166
+ event = &evb->changes[(evb->n_changes)++];
167
+ EV_SET(event, c->sd, EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, (void *)c);
168
+
169
+ c->recv_active = 1;
170
+
171
+ event_add_out(evb, c);
172
+ c->send_active = 1;
173
+
174
+ return 0;
175
+ }
176
+
177
+ int
178
+ event_del_conn(struct evbase *evb, struct conn *c)
179
+ {
180
+ int i;
181
+ struct kevent *event;
182
+ int kq = evb->kq;
183
+
184
+ ASSERT(kq > 0);
185
+ ASSERT(c != NULL);
186
+ ASSERT(c->sd > 0);
187
+ ASSERT(evb->n_changes < evb->nevent);
188
+
189
+ event = &evb->changes[(evb->n_changes)++];
190
+ EV_SET(event, c->sd, EVFILT_READ, EV_DELETE, 0, 0, (void *)c);
191
+
192
+ event_del_out(evb, c);
193
+
194
+ c->recv_active = 0;
195
+ c->send_active = 0;
196
+
197
+ /*
198
+ * Now, eliminate pending events for c->sd (there should be at most one
199
+ * other event). This is important because we will close c->sd and free
200
+ * c when we return.
201
+ */
202
+ for (i = evb->n_processed + 1; i < evb->n_returned; i++) {
203
+ struct kevent *ev = &evb->kevents[i];
204
+ if (ev->ident == (uintptr_t)c->sd) {
205
+ ev->flags = 0;
206
+ ev->filter = 0;
207
+ break;
208
+ }
209
+ }
210
+
211
+ return 0;
212
+ }
213
+
214
+ int
215
+ event_wait(struct evbase *evb, int timeout)
216
+ {
217
+ int kq = evb->kq;
218
+ struct timespec ts = nc_millisec_to_timespec(timeout);
219
+ void (*callback_fp)(void *, uint32_t) = evb->callback_fp;
220
+
221
+ ASSERT(kq > 0);
222
+
223
+ for (;;) {
224
+ evb->n_returned = kevent(kq, evb->changes, evb->n_changes, evb->kevents,
225
+ evb->nevent, &ts);
226
+ evb->n_changes = 0;
227
+ if (evb->n_returned > 0) {
228
+ for (evb->n_processed = 0; evb->n_processed < evb->n_returned;
229
+ evb->n_processed++) {
230
+ struct kevent *ev = &evb->kevents[evb->n_processed];
231
+
232
+ uint32_t evflags = 0;
233
+ if (ev->flags & EV_ERROR) {
234
+ /*
235
+ * Error messages that can happen, when a delete fails.
236
+ * EBADF happens when the file descriptor has been
237
+ * closed,
238
+ * ENOENT when the file descriptor was closed and
239
+ * then reopened.
240
+ * EINVAL for some reasons not understood; EINVAL
241
+ * should not be returned ever; but FreeBSD does :-\
242
+ * An error is also indicated when a callback deletes
243
+ * an event we are still processing. In that case
244
+ * the data field is set to ENOENT.
245
+ */
246
+ if (ev->data == EBADF ||
247
+ ev->data == EINVAL ||
248
+ ev->data == ENOENT)
249
+ continue;
250
+ evflags |= EV_ERR;
251
+ }
252
+
253
+ if (ev->filter == EVFILT_READ)
254
+ evflags |= EV_READ;
255
+
256
+ if (ev->filter == EVFILT_WRITE)
257
+ evflags |= EV_WRITE;
258
+
259
+ if (callback_fp != NULL && evflags != 0)
260
+ (*callback_fp)((void *)(ev->udata), evflags);
261
+ }
262
+ return evb->n_returned;
263
+ }
264
+
265
+ if (evb->n_returned == 0) {
266
+ if (timeout == -1) {
267
+ log_error("kqueue on kq %d with %d events and %d timeout "
268
+ "returned no events", kq, evb->nevent, timeout);
269
+ return -1;
270
+ }
271
+
272
+ return 0;
273
+ }
274
+
275
+ if (errno == EINTR) {
276
+ continue;
277
+ }
278
+
279
+ log_error("kevent on kq %d with %d events failed: %s", kq, evb->nevent,
280
+ strerror(errno));
281
+
282
+ return -1;
283
+ }
284
+ NOT_REACHED();
285
+ }
286
+
287
+ int
288
+ event_add_st(struct evbase *evb, int fd)
289
+ {
290
+ struct kevent *ev = &evb->changes[(evb->n_changes)++];
291
+ EV_SET(ev, fd, EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, NULL);
292
+
293
+ return 0;
294
+ }
295
+
296
+ #endif /* NC_HAVE_KQUEUE */
Binary file
File without changes
File without changes
Binary file
File without changes
File without changes
Binary file
File without changes
@@ -71,6 +71,7 @@ typedef enum msg_type {
71
71
  MSG_REQ_REDIS_BITCOUNT,
72
72
  MSG_REQ_REDIS_DECR,
73
73
  MSG_REQ_REDIS_DECRBY,
74
+ MSG_REQ_REDIS_DUMP,
74
75
  MSG_REQ_REDIS_GET,
75
76
  MSG_REQ_REDIS_GETBIT,
76
77
  MSG_REQ_REDIS_GETRANGE,
@@ -80,6 +81,7 @@ typedef enum msg_type {
80
81
  MSG_REQ_REDIS_INCRBYFLOAT,
81
82
  MSG_REQ_REDIS_MGET,
82
83
  MSG_REQ_REDIS_PSETEX,
84
+ MSG_REQ_REDIS_RESTORE,
83
85
  MSG_REQ_REDIS_SET,
84
86
  MSG_REQ_REDIS_SETBIT,
85
87
  MSG_REQ_REDIS_SETEX,
Binary file
@@ -163,18 +163,18 @@ proxy_listen(struct context *ctx, struct conn *p)
163
163
  return NC_ERROR;
164
164
  }
165
165
 
166
- status = event_add_conn(ctx->ep, p);
166
+ status = event_add_conn(ctx->evb, p);
167
167
  if (status < 0) {
168
- log_error("event add conn e %d p %d on addr '%.*s' failed: %s",
169
- ctx->ep, p->sd, pool->addrstr.len, pool->addrstr.data,
168
+ log_error("event add conn p %d on addr '%.*s' failed: %s",
169
+ p->sd, pool->addrstr.len, pool->addrstr.data,
170
170
  strerror(errno));
171
171
  return NC_ERROR;
172
172
  }
173
173
 
174
- status = event_del_out(ctx->ep, p);
174
+ status = event_del_out(ctx->evb, p);
175
175
  if (status < 0) {
176
- log_error("event del out e %d p %d on addr '%.*s' failed: %s",
177
- ctx->ep, p->sd, pool->addrstr.len, pool->addrstr.data,
176
+ log_error("event del out p %d on addr '%.*s' failed: %s",
177
+ p->sd, pool->addrstr.len, pool->addrstr.data,
178
178
  strerror(errno));
179
179
  return NC_ERROR;
180
180
  }
@@ -325,9 +325,9 @@ proxy_accept(struct context *ctx, struct conn *p)
325
325
  }
326
326
  }
327
327
 
328
- status = event_add_conn(ctx->ep, c);
328
+ status = event_add_conn(ctx->evb, c);
329
329
  if (status < 0) {
330
- log_error("event add conn of c %d from p %d failed: %s", c->sd, p->sd,
330
+ log_error("event add conn from p %d failed: %s", p->sd,
331
331
  strerror(errno));
332
332
  c->close(ctx, c);
333
333
  return status;
File without changes
Binary file
File without changes
File without changes
File without changes
Binary file
@@ -413,7 +413,7 @@ req_forward_error(struct context *ctx, struct conn *conn, struct msg *msg)
413
413
  }
414
414
 
415
415
  if (req_done(conn, TAILQ_FIRST(&conn->omsg_q))) {
416
- status = event_add_out(ctx->ep, conn);
416
+ status = event_add_out(ctx->evb, conn);
417
417
  if (status != NC_OK) {
418
418
  conn->err = errno;
419
419
  }
@@ -482,7 +482,7 @@ req_forward(struct context *ctx, struct conn *c_conn, struct msg *msg)
482
482
 
483
483
  /* enqueue the message (request) into server inq */
484
484
  if (TAILQ_EMPTY(&s_conn->imsg_q)) {
485
- status = event_add_out(ctx->ep, s_conn);
485
+ status = event_add_out(ctx->evb, s_conn);
486
486
  if (status != NC_OK) {
487
487
  req_forward_error(ctx, c_conn, msg);
488
488
  s_conn->err = errno;
@@ -533,7 +533,7 @@ req_send_next(struct context *ctx, struct conn *conn)
533
533
  nmsg = TAILQ_FIRST(&conn->imsg_q);
534
534
  if (nmsg == NULL) {
535
535
  /* nothing to send as the server inq is empty */
536
- status = event_del_out(ctx->ep, conn);
536
+ status = event_del_out(ctx->evb, conn);
537
537
  if (status != NC_OK) {
538
538
  conn->err = errno;
539
539
  }