heroku-tokyotyrant 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (340) hide show
  1. data/COPYING +504 -0
  2. data/README.rdoc +231 -0
  3. data/Rakefile +72 -0
  4. data/benchmarks/balancer.rb +101 -0
  5. data/benchmarks/bulk_db.rb +74 -0
  6. data/benchmarks/bulk_table.rb +87 -0
  7. data/benchmarks/db.rb +114 -0
  8. data/benchmarks/table.rb +161 -0
  9. data/ext/extconf.rb +43 -0
  10. data/ext/tokyo/bin/tcamgr +0 -0
  11. data/ext/tokyo/bin/tcamttest +0 -0
  12. data/ext/tokyo/bin/tcatest +0 -0
  13. data/ext/tokyo/bin/tcbmgr +0 -0
  14. data/ext/tokyo/bin/tcbmttest +0 -0
  15. data/ext/tokyo/bin/tcbtest +0 -0
  16. data/ext/tokyo/bin/tcfmgr +0 -0
  17. data/ext/tokyo/bin/tcfmttest +0 -0
  18. data/ext/tokyo/bin/tcftest +0 -0
  19. data/ext/tokyo/bin/tchmgr +0 -0
  20. data/ext/tokyo/bin/tchmttest +0 -0
  21. data/ext/tokyo/bin/tchtest +0 -0
  22. data/ext/tokyo/bin/tcrmgr +0 -0
  23. data/ext/tokyo/bin/tcrmttest +0 -0
  24. data/ext/tokyo/bin/tcrtest +0 -0
  25. data/ext/tokyo/bin/tctmgr +0 -0
  26. data/ext/tokyo/bin/tctmttest +0 -0
  27. data/ext/tokyo/bin/tcttest +0 -0
  28. data/ext/tokyo/bin/tcucodec +0 -0
  29. data/ext/tokyo/bin/tcumttest +0 -0
  30. data/ext/tokyo/bin/tcutest +0 -0
  31. data/ext/tokyo/bin/ttserver +0 -0
  32. data/ext/tokyo/bin/ttulmgr +0 -0
  33. data/ext/tokyo/bin/ttultest +0 -0
  34. data/ext/tokyo/include/tcadb.h +548 -0
  35. data/ext/tokyo/include/tcbdb.h +1101 -0
  36. data/ext/tokyo/include/tcfdb.h +858 -0
  37. data/ext/tokyo/include/tchdb.h +871 -0
  38. data/ext/tokyo/include/tcrdb.h +801 -0
  39. data/ext/tokyo/include/tctdb.h +1086 -0
  40. data/ext/tokyo/include/tculog.h +392 -0
  41. data/ext/tokyo/include/tcutil.h +4184 -0
  42. data/ext/tokyo/include/ttutil.h +494 -0
  43. data/ext/tokyo/lib/libtokyocabinet.9.4.0.dylib +0 -0
  44. data/ext/tokyo/lib/libtokyocabinet.9.dylib +0 -0
  45. data/ext/tokyo/lib/libtokyocabinet.a +0 -0
  46. data/ext/tokyo/lib/libtokyocabinet.dylib +0 -0
  47. data/ext/tokyo/lib/libtokyotyrant.3.22.0.dylib +0 -0
  48. data/ext/tokyo/lib/libtokyotyrant.3.dylib +0 -0
  49. data/ext/tokyo/lib/libtokyotyrant.a +0 -0
  50. data/ext/tokyo/lib/libtokyotyrant.dylib +0 -0
  51. data/ext/tokyo/lib/pkgconfig/tokyocabinet.pc +14 -0
  52. data/ext/tokyo/lib/pkgconfig/tokyotyrant.pc +14 -0
  53. data/ext/tokyo/lib/ttskeldir.bundle +0 -0
  54. data/ext/tokyo/lib/ttskelmock.bundle +0 -0
  55. data/ext/tokyo/lib/ttskelnull.bundle +0 -0
  56. data/ext/tokyo/lib/ttskelproxy.bundle +0 -0
  57. data/ext/tokyo/libexec/tcawmgr.cgi +0 -0
  58. data/ext/tokyo/sbin/ttservctl +163 -0
  59. data/ext/tokyo/share/man/man1/tcamgr.1 +97 -0
  60. data/ext/tokyo/share/man/man1/tcamttest.1 +35 -0
  61. data/ext/tokyo/share/man/man1/tcatest.1 +55 -0
  62. data/ext/tokyo/share/man/man1/tcbmgr.1 +125 -0
  63. data/ext/tokyo/share/man/man1/tcbmttest.1 +81 -0
  64. data/ext/tokyo/share/man/man1/tcbtest.1 +107 -0
  65. data/ext/tokyo/share/man/man1/tcfmgr.1 +98 -0
  66. data/ext/tokyo/share/man/man1/tcfmttest.1 +62 -0
  67. data/ext/tokyo/share/man/man1/tcftest.1 +73 -0
  68. data/ext/tokyo/share/man/man1/tchmgr.1 +110 -0
  69. data/ext/tokyo/share/man/man1/tchmttest.1 +85 -0
  70. data/ext/tokyo/share/man/man1/tchtest.1 +95 -0
  71. data/ext/tokyo/share/man/man1/tcrmgr.1 +164 -0
  72. data/ext/tokyo/share/man/man1/tcrmttest.1 +55 -0
  73. data/ext/tokyo/share/man/man1/tcrtest.1 +89 -0
  74. data/ext/tokyo/share/man/man1/tctmgr.1 +140 -0
  75. data/ext/tokyo/share/man/man1/tctmttest.1 +92 -0
  76. data/ext/tokyo/share/man/man1/tcttest.1 +105 -0
  77. data/ext/tokyo/share/man/man1/tcucodec.1 +162 -0
  78. data/ext/tokyo/share/man/man1/tcumttest.1 +41 -0
  79. data/ext/tokyo/share/man/man1/tcutest.1 +81 -0
  80. data/ext/tokyo/share/man/man1/ttserver.1 +84 -0
  81. data/ext/tokyo/share/man/man1/ttulmgr.1 +40 -0
  82. data/ext/tokyo/share/man/man1/ttultest.1 +16 -0
  83. data/ext/tokyo/share/man/man3/tcadb.3 +676 -0
  84. data/ext/tokyo/share/man/man3/tcbdb.3 +1355 -0
  85. data/ext/tokyo/share/man/man3/tcfdb.3 +975 -0
  86. data/ext/tokyo/share/man/man3/tchdb.3 +898 -0
  87. data/ext/tokyo/share/man/man3/tclist.3 +1 -0
  88. data/ext/tokyo/share/man/man3/tcmap.3 +1 -0
  89. data/ext/tokyo/share/man/man3/tcmdb.3 +1 -0
  90. data/ext/tokyo/share/man/man3/tcmpool.3 +1 -0
  91. data/ext/tokyo/share/man/man3/tcrdb.3 +1309 -0
  92. data/ext/tokyo/share/man/man3/tctdb.3 +1110 -0
  93. data/ext/tokyo/share/man/man3/tctree.3 +1 -0
  94. data/ext/tokyo/share/man/man3/tculog.3 +15 -0
  95. data/ext/tokyo/share/man/man3/tcutil.3 +4518 -0
  96. data/ext/tokyo/share/man/man3/tcxstr.3 +1 -0
  97. data/ext/tokyo/share/man/man3/tokyocabinet.3 +132 -0
  98. data/ext/tokyo/share/man/man3/ttutil.3 +14 -0
  99. data/ext/tokyo/share/man/man8/ttservctl.8 +37 -0
  100. data/ext/tokyo/share/tokyocabinet/COPYING +504 -0
  101. data/ext/tokyo/share/tokyocabinet/ChangeLog +1252 -0
  102. data/ext/tokyo/share/tokyocabinet/THANKS +12 -0
  103. data/ext/tokyo/share/tokyocabinet/doc/benchmark.pdf +0 -0
  104. data/ext/tokyo/share/tokyocabinet/doc/common.css +211 -0
  105. data/ext/tokyo/share/tokyocabinet/doc/icon16.png +0 -0
  106. data/ext/tokyo/share/tokyocabinet/doc/index.html +156 -0
  107. data/ext/tokyo/share/tokyocabinet/doc/index.ja.html +197 -0
  108. data/ext/tokyo/share/tokyocabinet/doc/logo-ja.png +0 -0
  109. data/ext/tokyo/share/tokyocabinet/doc/logo.png +0 -0
  110. data/ext/tokyo/share/tokyocabinet/doc/spex-en.html +7145 -0
  111. data/ext/tokyo/share/tokyocabinet/doc/spex-ja.html +7476 -0
  112. data/ext/tokyo/share/tokyocabinet/doc/tokyoproducts.pdf +0 -0
  113. data/ext/tokyo/share/tokyocabinet/doc/tokyoproducts.ppt +0 -0
  114. data/ext/tokyo/share/tokyotyrant/COPYING +504 -0
  115. data/ext/tokyo/share/tokyotyrant/ChangeLog +578 -0
  116. data/ext/tokyo/share/tokyotyrant/THANKS +15 -0
  117. data/ext/tokyo/share/tokyotyrant/doc/common.css +211 -0
  118. data/ext/tokyo/share/tokyotyrant/doc/index.html +79 -0
  119. data/ext/tokyo/share/tokyotyrant/doc/spex.html +2264 -0
  120. data/ext/tokyo/share/tokyotyrant/ext/mapreduce.lua +57 -0
  121. data/ext/tokyo/share/tokyotyrant/ext/queue.lua +55 -0
  122. data/ext/tokyo/share/tokyotyrant/ext/senatus.lua +532 -0
  123. data/ext/tokyo/share/tokyotyrant/ext/usherette.lua +438 -0
  124. data/ext/tokyo_tyrant.c +147 -0
  125. data/ext/tokyo_tyrant.h +48 -0
  126. data/ext/tokyo_tyrant_db.c +227 -0
  127. data/ext/tokyo_tyrant_db.h +8 -0
  128. data/ext/tokyo_tyrant_module.c +453 -0
  129. data/ext/tokyo_tyrant_module.h +10 -0
  130. data/ext/tokyo_tyrant_query.c +226 -0
  131. data/ext/tokyo_tyrant_query.h +9 -0
  132. data/ext/tokyo_tyrant_table.c +319 -0
  133. data/ext/tokyo_tyrant_table.h +8 -0
  134. data/ext/tokyocabinet-1.4.41/COPYING +504 -0
  135. data/ext/tokyocabinet-1.4.41/ChangeLog +1252 -0
  136. data/ext/tokyocabinet-1.4.41/Makefile.in +825 -0
  137. data/ext/tokyocabinet-1.4.41/README +38 -0
  138. data/ext/tokyocabinet-1.4.41/THANKS +12 -0
  139. data/ext/tokyocabinet-1.4.41/bros/Makefile +133 -0
  140. data/ext/tokyocabinet-1.4.41/bros/bdbtest.c +438 -0
  141. data/ext/tokyocabinet-1.4.41/bros/cdbtest.c +219 -0
  142. data/ext/tokyocabinet-1.4.41/bros/cmpsqltctest.c +186 -0
  143. data/ext/tokyocabinet-1.4.41/bros/gdbmtest.c +216 -0
  144. data/ext/tokyocabinet-1.4.41/bros/mapreporter +72 -0
  145. data/ext/tokyocabinet-1.4.41/bros/maptest.cc +677 -0
  146. data/ext/tokyocabinet-1.4.41/bros/ndbmtest.c +204 -0
  147. data/ext/tokyocabinet-1.4.41/bros/qdbmtest.c +375 -0
  148. data/ext/tokyocabinet-1.4.41/bros/reporter +141 -0
  149. data/ext/tokyocabinet-1.4.41/bros/result.xls +0 -0
  150. data/ext/tokyocabinet-1.4.41/bros/sdbmtest.c +204 -0
  151. data/ext/tokyocabinet-1.4.41/bros/sqltest.c +404 -0
  152. data/ext/tokyocabinet-1.4.41/bros/tctest.c +748 -0
  153. data/ext/tokyocabinet-1.4.41/bros/tdbtest.c +205 -0
  154. data/ext/tokyocabinet-1.4.41/configure +7402 -0
  155. data/ext/tokyocabinet-1.4.41/configure.in +362 -0
  156. data/ext/tokyocabinet-1.4.41/doc/benchmark.pdf +0 -0
  157. data/ext/tokyocabinet-1.4.41/doc/common.css +211 -0
  158. data/ext/tokyocabinet-1.4.41/doc/icon16.png +0 -0
  159. data/ext/tokyocabinet-1.4.41/doc/index.html +156 -0
  160. data/ext/tokyocabinet-1.4.41/doc/index.ja.html +197 -0
  161. data/ext/tokyocabinet-1.4.41/doc/logo-ja.png +0 -0
  162. data/ext/tokyocabinet-1.4.41/doc/logo.png +0 -0
  163. data/ext/tokyocabinet-1.4.41/doc/spex-en.html +7145 -0
  164. data/ext/tokyocabinet-1.4.41/doc/spex-ja.html +7476 -0
  165. data/ext/tokyocabinet-1.4.41/doc/tokyoproducts.pdf +0 -0
  166. data/ext/tokyocabinet-1.4.41/doc/tokyoproducts.ppt +0 -0
  167. data/ext/tokyocabinet-1.4.41/example/Makefile +113 -0
  168. data/ext/tokyocabinet-1.4.41/example/tcadbex.c +55 -0
  169. data/ext/tokyocabinet-1.4.41/example/tcbdbex.c +64 -0
  170. data/ext/tokyocabinet-1.4.41/example/tcfdbex.c +60 -0
  171. data/ext/tokyocabinet-1.4.41/example/tchdbex.c +60 -0
  172. data/ext/tokyocabinet-1.4.41/example/tctchat.c +97 -0
  173. data/ext/tokyocabinet-1.4.41/example/tctchat.tmpl +141 -0
  174. data/ext/tokyocabinet-1.4.41/example/tctdbex.c +85 -0
  175. data/ext/tokyocabinet-1.4.41/example/tctsearch.c +95 -0
  176. data/ext/tokyocabinet-1.4.41/example/tctsearch.tmpl +122 -0
  177. data/ext/tokyocabinet-1.4.41/example/tcutilex.c +77 -0
  178. data/ext/tokyocabinet-1.4.41/f.tsv +2 -0
  179. data/ext/tokyocabinet-1.4.41/lab/calccomp +118 -0
  180. data/ext/tokyocabinet-1.4.41/lab/datechange +56 -0
  181. data/ext/tokyocabinet-1.4.41/lab/diffcheck +45 -0
  182. data/ext/tokyocabinet-1.4.41/lab/htmltotsv +102 -0
  183. data/ext/tokyocabinet-1.4.41/lab/magic +19 -0
  184. data/ext/tokyocabinet-1.4.41/lab/printenv.cgi +27 -0
  185. data/ext/tokyocabinet-1.4.41/lab/stepcount +26 -0
  186. data/ext/tokyocabinet-1.4.41/lab/stopwatch +61 -0
  187. data/ext/tokyocabinet-1.4.41/lab/tabcheck +43 -0
  188. data/ext/tokyocabinet-1.4.41/lab/wgettsv +239 -0
  189. data/ext/tokyocabinet-1.4.41/lab/widthcheck +57 -0
  190. data/ext/tokyocabinet-1.4.41/man/htmltoman +104 -0
  191. data/ext/tokyocabinet-1.4.41/man/tcadb.3 +676 -0
  192. data/ext/tokyocabinet-1.4.41/man/tcamgr.1 +97 -0
  193. data/ext/tokyocabinet-1.4.41/man/tcamttest.1 +35 -0
  194. data/ext/tokyocabinet-1.4.41/man/tcatest.1 +55 -0
  195. data/ext/tokyocabinet-1.4.41/man/tcbdb.3 +1355 -0
  196. data/ext/tokyocabinet-1.4.41/man/tcbmgr.1 +125 -0
  197. data/ext/tokyocabinet-1.4.41/man/tcbmttest.1 +81 -0
  198. data/ext/tokyocabinet-1.4.41/man/tcbtest.1 +107 -0
  199. data/ext/tokyocabinet-1.4.41/man/tcfdb.3 +975 -0
  200. data/ext/tokyocabinet-1.4.41/man/tcfmgr.1 +98 -0
  201. data/ext/tokyocabinet-1.4.41/man/tcfmttest.1 +62 -0
  202. data/ext/tokyocabinet-1.4.41/man/tcftest.1 +73 -0
  203. data/ext/tokyocabinet-1.4.41/man/tchdb.3 +898 -0
  204. data/ext/tokyocabinet-1.4.41/man/tchmgr.1 +110 -0
  205. data/ext/tokyocabinet-1.4.41/man/tchmttest.1 +85 -0
  206. data/ext/tokyocabinet-1.4.41/man/tchtest.1 +95 -0
  207. data/ext/tokyocabinet-1.4.41/man/tclist.3 +1 -0
  208. data/ext/tokyocabinet-1.4.41/man/tcmap.3 +1 -0
  209. data/ext/tokyocabinet-1.4.41/man/tcmdb.3 +1 -0
  210. data/ext/tokyocabinet-1.4.41/man/tcmpool.3 +1 -0
  211. data/ext/tokyocabinet-1.4.41/man/tctdb.3 +1110 -0
  212. data/ext/tokyocabinet-1.4.41/man/tctmgr.1 +140 -0
  213. data/ext/tokyocabinet-1.4.41/man/tctmttest.1 +92 -0
  214. data/ext/tokyocabinet-1.4.41/man/tctree.3 +1 -0
  215. data/ext/tokyocabinet-1.4.41/man/tcttest.1 +105 -0
  216. data/ext/tokyocabinet-1.4.41/man/tcucodec.1 +162 -0
  217. data/ext/tokyocabinet-1.4.41/man/tcumttest.1 +41 -0
  218. data/ext/tokyocabinet-1.4.41/man/tcutest.1 +81 -0
  219. data/ext/tokyocabinet-1.4.41/man/tcutil.3 +4518 -0
  220. data/ext/tokyocabinet-1.4.41/man/tcxstr.3 +1 -0
  221. data/ext/tokyocabinet-1.4.41/man/tokyocabinet.3 +132 -0
  222. data/ext/tokyocabinet-1.4.41/md5.c +381 -0
  223. data/ext/tokyocabinet-1.4.41/md5.h +101 -0
  224. data/ext/tokyocabinet-1.4.41/myconf.c +493 -0
  225. data/ext/tokyocabinet-1.4.41/myconf.h +549 -0
  226. data/ext/tokyocabinet-1.4.41/tcadb.c +4339 -0
  227. data/ext/tokyocabinet-1.4.41/tcadb.h +548 -0
  228. data/ext/tokyocabinet-1.4.41/tcamgr.c +1019 -0
  229. data/ext/tokyocabinet-1.4.41/tcamttest.c +542 -0
  230. data/ext/tokyocabinet-1.4.41/tcatest.c +1845 -0
  231. data/ext/tokyocabinet-1.4.41/tcawmgr.c +482 -0
  232. data/ext/tokyocabinet-1.4.41/tcbdb.c +4180 -0
  233. data/ext/tokyocabinet-1.4.41/tcbdb.h +1101 -0
  234. data/ext/tokyocabinet-1.4.41/tcbmgr.c +1012 -0
  235. data/ext/tokyocabinet-1.4.41/tcbmttest.c +1810 -0
  236. data/ext/tokyocabinet-1.4.41/tcbtest.c +2586 -0
  237. data/ext/tokyocabinet-1.4.41/tcfdb.c +2746 -0
  238. data/ext/tokyocabinet-1.4.41/tcfdb.h +858 -0
  239. data/ext/tokyocabinet-1.4.41/tcfmgr.c +786 -0
  240. data/ext/tokyocabinet-1.4.41/tcfmttest.c +1220 -0
  241. data/ext/tokyocabinet-1.4.41/tcftest.c +1695 -0
  242. data/ext/tokyocabinet-1.4.41/tchdb.c +5153 -0
  243. data/ext/tokyocabinet-1.4.41/tchdb.h +871 -0
  244. data/ext/tokyocabinet-1.4.41/tchmgr.c +842 -0
  245. data/ext/tokyocabinet-1.4.41/tchmttest.c +1757 -0
  246. data/ext/tokyocabinet-1.4.41/tchtest.c +2129 -0
  247. data/ext/tokyocabinet-1.4.41/tctdb.c +6199 -0
  248. data/ext/tokyocabinet-1.4.41/tctdb.h +1086 -0
  249. data/ext/tokyocabinet-1.4.41/tctmgr.c +1241 -0
  250. data/ext/tokyocabinet-1.4.41/tctmttest.c +1563 -0
  251. data/ext/tokyocabinet-1.4.41/tcttest.c +2062 -0
  252. data/ext/tokyocabinet-1.4.41/tcucodec.c +1357 -0
  253. data/ext/tokyocabinet-1.4.41/tcumttest.c +578 -0
  254. data/ext/tokyocabinet-1.4.41/tcutest.c +1875 -0
  255. data/ext/tokyocabinet-1.4.41/tcutil.c +10528 -0
  256. data/ext/tokyocabinet-1.4.41/tcutil.h +4184 -0
  257. data/ext/tokyocabinet-1.4.41/tokyocabinet.idl +336 -0
  258. data/ext/tokyocabinet-1.4.41/tokyocabinet.pc.in +14 -0
  259. data/ext/tokyotyrant-1.1.39/COPYING +504 -0
  260. data/ext/tokyotyrant-1.1.39/ChangeLog +578 -0
  261. data/ext/tokyotyrant-1.1.39/Makefile.in +365 -0
  262. data/ext/tokyotyrant-1.1.39/README +38 -0
  263. data/ext/tokyotyrant-1.1.39/THANKS +15 -0
  264. data/ext/tokyotyrant-1.1.39/configure +6979 -0
  265. data/ext/tokyotyrant-1.1.39/configure.in +300 -0
  266. data/ext/tokyotyrant-1.1.39/doc/common.css +211 -0
  267. data/ext/tokyotyrant-1.1.39/doc/index.html +79 -0
  268. data/ext/tokyotyrant-1.1.39/doc/spex.html +2264 -0
  269. data/ext/tokyotyrant-1.1.39/example/Makefile +68 -0
  270. data/ext/tokyotyrant-1.1.39/example/httptest.pl +88 -0
  271. data/ext/tokyotyrant-1.1.39/example/mcftest.pl +39 -0
  272. data/ext/tokyotyrant-1.1.39/example/mctest.pl +43 -0
  273. data/ext/tokyotyrant-1.1.39/example/tcrdbex +0 -0
  274. data/ext/tokyotyrant-1.1.39/example/tcrdbex.c +49 -0
  275. data/ext/tokyotyrant-1.1.39/example/tcrdbex.o +0 -0
  276. data/ext/tokyotyrant-1.1.39/example/tcrdbtblex +0 -0
  277. data/ext/tokyotyrant-1.1.39/example/tcrdbtblex.c +79 -0
  278. data/ext/tokyotyrant-1.1.39/example/tcrdbtblex.o +0 -0
  279. data/ext/tokyotyrant-1.1.39/ext/mapreduce.lua +57 -0
  280. data/ext/tokyotyrant-1.1.39/ext/queue.lua +55 -0
  281. data/ext/tokyotyrant-1.1.39/ext/senatus.lua +532 -0
  282. data/ext/tokyotyrant-1.1.39/ext/usherette.lua +438 -0
  283. data/ext/tokyotyrant-1.1.39/lab/datechange +56 -0
  284. data/ext/tokyotyrant-1.1.39/lab/diffcheck +45 -0
  285. data/ext/tokyotyrant-1.1.39/lab/fibonacci.lua +20 -0
  286. data/ext/tokyotyrant-1.1.39/lab/footprint.lua +67 -0
  287. data/ext/tokyotyrant-1.1.39/lab/highlow.lua +88 -0
  288. data/ext/tokyotyrant-1.1.39/lab/killdualmaster +12 -0
  289. data/ext/tokyotyrant-1.1.39/lab/rundualmaster +38 -0
  290. data/ext/tokyotyrant-1.1.39/lab/stepcount +26 -0
  291. data/ext/tokyotyrant-1.1.39/lab/tabcheck +43 -0
  292. data/ext/tokyotyrant-1.1.39/lab/ushrtregister.pl +55 -0
  293. data/ext/tokyotyrant-1.1.39/lab/widthcheck +57 -0
  294. data/ext/tokyotyrant-1.1.39/man/htmltoman +100 -0
  295. data/ext/tokyotyrant-1.1.39/man/tcrdb.3 +1309 -0
  296. data/ext/tokyotyrant-1.1.39/man/tcrmgr.1 +164 -0
  297. data/ext/tokyotyrant-1.1.39/man/tcrmttest.1 +55 -0
  298. data/ext/tokyotyrant-1.1.39/man/tcrtest.1 +89 -0
  299. data/ext/tokyotyrant-1.1.39/man/tculog.3 +15 -0
  300. data/ext/tokyotyrant-1.1.39/man/ttservctl.8 +37 -0
  301. data/ext/tokyotyrant-1.1.39/man/ttserver.1 +84 -0
  302. data/ext/tokyotyrant-1.1.39/man/ttulmgr.1 +40 -0
  303. data/ext/tokyotyrant-1.1.39/man/ttultest.1 +16 -0
  304. data/ext/tokyotyrant-1.1.39/man/ttutil.3 +14 -0
  305. data/ext/tokyotyrant-1.1.39/myconf.c +169 -0
  306. data/ext/tokyotyrant-1.1.39/myconf.h +408 -0
  307. data/ext/tokyotyrant-1.1.39/scrext.c +2394 -0
  308. data/ext/tokyotyrant-1.1.39/scrext.h +96 -0
  309. data/ext/tokyotyrant-1.1.39/tcrdb.c +2637 -0
  310. data/ext/tokyotyrant-1.1.39/tcrdb.h +801 -0
  311. data/ext/tokyotyrant-1.1.39/tcrmgr.c +1559 -0
  312. data/ext/tokyotyrant-1.1.39/tcrmttest.c +915 -0
  313. data/ext/tokyotyrant-1.1.39/tcrtest.c +1542 -0
  314. data/ext/tokyotyrant-1.1.39/tculog.c +1211 -0
  315. data/ext/tokyotyrant-1.1.39/tculog.h +392 -0
  316. data/ext/tokyotyrant-1.1.39/tokyotyrant.idl +143 -0
  317. data/ext/tokyotyrant-1.1.39/tokyotyrant.pc.in +14 -0
  318. data/ext/tokyotyrant-1.1.39/ttservctl +163 -0
  319. data/ext/tokyotyrant-1.1.39/ttserver.c +3583 -0
  320. data/ext/tokyotyrant-1.1.39/ttskeldir.c +141 -0
  321. data/ext/tokyotyrant-1.1.39/ttskelmock.c +64 -0
  322. data/ext/tokyotyrant-1.1.39/ttskelnull.c +79 -0
  323. data/ext/tokyotyrant-1.1.39/ttskelproxy.c +74 -0
  324. data/ext/tokyotyrant-1.1.39/ttulmgr.c +266 -0
  325. data/ext/tokyotyrant-1.1.39/ttultest.c +371 -0
  326. data/ext/tokyotyrant-1.1.39/ttutil.c +1510 -0
  327. data/ext/tokyotyrant-1.1.39/ttutil.h +494 -0
  328. data/lib/tokyo_tyrant/balancer.rb +189 -0
  329. data/spec/ext.lua +4 -0
  330. data/spec/plu_db.rb +538 -0
  331. data/spec/spec.rb +1 -0
  332. data/spec/spec_base.rb +17 -0
  333. data/spec/start_tyrants.sh +36 -0
  334. data/spec/stop_tyrants.sh +9 -0
  335. data/spec/tokyo_tyrant_balancer_db_spec.rb +160 -0
  336. data/spec/tokyo_tyrant_balancer_table_spec.rb +177 -0
  337. data/spec/tokyo_tyrant_query_spec.rb +159 -0
  338. data/spec/tokyo_tyrant_spec.rb +254 -0
  339. data/spec/tokyo_tyrant_table_spec.rb +301 -0
  340. metadata +402 -0
