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,748 @@
1
+ /*************************************************************************************************
2
+ * Writing test of Tokyo Cabinet
3
+ *************************************************************************************************/
4
+
5
+
6
+ #include <tcutil.h>
7
+ #include <tchdb.h>
8
+ #include <tcbdb.h>
9
+ #include <tcfdb.h>
10
+ #include <tctdb.h>
11
+ #include <stdbool.h>
12
+ #include <stdint.h>
13
+ #include <stdio.h>
14
+ #include <string.h>
15
+
16
+ #undef TRUE
17
+ #define TRUE 1 /* boolean true */
18
+ #undef FALSE
19
+ #define FALSE 0 /* boolean false */
20
+
21
+ #define RECBUFSIZ 32 /* buffer for records */
22
+
23
+
24
+ /* global variables */
25
+ const char *progname; /* program name */
26
+ int showprgr; /* whether to show progression */
27
+
28
+
29
+ /* function prototypes */
30
+ int main(int argc, char **argv);
31
+ void usage(void);
32
+ int runwrite(int argc, char **argv);
33
+ int runread(int argc, char **argv);
34
+ int runbtwrite(int argc, char **argv);
35
+ int runbtread(int argc, char **argv);
36
+ int runflwrite(int argc, char **argv);
37
+ int runflread(int argc, char **argv);
38
+ int runtblwrite(int argc, char **argv);
39
+ int runtblread(int argc, char **argv);
40
+ int myrand(void);
41
+ int dowrite(char *name, int rnum);
42
+ int doread(char *name, int rnum);
43
+ int dobtwrite(char *name, int rnum, int rnd);
44
+ int dobtread(char *name, int rnum, int rnd);
45
+ int doflwrite(char *name, int rnum);
46
+ int doflread(char *name, int rnum);
47
+ int dotblwrite(char *name, int rnum);
48
+ int dotblread(char *name, int rnum);
49
+
50
+
51
+ /* main routine */
52
+ int main(int argc, char **argv){
53
+ int rv;
54
+ progname = argv[0];
55
+ showprgr = TRUE;
56
+ if(getenv("HIDEPRGR")) showprgr = FALSE;
57
+ srand48(1978);
58
+ if(argc < 2) usage();
59
+ rv = 0;
60
+ if(!strcmp(argv[1], "write")){
61
+ rv = runwrite(argc, argv);
62
+ } else if(!strcmp(argv[1], "read")){
63
+ rv = runread(argc, argv);
64
+ } else if(!strcmp(argv[1], "btwrite")){
65
+ rv = runbtwrite(argc, argv);
66
+ } else if(!strcmp(argv[1], "btread")){
67
+ rv = runbtread(argc, argv);
68
+ } else if(!strcmp(argv[1], "flwrite")){
69
+ rv = runflwrite(argc, argv);
70
+ } else if(!strcmp(argv[1], "flread")){
71
+ rv = runflread(argc, argv);
72
+ } else if(!strcmp(argv[1], "tblwrite")){
73
+ rv = runtblwrite(argc, argv);
74
+ } else if(!strcmp(argv[1], "tblread")){
75
+ rv = runtblread(argc, argv);
76
+ } else {
77
+ usage();
78
+ }
79
+ return rv;
80
+ }
81
+
82
+
83
+ /* print the usage and exit */
84
+ void usage(void){
85
+ fprintf(stderr, "%s: test cases for Tokyo Cabinet\n", progname);
86
+ fprintf(stderr, "\n");
87
+ fprintf(stderr, "usage:\n");
88
+ fprintf(stderr, " %s write name rnum\n", progname);
89
+ fprintf(stderr, " %s read name rnum\n", progname);
90
+ fprintf(stderr, " %s btwrite [-rnd] name rnum\n", progname);
91
+ fprintf(stderr, " %s btread [-rnd] name rnum\n", progname);
92
+ fprintf(stderr, " %s flwrite name rnum\n", progname);
93
+ fprintf(stderr, " %s flread name rnum\n", progname);
94
+ fprintf(stderr, " %s tblwrite name rnum\n", progname);
95
+ fprintf(stderr, " %s tblread name rnum\n", progname);
96
+ fprintf(stderr, "\n");
97
+ exit(1);
98
+ }
99
+
100
+
101
+ /* parse arguments of write command */
102
+ int runwrite(int argc, char **argv){
103
+ char *name, *rstr;
104
+ int i, rnum, rv;
105
+ name = NULL;
106
+ rstr = NULL;
107
+ rnum = 0;
108
+ for(i = 2; i < argc; i++){
109
+ if(!name && argv[i][0] == '-'){
110
+ usage();
111
+ } else if(!name){
112
+ name = argv[i];
113
+ } else if(!rstr){
114
+ rstr = argv[i];
115
+ } else {
116
+ usage();
117
+ }
118
+ }
119
+ if(!name || !rstr) usage();
120
+ rnum = atoi(rstr);
121
+ if(rnum < 1) usage();
122
+ rv = dowrite(name, rnum);
123
+ return rv;
124
+ }
125
+
126
+
127
+ /* parse arguments of read command */
128
+ int runread(int argc, char **argv){
129
+ char *name, *rstr;
130
+ int i, rnum, rv;
131
+ name = NULL;
132
+ rstr = NULL;
133
+ rnum = 0;
134
+ for(i = 2; i < argc; i++){
135
+ if(!name && argv[i][0] == '-'){
136
+ usage();
137
+ } else if(!name){
138
+ name = argv[i];
139
+ } else if(!rstr){
140
+ rstr = argv[i];
141
+ } else {
142
+ usage();
143
+ }
144
+ }
145
+ if(!name || !rstr) usage();
146
+ rnum = atoi(rstr);
147
+ if(rnum < 1) usage();
148
+ rv = doread(name, rnum);
149
+ return rv;
150
+ }
151
+
152
+
153
+ /* parse arguments of btwrite command */
154
+ int runbtwrite(int argc, char **argv){
155
+ char *name, *rstr;
156
+ int i, rnum, rnd, rv;
157
+ name = NULL;
158
+ rstr = NULL;
159
+ rnum = 0;
160
+ rnd = FALSE;
161
+ for(i = 2; i < argc; i++){
162
+ if(!name && argv[i][0] == '-'){
163
+ if(!name && !strcmp(argv[i], "-rnd")){
164
+ rnd = TRUE;
165
+ } else {
166
+ usage();
167
+ }
168
+ } else if(!name){
169
+ name = argv[i];
170
+ } else if(!rstr){
171
+ rstr = argv[i];
172
+ } else {
173
+ usage();
174
+ }
175
+ }
176
+ if(!name || !rstr) usage();
177
+ rnum = atoi(rstr);
178
+ if(rnum < 1) usage();
179
+ rv = dobtwrite(name, rnum, rnd);
180
+ return rv;
181
+ }
182
+
183
+
184
+ /* parse arguments of btread command */
185
+ int runbtread(int argc, char **argv){
186
+ char *name, *rstr;
187
+ int i, rnum, rnd, rv;
188
+ name = NULL;
189
+ rstr = NULL;
190
+ rnum = 0;
191
+ rnd = FALSE;
192
+ for(i = 2; i < argc; i++){
193
+ if(!name && argv[i][0] == '-'){
194
+ if(!name && !strcmp(argv[i], "-rnd")){
195
+ rnd = TRUE;
196
+ } else {
197
+ usage();
198
+ }
199
+ } else if(!name){
200
+ name = argv[i];
201
+ } else if(!rstr){
202
+ rstr = argv[i];
203
+ } else {
204
+ usage();
205
+ }
206
+ }
207
+ if(!name || !rstr) usage();
208
+ rnum = atoi(rstr);
209
+ if(rnum < 1) usage();
210
+ rv = dobtread(name, rnum, rnd);
211
+ return rv;
212
+ }
213
+
214
+
215
+ /* parse arguments of flwrite command */
216
+ int runflwrite(int argc, char **argv){
217
+ char *name, *rstr;
218
+ int i, rnum, rv;
219
+ name = NULL;
220
+ rstr = NULL;
221
+ rnum = 0;
222
+ for(i = 2; i < argc; i++){
223
+ if(!name && argv[i][0] == '-'){
224
+ usage();
225
+ } else if(!name){
226
+ name = argv[i];
227
+ } else if(!rstr){
228
+ rstr = argv[i];
229
+ } else {
230
+ usage();
231
+ }
232
+ }
233
+ if(!name || !rstr) usage();
234
+ rnum = atoi(rstr);
235
+ if(rnum < 1) usage();
236
+ rv = doflwrite(name, rnum);
237
+ return rv;
238
+ }
239
+
240
+
241
+ /* parse arguments of read command */
242
+ int runflread(int argc, char **argv){
243
+ char *name, *rstr;
244
+ int i, rnum, rv;
245
+ name = NULL;
246
+ rstr = NULL;
247
+ rnum = 0;
248
+ for(i = 2; i < argc; i++){
249
+ if(!name && argv[i][0] == '-'){
250
+ usage();
251
+ } else if(!name){
252
+ name = argv[i];
253
+ } else if(!rstr){
254
+ rstr = argv[i];
255
+ } else {
256
+ usage();
257
+ }
258
+ }
259
+ if(!name || !rstr) usage();
260
+ rnum = atoi(rstr);
261
+ if(rnum < 1) usage();
262
+ rv = doflread(name, rnum);
263
+ return rv;
264
+ }
265
+
266
+
267
+ /* parse arguments of tblwrite command */
268
+ int runtblwrite(int argc, char **argv){
269
+ char *name, *rstr;
270
+ int i, rnum, rnd, rv;
271
+ name = NULL;
272
+ rstr = NULL;
273
+ rnum = 0;
274
+ rnd = FALSE;
275
+ for(i = 2; i < argc; i++){
276
+ if(!name && argv[i][0] == '-'){
277
+ usage();
278
+ } else if(!name){
279
+ name = argv[i];
280
+ } else if(!rstr){
281
+ rstr = argv[i];
282
+ } else {
283
+ usage();
284
+ }
285
+ }
286
+ if(!name || !rstr) usage();
287
+ rnum = atoi(rstr);
288
+ if(rnum < 1) usage();
289
+ rv = dotblwrite(name, rnum);
290
+ return rv;
291
+ }
292
+
293
+
294
+ /* parse arguments of tblread command */
295
+ int runtblread(int argc, char **argv){
296
+ char *name, *rstr;
297
+ int i, rnum, rnd, rv;
298
+ name = NULL;
299
+ rstr = NULL;
300
+ rnum = 0;
301
+ rnd = FALSE;
302
+ for(i = 2; i < argc; i++){
303
+ if(!name && argv[i][0] == '-'){
304
+ usage();
305
+ } else if(!name){
306
+ name = argv[i];
307
+ } else if(!rstr){
308
+ rstr = argv[i];
309
+ } else {
310
+ usage();
311
+ }
312
+ }
313
+ if(!name || !rstr) usage();
314
+ rnum = atoi(rstr);
315
+ if(rnum < 1) usage();
316
+ rv = dotblread(name, rnum);
317
+ return rv;
318
+ }
319
+
320
+
321
+ /* pseudo random number generator */
322
+ int myrand(void){
323
+ static int cnt = 0;
324
+ return (lrand48() + cnt++) & 0x7FFFFFFF;
325
+ }
326
+
327
+
328
+ /* perform write command */
329
+ int dowrite(char *name, int rnum){
330
+ TCHDB *hdb;
331
+ int i, err, len;
332
+ char buf[RECBUFSIZ];
333
+ if(showprgr) printf("<Writing Test of Hash>\n name=%s rnum=%d\n\n", name, rnum);
334
+ /* open a database */
335
+ hdb = tchdbnew();
336
+ tchdbtune(hdb, rnum * 3, 0, 0, 0);
337
+ tchdbsetxmsiz(hdb, rnum * 48);
338
+ if(!tchdbopen(hdb, name, HDBOWRITER | HDBOCREAT | HDBOTRUNC)){
339
+ fprintf(stderr, "tchdbopen failed\n");
340
+ tchdbdel(hdb);
341
+ return 1;
342
+ }
343
+ err = FALSE;
344
+ /* loop for each record */
345
+ for(i = 1; i <= rnum; i++){
346
+ /* store a record */
347
+ len = sprintf(buf, "%08d", i);
348
+ if(!tchdbputasync(hdb, buf, len, buf, len)){
349
+ fprintf(stderr, "tchdbputasync failed\n");
350
+ err = TRUE;
351
+ break;
352
+ }
353
+ /* print progression */
354
+ if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
355
+ putchar('.');
356
+ fflush(stdout);
357
+ if(i == rnum || i % (rnum / 10) == 0){
358
+ printf(" (%08d)\n", i);
359
+ fflush(stdout);
360
+ }
361
+ }
362
+ }
363
+ /* close the database */
364
+ if(!tchdbclose(hdb)){
365
+ fprintf(stderr, "tchdbclose failed\n");
366
+ tchdbdel(hdb);
367
+ return 1;
368
+ }
369
+ tchdbdel(hdb);
370
+ if(showprgr && !err) printf("ok\n\n");
371
+ return err ? 1 : 0;
372
+ }
373
+
374
+
375
+ /* perform read command */
376
+ int doread(char *name, int rnum){
377
+ TCHDB *hdb;
378
+ int i, err, len;
379
+ char buf[RECBUFSIZ], vbuf[RECBUFSIZ];
380
+ if(showprgr) printf("<Reading Test of Hash>\n name=%s rnum=%d\n\n", name, rnum);
381
+ /* open a database */
382
+ hdb = tchdbnew();
383
+ tchdbsetxmsiz(hdb, rnum * 48);
384
+ if(!tchdbopen(hdb, name, HDBOREADER)){
385
+ fprintf(stderr, "tchdbopen failed\n");
386
+ tchdbdel(hdb);
387
+ return 1;
388
+ }
389
+ err = FALSE;
390
+ /* loop for each record */
391
+ for(i = 1; i <= rnum; i++){
392
+ /* store a record */
393
+ len = sprintf(buf, "%08d", i);
394
+ if(tchdbget3(hdb, buf, len, vbuf, RECBUFSIZ) == -1){
395
+ fprintf(stderr, "tchdbget3 failed\n");
396
+ err = TRUE;
397
+ break;
398
+ }
399
+ /* print progression */
400
+ if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
401
+ putchar('.');
402
+ fflush(stdout);
403
+ if(i == rnum || i % (rnum / 10) == 0){
404
+ printf(" (%08d)\n", i);
405
+ fflush(stdout);
406
+ }
407
+ }
408
+ }
409
+ /* close the database */
410
+ if(!tchdbclose(hdb)){
411
+ fprintf(stderr, "tchdbclose failed\n");
412
+ tchdbdel(hdb);
413
+ return 1;
414
+ }
415
+ tchdbdel(hdb);
416
+ if(showprgr && !err) printf("ok\n\n");
417
+ return err ? 1 : 0;
418
+ }
419
+
420
+
421
+ /* perform btwrite command */
422
+ int dobtwrite(char *name, int rnum, int rnd){
423
+ TCBDB *bdb;
424
+ int i, err, len;
425
+ char buf[RECBUFSIZ];
426
+ if(showprgr) printf("<Writing Test of B+ Tree>\n name=%s rnum=%d\n\n", name, rnum);
427
+ /* open a database */
428
+ bdb = tcbdbnew();
429
+ if(rnd){
430
+ tcbdbtune(bdb, 77, 256, -1, 0, 0, 0);
431
+ tcbdbsetcache(bdb, rnum / 77, -1);
432
+ } else {
433
+ tcbdbtune(bdb, 101, 256, -1, 0, 0, 0);
434
+ tcbdbsetcache(bdb, 256, 256);
435
+ }
436
+ tcbdbsetxmsiz(bdb, rnum * 32);
437
+ if(!tcbdbopen(bdb, name, BDBOWRITER | BDBOCREAT | BDBOTRUNC)){
438
+ fprintf(stderr, "tcbdbopen failed\n");
439
+ tcbdbdel(bdb);
440
+ return 1;
441
+ }
442
+ err = FALSE;
443
+ /* loop for each record */
444
+ for(i = 1; i <= rnum; i++){
445
+ /* store a record */
446
+ len = sprintf(buf, "%08d", rnd ? myrand() % rnum + 1 : i);
447
+ if(!tcbdbput(bdb, buf, len, buf, len)){
448
+ fprintf(stderr, "tcbdbput failed\n");
449
+ err = TRUE;
450
+ break;
451
+ }
452
+ /* print progression */
453
+ if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
454
+ putchar('.');
455
+ fflush(stdout);
456
+ if(i == rnum || i % (rnum / 10) == 0){
457
+ printf(" (%08d)\n", i);
458
+ fflush(stdout);
459
+ }
460
+ }
461
+ }
462
+ /* close the database */
463
+ if(!tcbdbclose(bdb)){
464
+ fprintf(stderr, "tcbdbclose failed\n");
465
+ tcbdbdel(bdb);
466
+ return 1;
467
+ }
468
+ tcbdbdel(bdb);
469
+ if(showprgr && !err) printf("ok\n\n");
470
+ return err ? 1 : 0;
471
+ }
472
+
473
+
474
+ /* perform btread command */
475
+ int dobtread(char *name, int rnum, int rnd){
476
+ TCBDB *bdb;
477
+ int i, err, len, vlen;
478
+ const char *val;
479
+ char buf[RECBUFSIZ];
480
+ if(showprgr) printf("<Reading Test of B+ Tree>\n name=%s rnum=%d\n\n", name, rnum);
481
+ /* open a database */
482
+ bdb = tcbdbnew();
483
+ if(rnd){
484
+ tcbdbsetcache(bdb, rnum / 77 + 1, -1);
485
+ } else {
486
+ tcbdbsetcache(bdb, 256, 256);
487
+ }
488
+ tcbdbsetxmsiz(bdb, rnum * 32);
489
+ if(!tcbdbopen(bdb, name, BDBOREADER)){
490
+ fprintf(stderr, "tcbdbopen failed\n");
491
+ tcbdbdel(bdb);
492
+ return 1;
493
+ }
494
+ err = FALSE;
495
+ /* loop for each record */
496
+ for(i = 1; i <= rnum; i++){
497
+ /* store a record */
498
+ len = sprintf(buf, "%08d", rnd ? myrand() % rnum + 1 : i);
499
+ if(!(val = tcbdbget3(bdb, buf, len, &vlen))){
500
+ fprintf(stderr, "tdbdbget3 failed\n");
501
+ err = TRUE;
502
+ break;
503
+ }
504
+ /* print progression */
505
+ if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
506
+ putchar('.');
507
+ fflush(stdout);
508
+ if(i == rnum || i % (rnum / 10) == 0){
509
+ printf(" (%08d)\n", i);
510
+ fflush(stdout);
511
+ }
512
+ }
513
+ }
514
+ /* close the database */
515
+ if(!tcbdbclose(bdb)){
516
+ fprintf(stderr, "tcbdbclose failed\n");
517
+ tcbdbdel(bdb);
518
+ return 1;
519
+ }
520
+ tcbdbdel(bdb);
521
+ if(showprgr && !err) printf("ok\n\n");
522
+ return err ? 1 : 0;
523
+ }
524
+
525
+
526
+ /* perform flwrite command */
527
+ int doflwrite(char *name, int rnum){
528
+ TCFDB *fdb;
529
+ int i, err, len;
530
+ char buf[RECBUFSIZ];
531
+ if(showprgr) printf("<Writing Test of Fixed-Length>\n name=%s rnum=%d\n\n", name, rnum);
532
+ /* open a database */
533
+ fdb = tcfdbnew();
534
+ tcfdbtune(fdb, 8, 1024 + rnum * 9);
535
+ if(!tcfdbopen(fdb, name, FDBOWRITER | FDBOCREAT | FDBOTRUNC)){
536
+ fprintf(stderr, "tcfdbopen failed\n");
537
+ tcfdbdel(fdb);
538
+ return 1;
539
+ }
540
+ err = FALSE;
541
+ /* loop for each record */
542
+ for(i = 1; i <= rnum; i++){
543
+ /* store a record */
544
+ len = sprintf(buf, "%08d", i);
545
+ if(!tcfdbput(fdb, i, buf, len)){
546
+ fprintf(stderr, "tcfdbput failed\n");
547
+ err = TRUE;
548
+ break;
549
+ }
550
+ /* print progression */
551
+ if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
552
+ putchar('.');
553
+ fflush(stdout);
554
+ if(i == rnum || i % (rnum / 10) == 0){
555
+ printf(" (%08d)\n", i);
556
+ fflush(stdout);
557
+ }
558
+ }
559
+ }
560
+ /* close the database */
561
+ if(!tcfdbclose(fdb)){
562
+ fprintf(stderr, "tcfdbclose failed\n");
563
+ tcfdbdel(fdb);
564
+ return 1;
565
+ }
566
+ tcfdbdel(fdb);
567
+ if(showprgr && !err) printf("ok\n\n");
568
+ return err ? 1 : 0;
569
+ }
570
+
571
+
572
+ /* perform flread command */
573
+ int doflread(char *name, int rnum){
574
+ TCFDB *fdb;
575
+ int i, err;
576
+ char vbuf[RECBUFSIZ];
577
+ if(showprgr) printf("<Reading Test of Fixed-length>\n name=%s rnum=%d\n\n", name, rnum);
578
+ /* open a database */
579
+ fdb = tcfdbnew();
580
+ if(!tcfdbopen(fdb, name, FDBOREADER)){
581
+ fprintf(stderr, "tcfdbopen failed\n");
582
+ tcfdbdel(fdb);
583
+ return 1;
584
+ }
585
+ err = FALSE;
586
+ /* loop for each record */
587
+ for(i = 1; i <= rnum; i++){
588
+ /* store a record */
589
+ if(tcfdbget4(fdb, i, vbuf, RECBUFSIZ) == -1){
590
+ fprintf(stderr, "tcfdbget4 failed\n");
591
+ err = TRUE;
592
+ break;
593
+ }
594
+ /* print progression */
595
+ if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
596
+ putchar('.');
597
+ fflush(stdout);
598
+ if(i == rnum || i % (rnum / 10) == 0){
599
+ printf(" (%08d)\n", i);
600
+ fflush(stdout);
601
+ }
602
+ }
603
+ }
604
+ /* close the database */
605
+ if(!tcfdbclose(fdb)){
606
+ fprintf(stderr, "tcfdbclose failed\n");
607
+ tcfdbdel(fdb);
608
+ return 1;
609
+ }
610
+ tcfdbdel(fdb);
611
+ if(showprgr && !err) printf("ok\n\n");
612
+ return err ? 1 : 0;
613
+ }
614
+
615
+
616
+ /* perform tblwrite command */
617
+ int dotblwrite(char *name, int rnum){
618
+ TCTDB *tdb;
619
+ int i, err, pksiz, vsiz;
620
+ char pkbuf[RECBUFSIZ], vbuf[RECBUFSIZ];
621
+ TCMAP *cols;
622
+ if(showprgr) printf("<Writing Test of Table>\n name=%s rnum=%d\n\n", name, rnum);
623
+ /* open a database */
624
+ tdb = tctdbnew();
625
+ tctdbtune(tdb, rnum * 3, 0, 0, 0);
626
+ tctdbsetxmsiz(tdb, rnum * 80);
627
+ tctdbsetcache(tdb, -1, rnum / 100, -1);
628
+ if(!tctdbopen(tdb, name, TDBOWRITER | TDBOCREAT | TDBOTRUNC)){
629
+ fprintf(stderr, "tctdbopen failed\n");
630
+ tctdbdel(tdb);
631
+ return 1;
632
+ }
633
+ if(!tctdbsetindex(tdb, "s", TDBITLEXICAL)){
634
+ fprintf(stderr, "tctdbsetindex failed\n");
635
+ tctdbdel(tdb);
636
+ return 1;
637
+ }
638
+ if(!tctdbsetindex(tdb, "n", TDBITDECIMAL)){
639
+ fprintf(stderr, "tctdbsetindex failed\n");
640
+ tctdbdel(tdb);
641
+ return 1;
642
+ }
643
+ err = FALSE;
644
+ /* loop for each record */
645
+ for(i = 1; i <= rnum; i++){
646
+ /* store a record */
647
+ pksiz = sprintf(pkbuf, "%d", i);
648
+ cols = tcmapnew2(7);
649
+ vsiz = sprintf(vbuf, "%08d", i);
650
+ tcmapput(cols, "s", 1, vbuf, vsiz);
651
+ vsiz = sprintf(vbuf, "%08d", myrand() % i);
652
+ tcmapput(cols, "n", 1, vbuf, vsiz);
653
+ vsiz = sprintf(vbuf, "%08d", i);
654
+ tcmapput(cols, "t", 1, vbuf, vsiz);
655
+ vsiz = sprintf(vbuf, "%08d", myrand() % rnum);
656
+ tcmapput(cols, "f", 1, vbuf, vsiz);
657
+ if(!tctdbput(tdb, pkbuf, pksiz, cols)){
658
+ fprintf(stderr, "tctdbput failed\n");
659
+ err = TRUE;
660
+ break;
661
+ }
662
+ tcmapdel(cols);
663
+ /* print progression */
664
+ if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
665
+ putchar('.');
666
+ fflush(stdout);
667
+ if(i == rnum || i % (rnum / 10) == 0){
668
+ printf(" (%08d)\n", i);
669
+ fflush(stdout);
670
+ }
671
+ }
672
+ }
673
+ /* close the database */
674
+ if(!tctdbclose(tdb)){
675
+ fprintf(stderr, "tctdbclose failed\n");
676
+ tctdbdel(tdb);
677
+ return 1;
678
+ }
679
+ tctdbdel(tdb);
680
+ if(showprgr && !err) printf("ok\n\n");
681
+ return err ? 1 : 0;
682
+ }
683
+
684
+
685
+ /* perform tblread command */
686
+ int dotblread(char *name, int rnum){
687
+ TCTDB *tdb;
688
+ int i, j, err, pksiz, rsiz;
689
+ char pkbuf[RECBUFSIZ];
690
+ const char *rbuf;
691
+ TCMAP *cols;
692
+ TDBQRY *qry;
693
+ TCLIST *res;
694
+ if(showprgr) printf("<Reading Test of Table>\n name=%s rnum=%d\n\n", name, rnum);
695
+ /* open a database */
696
+ tdb = tctdbnew();
697
+ tctdbsetxmsiz(tdb, rnum * 80);
698
+ tctdbsetcache(tdb, -1, rnum / 100, -1);
699
+ if(!tctdbopen(tdb, name, TDBOREADER)){
700
+ fprintf(stderr, "tctdbopen failed\n");
701
+ tctdbdel(tdb);
702
+ return 1;
703
+ }
704
+ err = FALSE;
705
+ /* loop for each record */
706
+ for(i = 1; i <= rnum; i++){
707
+ /* search for a record */
708
+ pksiz = sprintf(pkbuf, "%08d", i);
709
+ qry = tctdbqrynew(tdb);
710
+ tctdbqryaddcond(qry, "s", TDBQCSTREQ, pkbuf);
711
+ res = tctdbqrysearch(qry);
712
+ for(j = 0; j < tclistnum(res); j++){
713
+ rbuf = tclistval(res, j, &rsiz);
714
+ cols = tctdbget(tdb, rbuf, rsiz);
715
+ if(cols){
716
+ tcmapdel(cols);
717
+ } else {
718
+ fprintf(stderr, "tctdbget failed\n");
719
+ err = TRUE;
720
+ break;
721
+ }
722
+ }
723
+ tclistdel(res);
724
+ tctdbqrydel(qry);
725
+ /* print progression */
726
+ if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
727
+ putchar('.');
728
+ fflush(stdout);
729
+ if(i == rnum || i % (rnum / 10) == 0){
730
+ printf(" (%08d)\n", i);
731
+ fflush(stdout);
732
+ }
733
+ }
734
+ }
735
+ /* close the database */
736
+ if(!tctdbclose(tdb)){
737
+ fprintf(stderr, "tctdbclose failed\n");
738
+ tctdbdel(tdb);
739
+ return 1;
740
+ }
741
+ tctdbdel(tdb);
742
+ if(showprgr && !err) printf("ok\n\n");
743
+ return err ? 1 : 0;
744
+ }
745
+
746
+
747
+
748
+ /* END OF FILE */