@@ -0,0 +1,254 @@
1
+ require 'pathname'
2
+ require Pathname(__FILE__).dirname.join('spec_base') unless $root
3
+
4
+ describe TokyoTyrant::DB, "with an open database" do
5
+
6
+ before do
7
+ @db = TokyoTyrant::DB.new('127.0.0.1', 45000)
8
+ @db.clear
9
+ end
10
+
11
+ it "should not be nil" do
12
+ @db.should.not.be.nil
13
+ end
14
+
15
+ it "should close" do
16
+ @db.close.should.be.true
17
+ begin
18
+ @db.close
19
+ rescue => e
20
+ e.message.should == 'close error: invalid operation'
21
+ end
22
+ end
23
+
24
+ it "should return a server expression" do
25
+ @db.server.should == '127.0.0.1:45000'
26
+ end
27
+
28
+ it "should optimize" do
29
+ @db.optimize.should.be.true
30
+ end
31
+
32
+ it "should save a value" do
33
+ @db[:salad] = 'bacon bits'
34
+ @db[:salad].should == 'bacon bits'
35
+ end
36
+
37
+ it "should return a value" do
38
+ @db[:salad] = 'bacon bits'
39
+ @db[:salad].should == 'bacon bits'
40
+ end
41
+
42
+ it "should accept binary data" do
43
+ s = "mango#{0.chr}salsa"
44
+ @db.put(s, s).should.be.true
45
+ @db[s].should.equal(s)
46
+ end
47
+
48
+ it "should save multiple values" do
49
+ h = { 'pizza' => 'old forge style',
50
+ 'sandwich' => 'peanut butter jelly',
51
+ 'yogurt' => 'greek',
52
+ 'coffee' => 'black' }
53
+ @db.mput(h).should.be.empty
54
+ h.each_pair do |k,v|
55
+ @db[k].should == v
56
+ end
57
+ end
58
+
59
+ it "should delete multiple values" do
60
+ h = { 'pizza' => 'old forge style',
61
+ 'sandwich' => 'peanut butter jelly',
62
+ 'yogurt' => 'greek',
63
+ 'coffee' => 'black' }
64
+ @db.mput(h)
65
+ @db.outlist('coffee', 'yogurt').should.be.empty
66
+ @db.keys.sort.should == ['pizza','sandwich']
67
+ end
68
+
69
+ it "should get multiple values" do
70
+ h = { 'pizza' => 'old forge style',
71
+ 'sandwich' => 'peanut butter jelly',
72
+ 'yogurt' => 'greek',
73
+ 'coffee' => 'black' }
74
+ @db.mput(h)
75
+ @db.mget(h.keys).should == h
76
+ end
77
+
78
+ it "should out a value" do
79
+ k = :tomato
80
+ @db[k] = 'green'
81
+ @db.out(k).should.be.true
82
+ @db[k].should.be.nil
83
+ @db.out(k).should.be.false
84
+ end
85
+
86
+ it "should get a value size" do
87
+ k = :cereal
88
+ v = 'granola'
89
+ @db[k] = v
90
+ @db.vsiz(k).should == v.size
91
+ end
92
+
93
+ it "should check a key" do
94
+ k = :fruit
95
+ @db[k] = 'banana'
96
+ @db.check(k).should.be.true
97
+ @db.out(k)
98
+ @db.check(k).should.be.false
99
+ end
100
+
101
+ it "should iterate" do
102
+ @db[:cheese] = 'gouda'
103
+ @db[:grapes] = 'green'
104
+ @db[:oranges] = 'florida'
105
+ @db[:crackers] = 'triscuit'
106
+
107
+ @db.iterinit.should.be.true
108
+ @db.iternext.should == 'cheese'
109
+ @db.iternext.should == 'grapes'
110
+ @db.iternext.should == 'oranges'
111
+ @db.iternext.should == 'crackers'
112
+ @db.iternext.should == nil
113
+ end
114
+
115
+ it "should get forward matching keys" do
116
+ @db['apples/royalgala'] = '4173'
117
+ @db['apples/grannysmith'] = '4139'
118
+ @db['bananas/yellow'] = '4011'
119
+ @db['oranges/shamouti'] = '3027'
120
+ @db['grapefruit/deepred'] = '4288'
121
+ @db.fwmkeys('apples').sort.should == ["apples/grannysmith", "apples/royalgala"]
122
+ end
123
+
124
+ it "should delete forward matching keys" do
125
+ @db['apples/royalgala'] = '4173'
126
+ @db['apples/grannysmith'] = '4139'
127
+ @db['bananas/yellow'] = '4011'
128
+ @db['oranges/shamouti'] = '3027'
129
+ @db['grapefruit/deepred'] = '4288'
130
+ @db.delete_keys_with_prefix('apples').should == nil
131
+ @db.fwmkeys('apples').should.be.empty
132
+ @db.keys.sort.should == ['bananas/yellow', 'grapefruit/deepred', 'oranges/shamouti']
133
+ end
134
+
135
+ it "should get all keys" do
136
+ keys = %w[appetizers entree dessert]
137
+ values = %w[chips chicken\ caeser\ salad ice\ cream]
138
+ keys.each_with_index do |k,i|
139
+ @db[k] = values[i]
140
+ end
141
+ @db.keys.should == keys
142
+ end
143
+
144
+ it "should get all values" do
145
+ keys = %w[appetizers entree dessert]
146
+ values = %w[chips chicken\ caeser\ salad ice\ cream]
147
+ keys.each_with_index do |k,i|
148
+ @db[k] = values[i]
149
+ end
150
+ @db.values.should == values
151
+ end
152
+
153
+ it "should vanish all records" do
154
+ @db['chocolate'] = 'dark'
155
+ @db['tea'] = 'earl grey'
156
+ @db.empty?.should.be.false
157
+ @db.vanish.should.be.true
158
+ @db.empty?.should.be.true
159
+ end
160
+
161
+ it "should count records" do
162
+ @db['hummus'] = 'chickpeas'
163
+ @db['falafel'] = 'chickpeas'
164
+ @db.rnum.should == 2
165
+ end
166
+
167
+ it "should report db size" do
168
+ @db['rootbeer'] = 'virgils'
169
+ @db.db_size.should.not == 0
170
+ end
171
+
172
+ it "should fetch a record" do
173
+ @db.out('beer')
174
+ @db.fetch('beer'){ 'heineken' }.should == 'heineken'
175
+ @db['beer'].should == 'heineken'
176
+ @db.fetch('beer'){ 'becks' }.should == 'heineken'
177
+ end
178
+
179
+ it "should iterate through records" do
180
+ keys = %w[grapejuice tacoshells rice]
181
+ values = %w[Kedem Ortega Uncle\ Ben]
182
+ keys.each_with_index{ |k,i| @db[k] = values[i] }
183
+
184
+ i = 0
185
+ @db.each do |k,v|
186
+ k.should == keys[i]
187
+ v.should == values[i]
188
+ i = i += 1
189
+ end
190
+ end
191
+
192
+ it "should iterate through keys" do
193
+ keys = %w[burritos fajitas tacos tostas enchiladas]
194
+ values = Array.new(keys.size, 'yum')
195
+ keys.each_with_index{ |k,i| @db[k] = values[i] }
196
+
197
+ i = 0
198
+ @db.each_key do |k|
199
+ k.should == keys[i]
200
+ i = i += 1
201
+ end
202
+ end
203
+
204
+ it "should iterate through values" do
205
+ keys = %w[falafel humus couscous tabbouleh tzatziki]
206
+ values = %w[chickpeas chickpeas semolina bulgar yogurt]
207
+ keys.each_with_index{ |k,i| @db[k] = values[i] }
208
+
209
+ i = 0
210
+ @db.each_value do |v|
211
+ v.should == values[i]
212
+ i = i += 1
213
+ end
214
+ end
215
+
216
+ it "should add serialized integer values" do
217
+ key = 'counter'
218
+ @db.out(key)
219
+ @db.add_int(key, 1).should == 1
220
+ @db.add_int(key, 1).should == 2
221
+ @db.get_int(key).should == 2
222
+ end
223
+
224
+ it "should increment integer values" do
225
+ key = 'counter'
226
+ @db.out(key)
227
+ @db.increment(key).should == 1
228
+ @db.increment(key, 2).should == 3
229
+ @db.get_int(key).should == 3
230
+ end
231
+
232
+ it "should add serialized double values" do
233
+ key = 'counter'
234
+ @db.out(key)
235
+ @db.add_double(key, 1.0).should.be.close?(1.0, 0.005)
236
+ @db.add_double(key, 1.0).should.be.close?(2.0, 0.005)
237
+ @db.get_double(key).should.be.close?(2.0, 0.005)
238
+ end
239
+
240
+ it "should run lua extensions" do
241
+ @db.ext('echo', 'hello', 'world').should == "hello\tworld"
242
+ end
243
+
244
+ it "should serialize objects that respond to to_tokyo_tyrant" do
245
+ class Thing
246
+ def to_tokyo_tyrant
247
+ "success"
248
+ end
249
+ end
250
+
251
+ @db["to_tokyo_tyrant"] = Thing.new
252
+ @db["to_tokyo_tyrant"].should == "success"
253
+ end
254
+ end
@@ -0,0 +1,301 @@
1
+ require 'pathname'
2
+ require Pathname(__FILE__).dirname.join('spec_base') unless $root
3
+
4
+ describe TokyoTyrant::Table, "with an open database" do
5
+
6
+ before do
7
+ @db = TokyoTyrant::Table.new('127.0.0.1', 45001)
8
+ @db.clear
9
+ end
10
+
11
+ it "should not be nil" do
12
+ @db.should.not.be.nil
13
+ end
14
+
15
+ it "should close" do
16
+ @db.close.should.be.true
17
+ begin
18
+ @db.close
19
+ rescue => e
20
+ e.message.should == 'close error: invalid operation'
21
+ end
22
+ end
23
+
24
+ it "should return a server expression" do
25
+ @db.server.should == '127.0.0.1:45001'
26
+ end
27
+
28
+ it "should optimize" do
29
+ @db.optimize.should.be.true
30
+ end
31
+
32
+ it "should save a value" do
33
+ value = { 'lettuce' => 'Red Leaf', 'dressing' => 'ranch', 'extra' => 'bacon bits' }
34
+ @db[:salad] = value
35
+ @db[:salad].should == value
36
+ end
37
+
38
+ it "should return a value" do
39
+ value = { 'lettuce' => 'Red Leaf', 'dressing' => 'ranch', 'extra' => 'bacon bits' }
40
+ @db[:salad] = value
41
+ @db[:salad].should == value
42
+ end
43
+
44
+ it "should accept binary data" do
45
+ s = "mango#{0.chr}salsa"
46
+ h = { s => s }
47
+ @db.put(s, h).should.be.true
48
+ @db[s].should.equal(h)
49
+ end
50
+
51
+ it "should save multiple values" do
52
+ h = { 'pizza' => { 'best' => 'old forge style', 'ok' => 'new york style', 'worst' => 'chicago style' },
53
+ 'sandwich' => { 'best' => 'peanut butter jelly', 'ok' => 'turkey', 'worst' => 'olive loaf' },
54
+ 'yogurt' => { 'best' => 'greek', 'ok' => 'organic', 'worst' => '+hfcs' },
55
+ 'coffee' => { 'best' => 'black', 'ok' => 'espresso', 'worst' => 'latte' } }
56
+
57
+ @db.mput(h).should.be.empty
58
+ h.each_pair do |k,v|
59
+ @db[k].should == v
60
+ end
61
+ end
62
+
63
+ it "should delete multiple values" do
64
+ h = { 'pizza' => { 'best' => 'old forge style', 'ok' => 'new york style', 'worst' => 'chicago style' },
65
+ 'sandwich' => { 'best' => 'peanut butter jelly', 'ok' => 'turkey', 'worst' => 'olive loaf' },
66
+ 'yogurt' => { 'best' => 'greek', 'ok' => 'organic', 'worst' => '+hfcs' },
67
+ 'coffee' => { 'best' => 'black', 'ok' => 'espresso', 'worst' => 'latte' } }
68
+
69
+ @db.mput(h)
70
+ @db.outlist('coffee', 'yogurt').should.be.empty
71
+ @db.keys.sort.should == ['pizza','sandwich']
72
+ end
73
+
74
+ it "should get multiple values" do
75
+ h = { 'pizza' => { 'best' => 'old forge style', 'ok' => 'new york style', 'worst' => 'chicago style' },
76
+ 'sandwich' => { 'best' => 'peanut butter jelly', 'ok' => 'turkey', 'worst' => 'olive loaf' },
77
+ 'yogurt' => { 'best' => 'greek', 'ok' => 'organic', 'worst' => '+hfcs' },
78
+ 'coffee' => { 'best' => 'black', 'ok' => 'espresso', 'worst' => 'latte' } }
79
+
80
+ @db.mput(h)
81
+ @db.mget(h.keys).should == h
82
+ end
83
+
84
+ it "should out a value" do
85
+ k = :tomato
86
+ @db[k] = { 'color' => 'red', 'variety' => 'beefy' }
87
+ @db.out(k).should.be.true
88
+ @db[k].should.be.nil
89
+ @db.out(k).should.be.false
90
+ end
91
+
92
+ it "should check a key" do
93
+ k = :fruit
94
+ @db[k] = { 'name' => 'banana', 'code' => '4011' }
95
+ @db.check(k).should.be.true
96
+ @db.out(k)
97
+ @db.check(k).should.be.false
98
+ end
99
+
100
+ it "should iterate" do
101
+ @db[:cheese] = { 'melty' => 'gouda', 'sharp' => 'cheddar', 'stringy' => 'mozerella' }
102
+ @db[:grapes] = { 'sour' => 'green', 'big' => 'red', 'wine' => 'purple' }
103
+ @db[:oranges] = { 'juicy' => 'florida', 'yellow' => 'california' }
104
+ @db[:crackers] = { 'wheat' => 'triscuit', 'snack' => 'ritz', 'soup' => 'saltine' }
105
+
106
+ @db.iterinit.should.be.true
107
+ @db.iternext.should == 'cheese'
108
+ @db.iternext.should == 'grapes'
109
+ @db.iternext.should == 'oranges'
110
+ @db.iternext.should == 'crackers'
111
+ @db.iternext.should == nil
112
+ end
113
+
114
+ it "should get forward matching keys" do
115
+ @db['apples/royalgala'] = { 'code' => '4173', 'color' => 'red-yellow' }
116
+ @db['apples/grannysmith'] = { 'code' => '4139', 'color' => 'green' }
117
+ @db['bananas/yellow'] = { 'code' => '4011', 'color' => 'yellow' }
118
+ @db['oranges/shamouti'] = { 'code' => '3027', 'color' => 'orange' }
119
+ @db['grapefruit/deepred'] = { 'code' => '4288', 'color' => 'yellow/pink' }
120
+ @db.fwmkeys('apples').sort.should == ["apples/grannysmith", "apples/royalgala"]
121
+ end
122
+
123
+ it "should delete forward matching keys" do
124
+ @db['apples/royalgala'] = { 'code' => '4173', 'color' => 'red-yellow' }
125
+ @db['apples/grannysmith'] = { 'code' => '4139', 'color' => 'green' }
126
+ @db['bananas/yellow'] = { 'code' => '4011', 'color' => 'yellow' }
127
+ @db['oranges/shamouti'] = { 'code' => '3027', 'color' => 'orange' }
128
+ @db['grapefruit/deepred'] = { 'code' => '4288', 'color' => 'yellow/pink' }
129
+ @db.delete_keys_with_prefix('apples').should == nil
130
+ @db.fwmkeys('apples').should.be.empty
131
+ @db.keys.sort.should == ['bananas/yellow', 'grapefruit/deepred', 'oranges/shamouti']
132
+ end
133
+
134
+ it "should get all keys" do
135
+ keys = %w[appetizers entree dessert]
136
+ values = [{ 'cheap' => 'chips', 'expensive' => 'sample everything platter' },
137
+ { 'cheap' => 'hoagie', 'expensive' => 'steak' },
138
+ { 'cheap' => 'water ice', 'expensive' => 'cheesecake' }]
139
+
140
+ keys.each_with_index do |k,i|
141
+ @db[k] = values[i]
142
+ end
143
+ @db.keys.should == keys
144
+ end
145
+
146
+ it "should get all values" do
147
+ keys = %w[appetizers entree dessert]
148
+ values = [{ 'cheap' => 'chips', 'expensive' => 'sample everything platter' },
149
+ { 'cheap' => 'hoagie', 'expensive' => 'steak' },
150
+ { 'cheap' => 'water ice', 'expensive' => 'cheesecake' }]
151
+
152
+ keys.each_with_index do |k,i|
153
+ @db[k] = values[i]
154
+ end
155
+ @db.values.should == values
156
+ end
157
+
158
+ it "should vanish all records" do
159
+ @db['chocolate'] = { 'type' => 'dark' }
160
+ @db['tea'] = { 'type' => 'earl grey' }
161
+ @db.empty?.should.be.false
162
+ @db.vanish.should.be.true
163
+ @db.empty?.should.be.true
164
+ end
165
+
166
+ it "should count records" do
167
+ @db['hummus'] = { 'ingredients' => 'chickpeas,garlic' }
168
+ @db['falafel'] = { 'ingredients' => 'chickpeas,herbs' }
169
+ @db.rnum.should == 2
170
+ end
171
+
172
+ it "should report db size" do
173
+ @db['rootbeer'] = { 'gourmet' => 'Virgils', 'natural' => 'Hansens' }
174
+ @db.db_size.should.not == 0
175
+ end
176
+
177
+ it "should fetch a record" do
178
+ @db.out('beer')
179
+ @db.fetch('beer'){{ 'import' => 'heineken' }}.should == { 'import' => 'heineken' }
180
+ @db['beer'].should == { 'import' => 'heineken' }
181
+ @db.fetch('beer'){{ 'import' => 'becks' }}.should == { 'import' => 'heineken' }
182
+ end
183
+
184
+ it "should iterate through records" do
185
+ keys = %w[grapejuice tacoshells rice]
186
+ values = [{ 'purple' => 'Kedem', 'green' => 'Juicy Juice' },
187
+ { 'crunchy' => 'Ortega', 'soft' => 'Taco Bell' },
188
+ { 'brown' => 'Instant', 'white' => 'Uncle Ben' }]
189
+ keys.each_with_index{ |k,i| @db[k] = values[i] }
190
+
191
+ i = 0
192
+ @db.each do |k,v|
193
+ k.should == keys[i]
194
+ v.should == values[i]
195
+ i = i += 1
196
+ end
197
+ end
198
+
199
+ it "should iterate through keys" do
200
+ keys = %w[burritos fajitas tacos tostas enchiladas]
201
+ values = Array.new(keys.size, { 'tasty' => 'yes' })
202
+ keys.each_with_index{ |k,i| @db[k] = values[i] }
203
+
204
+ i = 0
205
+ @db.each_key do |k|
206
+ k.should == keys[i]
207
+ i = i += 1
208
+ end
209
+ end
210
+
211
+ it "should iterate through values" do
212
+ keys = %w[falafel humus couscous tabbouleh tzatziki]
213
+ values = [{ 'ingredient' => 'chickpeas' },
214
+ { 'ingredient' => 'chickpeas' },
215
+ { 'ingredient' => 'semolina' },
216
+ { 'ingredient' => 'bulgar' },
217
+ { 'ingredient' => 'yogurt' }]
218
+
219
+ keys.each_with_index{ |k,i| @db[k] = values[i] }
220
+
221
+ i = 0
222
+ @db.each_value do |v|
223
+ v.should == values[i]
224
+ i = i += 1
225
+ end
226
+ end
227
+
228
+ it "should add serialized integer values" do
229
+ key = 'counter'
230
+ @db.out(key)
231
+ @db[key] = { 'title' => 'Bean Counter' }
232
+ @db.add_int(key, 1).should == 1
233
+ @db.add_int(key, 1).should == 2
234
+ @db.get_int(key).should == 2
235
+ @db[key].should == { 'title' => 'Bean Counter', '_num' => "2" }
236
+ end
237
+
238
+ it "should increment integer values" do
239
+ key = 'counter'
240
+ @db.out(key)
241
+ @db[key] = { 'title' => 'Bean Counter' }
242
+ @db.increment(key).should == 1
243
+ @db.increment(key, 2).should == 3
244
+ @db.get_int(key).should == 3
245
+ @db[key].should == { 'title' => 'Bean Counter', '_num' => "3" }
246
+ end
247
+
248
+ it "should add serialized double values" do
249
+ key = 'counter'
250
+ @db.out(key)
251
+ @db[key] = { 'title' => 'Bean Counter' }
252
+ @db.add_double(key, 1.0).should.be.close?(1.0, 0.005)
253
+ @db.add_double(key, 1.0).should.be.close?(2.0, 0.005)
254
+ @db.get_double(key).should.be.close?(2.0, 0.005)
255
+ @db[key].should == { 'title' => 'Bean Counter', '_num' => "2" }
256
+ end
257
+
258
+ it "should set an index" do
259
+ key = 'counter'
260
+ 50.times do |i|
261
+ @db["key#{i}"] = { 'title' => %w{rice beans corn}.sort_by{rand}.first,
262
+ 'description' => 'a whole protein' }
263
+ end
264
+ @db.set_index('title', :lexical).should.be.true
265
+ end
266
+
267
+ it "should run lua extensions" do
268
+ @db.ext('echo', 'hello', 'world').should == "hello\tworld"
269
+ end
270
+
271
+ it "should perform meta search with multiple query objects" do
272
+ keys = %w[falafel humus couscous tabbouleh tzatziki peanutbutter]
273
+ values = [{ 'ingredient' => 'chickpeas' },
274
+ { 'ingredient' => 'chickpeas' },
275
+ { 'ingredient' => 'semolina' },
276
+ { 'ingredient' => 'bulgar' },
277
+ { 'ingredient' => 'yogurt' },
278
+ { 'ingredient' => 'peanuts'}]
279
+
280
+ keys.each_with_index{ |k,i| @db[k] = values[i] }
281
+
282
+ query1 = @db.prepare_query{ |q| q.condition('ingredient', :streq, 'yogurt').order_by('ingredient') }
283
+ query2 = @db.prepare_query{ |q| q.condition('ingredient', :streq, 'chickpeas').order_by('ingredient') }
284
+ query3 = @db.prepare_query{ |q| q.condition('ingredient', :ftsex, 'pea').order_by('ingredient') }
285
+
286
+ @db.search(:union, query1, query2).should == ["falafel", "humus", "tzatziki"]
287
+ @db.search(:diff, query1, query2).should == ["tzatziki"]
288
+ @db.search(:intersection, query2, query3).should == ["falafel", "humus"]
289
+ end
290
+
291
+ it "should serialize objects that respond to to_tokyo_tyrant" do
292
+ class Thing
293
+ def to_tokyo_tyrant
294
+ "success"
295
+ end
296
+ end
297
+
298
+ @db["to_tokyo_tyrant"] = { "thing" => Thing.new }
299
+ @db["to_tokyo_tyrant"].should == { "thing" => "success" }
300
+ end
301
+ end