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,219 @@
1
+ #include <stdio.h>
2
+ #include <stdlib.h>
3
+ #include <string.h>
4
+ #include <errno.h>
5
+ #include <unistd.h>
6
+ #include <sys/types.h>
7
+ #include <sys/stat.h>
8
+ #include <fcntl.h>
9
+ #include <cdb.h>
10
+
11
+ #undef TRUE
12
+ #define TRUE 1 /* boolean true */
13
+ #undef FALSE
14
+ #define FALSE 0 /* boolean false */
15
+
16
+ #define RECBUFSIZ 32 /* buffer for records */
17
+
18
+
19
+ /* global variables */
20
+ const char *progname; /* program name */
21
+ int showprgr; /* whether to show progression */
22
+
23
+
24
+ /* function prototypes */
25
+ int main(int argc, char **argv);
26
+ void usage(void);
27
+ int runwrite(int argc, char **argv);
28
+ int runread(int argc, char **argv);
29
+ int dowrite(char *name, int rnum);
30
+ int doread(char *name, int rnum);
31
+
32
+
33
+ /* main routine */
34
+ int main(int argc, char **argv){
35
+ int rv;
36
+ progname = argv[0];
37
+ showprgr = TRUE;
38
+ if(getenv("HIDEPRGR")) showprgr = FALSE;
39
+ if(argc < 2) usage();
40
+ rv = 0;
41
+ if(!strcmp(argv[1], "write")){
42
+ rv = runwrite(argc, argv);
43
+ } else if(!strcmp(argv[1], "read")){
44
+ rv = runread(argc, argv);
45
+ } else {
46
+ usage();
47
+ }
48
+ return rv;
49
+ }
50
+
51
+
52
+ /* print the usage and exit */
53
+ void usage(void){
54
+ fprintf(stderr, "%s: test cases for Constant Database\n", progname);
55
+ fprintf(stderr, "\n");
56
+ fprintf(stderr, "usage:\n");
57
+ fprintf(stderr, " %s write name rnum\n", progname);
58
+ fprintf(stderr, " %s read name rnum\n", progname);
59
+ fprintf(stderr, "\n");
60
+ exit(1);
61
+ }
62
+
63
+
64
+ /* parse arguments of write command */
65
+ int runwrite(int argc, char **argv){
66
+ char *name, *rstr;
67
+ int i, rnum, rv;
68
+ name = NULL;
69
+ rstr = NULL;
70
+ rnum = 0;
71
+ for(i = 2; i < argc; i++){
72
+ if(!name && argv[i][0] == '-'){
73
+ usage();
74
+ } else if(!name){
75
+ name = argv[i];
76
+ } else if(!rstr){
77
+ rstr = argv[i];
78
+ } else {
79
+ usage();
80
+ }
81
+ }
82
+ if(!name || !rstr) usage();
83
+ rnum = atoi(rstr);
84
+ if(rnum < 1) usage();
85
+ rv = dowrite(name, rnum);
86
+ return rv;
87
+ }
88
+
89
+
90
+ /* parse arguments of read command */
91
+ int runread(int argc, char **argv){
92
+ char *name, *rstr;
93
+ int i, rnum, rv;
94
+ name = NULL;
95
+ rstr = NULL;
96
+ rnum = 0;
97
+ for(i = 2; i < argc; i++){
98
+ if(!name && argv[i][0] == '-'){
99
+ usage();
100
+ } else if(!name){
101
+ name = argv[i];
102
+ } else if(!rstr){
103
+ rstr = argv[i];
104
+ } else {
105
+ usage();
106
+ }
107
+ }
108
+ if(!name || !rstr) usage();
109
+ rnum = atoi(rstr);
110
+ if(rnum < 1) usage();
111
+ rv = doread(name, rnum);
112
+ return rv;
113
+ }
114
+
115
+
116
+ /* perform write command */
117
+ int dowrite(char *name, int rnum){
118
+ struct cdb_make cdb;
119
+ int i, fd, err, len;
120
+ char buf[32];
121
+ if(showprgr) printf("<Writing Test>\n name=%s rnum=%d\n\n", name, rnum);
122
+ /* open a database */
123
+ if((fd = open(name, O_RDWR | O_CREAT | O_TRUNC, 0644)) == -1){
124
+ perror("open");
125
+ return 1;
126
+ }
127
+ if(cdb_make_start(&cdb, fd) == -1){
128
+ perror("cdb_make_start");
129
+ close(fd);
130
+ return 1;
131
+ }
132
+ err = FALSE;
133
+ /* loop for each record */
134
+ for(i = 1; i <= rnum; i++){
135
+ /* store a record */
136
+ len = sprintf(buf, "%08d", i);
137
+ if(cdb_make_add(&cdb, buf, len, buf, len) == -1){
138
+ perror("cdb_add");
139
+ err = TRUE;
140
+ break;
141
+ }
142
+ /* print progression */
143
+ if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
144
+ putchar('.');
145
+ fflush(stdout);
146
+ if(i == rnum || i % (rnum / 10) == 0){
147
+ printf(" (%08d)\n", i);
148
+ fflush(stdout);
149
+ }
150
+ }
151
+ }
152
+ /* close the database */
153
+ if(cdb_make_finish(&cdb) == -1){
154
+ perror("cdb_make_finish");
155
+ close(fd);
156
+ return 1;
157
+ }
158
+ if(close(fd) == -1){
159
+ perror("close");
160
+ return 1;
161
+ }
162
+ if(showprgr && !err) printf("ok\n\n");
163
+ return err ? 1 : 0;
164
+ }
165
+
166
+
167
+ /* perform read command */
168
+ int doread(char *name, int rnum){
169
+ struct cdb cdb;
170
+ int i, fd, err, len;
171
+ char buf[RECBUFSIZ], *val;
172
+ if(showprgr) printf("<Reading Test>\n name=%s rnum=%d\n\n", name, rnum);
173
+ /* open a database */
174
+ if((fd = open(name, O_RDONLY, 0644)) == -1){
175
+ perror("open");
176
+ return 1;
177
+ }
178
+ cdb_init(&cdb, fd);
179
+ err = FALSE;
180
+ /* loop for each record */
181
+ for(i = 1; i <= rnum; i++){
182
+ /* retrieve a record */
183
+ len = sprintf(buf, "%08d", i);
184
+ if(cdb_find(&cdb, buf, len) == 0){
185
+ perror("cdb_find");
186
+ err = TRUE;
187
+ break;
188
+ }
189
+ len = cdb_datalen(&cdb);
190
+ if(!(val = malloc(len + 1))){
191
+ perror("malloc");
192
+ err = TRUE;
193
+ break;
194
+ }
195
+ cdb_read(&cdb, val, len, cdb_datapos(&cdb));
196
+ free(val);
197
+ /* print progression */
198
+ if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
199
+ putchar('.');
200
+ fflush(stdout);
201
+ if(i == rnum || i % (rnum / 10) == 0){
202
+ printf(" (%08d)\n", i);
203
+ fflush(stdout);
204
+ }
205
+ }
206
+ }
207
+ /* close the database */
208
+ cdb_free(&cdb);
209
+ if(close(fd) == -1){
210
+ perror("close");
211
+ return 1;
212
+ }
213
+ if(showprgr && !err) printf("ok\n\n");
214
+ return err ? 1 : 0;
215
+ }
216
+
217
+
218
+
219
+ /* END OF FILE */
@@ -0,0 +1,186 @@
1
+ /*************************************************************************************************
2
+ * Comparison test of SQLite and Tokyo Cabinet
3
+ *************************************************************************************************/
4
+
5
+
6
+ #include <stdio.h>
7
+ #include <stdlib.h>
8
+ #include <string.h>
9
+ #include <unistd.h>
10
+ #include <sys/time.h>
11
+ #include <assert.h>
12
+ #include <sqlite3.h>
13
+ #include <tctdb.h>
14
+
15
+ #define SQLFILE "casket.sql"
16
+ #define TCTFILE "casket.tct"
17
+ #define SQLBUFSIZ 1024
18
+ #define SAMPLENUM 10
19
+ #define RECORDNUM 1000000
20
+
21
+
22
+ /* function prototypes */
23
+ int main(int argc, char **argv);
24
+ static void test_sqlite(void);
25
+ static void test_tctdb(void);
26
+ static int myrand(void);
27
+ static int callback(void *opq, int argc, char **argv, char **colname);
28
+
29
+
30
+ /* main routine */
31
+ int main(int argc, char **argv){
32
+ test_sqlite();
33
+ test_tctdb();
34
+ return 0;
35
+ }
36
+
37
+
38
+ /* perform SQLite test */
39
+ static void test_sqlite(void){
40
+ double sum = 0.0;
41
+ for(int i = 1; i <= SAMPLENUM; i++){
42
+ unlink(SQLFILE);
43
+ sync(); sync();
44
+ printf("SQLite write sample:%d ... ", i);
45
+ fflush(stdout);
46
+ double stime = tctime();
47
+ sqlite3 *db;
48
+ if(sqlite3_open(SQLFILE, &db) != 0) assert(!__LINE__);
49
+ char sql[SQLBUFSIZ], *errmsg;
50
+ sprintf(sql, "CREATE TABLE tbl ( k TEXT PRIMARY KEY, a TEXT, b INTEGER,"
51
+ " c TEXT, d INTEGER );");
52
+ if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK) assert(!__LINE__);
53
+ sprintf(sql, "CREATE INDEX tbl_s ON tbl ( a );");
54
+ if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK) assert(!__LINE__);
55
+ sprintf(sql, "CREATE INDEX tbl_n ON tbl ( b );");
56
+ if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK) assert(!__LINE__);
57
+ sprintf(sql, "PRAGMA cache_size = %d;", RECORDNUM);
58
+ if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK) assert(!__LINE__);
59
+ sprintf(sql, "BEGIN TRANSACTION;");
60
+ if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK) assert(!__LINE__);
61
+ for(int j = 1; j <= RECORDNUM; j++){
62
+ sprintf(sql, "INSERT INTO tbl VALUES ( '%08d', '%08d', %d, '%08d', %d );",
63
+ j, j, myrand() % RECORDNUM, myrand() % RECORDNUM, j);
64
+ if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK) assert(!__LINE__);
65
+ }
66
+ sprintf(sql, "END TRANSACTION;");
67
+ if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK) assert(!__LINE__);
68
+ sqlite3_close(db);
69
+ double etime = tctime() - stime;
70
+ printf("%.6f\n", etime);
71
+ sum += etime;
72
+ }
73
+ printf("SQLite write average: %.6f\n", sum / SAMPLENUM);
74
+ sum = 0.0;
75
+ for(int i = 1; i <= SAMPLENUM; i++){
76
+ sync(); sync();
77
+ printf("SQLite read sample:%d ... ", i);
78
+ fflush(stdout);
79
+ double stime = tctime();
80
+ sqlite3 *db;
81
+ if(sqlite3_open(SQLFILE, &db) != 0) assert(!__LINE__);
82
+ char sql[SQLBUFSIZ], *errmsg;
83
+ sprintf(sql, "PRAGMA cache_size = %d;", RECORDNUM);
84
+ if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK) assert(!__LINE__);
85
+ for(int j = 1; j <= RECORDNUM; j++){
86
+ sprintf(sql, "SELECT * FROM tbl WHERE a = '%08d';", myrand() % RECORDNUM + 1);
87
+ if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK) assert(!__LINE__);
88
+ }
89
+ sqlite3_close(db);
90
+ double etime = tctime() - stime;
91
+ printf("%.6f\n", etime);
92
+ sum += etime;
93
+ }
94
+ printf("SQLite read average: %.6f\n", sum / SAMPLENUM);
95
+ }
96
+
97
+
98
+ /* perform TCHDB test */
99
+ static void test_tctdb(void){
100
+ double sum = 0.0;
101
+ for(int i = 1; i <= SAMPLENUM; i++){
102
+ unlink(TCTFILE);
103
+ sync(); sync();
104
+ printf("TCTDB write sample:%d ... ", i);
105
+ fflush(stdout);
106
+ double stime = tctime();
107
+ TCTDB *tdb = tctdbnew();
108
+ if(!tctdbtune(tdb, RECORDNUM * 2, -1, -1, 0)) assert(!__LINE__);
109
+ if(!tctdbsetcache(tdb, 0, RECORDNUM, RECORDNUM)) assert(!__LINE__);
110
+ if(!tctdbopen(tdb, TCTFILE, TDBOWRITER | TDBOCREAT | TDBOTRUNC)) assert(!__LINE__);
111
+ if(!tctdbsetindex(tdb, "a", TDBITLEXICAL)) assert(!__LINE__);
112
+ if(!tctdbsetindex(tdb, "b", TDBITDECIMAL)) assert(!__LINE__);
113
+ if(!tctdbtranbegin(tdb)) assert(!__LINE__);
114
+ char buf[SQLBUFSIZ];
115
+ int size;
116
+ for(int j = 1; j <= RECORDNUM; j++){
117
+ TCMAP *cols = tcmapnew2(7);
118
+ size = sprintf(buf, "%08d", j);
119
+ tcmapput(cols, "a", 1, buf, size);
120
+ size = sprintf(buf, "%d", myrand() % RECORDNUM);
121
+ tcmapput(cols, "b", 1, buf, size);
122
+ size = sprintf(buf, "%08d", myrand() % RECORDNUM);
123
+ tcmapput(cols, "c", 1, buf, size);
124
+ size = sprintf(buf, "%d", j);
125
+ tcmapput(cols, "d", 1, buf, size);
126
+ size = sprintf(buf, "%08d", j);
127
+ if(!tctdbput(tdb, buf, size, cols)) assert(!__LINE__);
128
+ tcmapdel(cols);
129
+ }
130
+ if(!tctdbtrancommit(tdb)) assert(!__LINE__);
131
+ if(!tctdbclose(tdb)) assert(!__LINE__);
132
+ tctdbdel(tdb);
133
+ double etime = tctime() - stime;
134
+ printf("%.6f\n", etime);
135
+ sum += etime;
136
+ }
137
+ printf("TCTDB write average: %.6f\n", sum / SAMPLENUM);
138
+ sum = 0.0;
139
+ for(int i = 1; i <= SAMPLENUM; i++){
140
+ sync(); sync();
141
+ printf("TCTDB read sample:%d ... ", i);
142
+ fflush(stdout);
143
+ double stime = tctime();
144
+ TCTDB *tdb = tctdbnew();
145
+ if(!tctdbsetcache(tdb, 0, RECORDNUM, RECORDNUM)) assert(!__LINE__);
146
+ if(!tctdbopen(tdb, TCTFILE, TDBOREADER)) assert(!__LINE__);
147
+ char buf[SQLBUFSIZ];
148
+ for(int j = 1; j <= RECORDNUM; j++){
149
+ TDBQRY *qry = tctdbqrynew(tdb);
150
+ sprintf(buf, "%08d", myrand() % RECORDNUM + 1);
151
+ tctdbqryaddcond(qry, "a", TDBQCSTREQ, buf);
152
+ TCLIST *res = tctdbqrysearch(qry);
153
+ for(int k = 0; k < tclistnum(res); k++){
154
+ int ksiz;
155
+ const char *kbuf = tclistval(res, k, &ksiz);
156
+ TCMAP *cols = tctdbget(tdb, kbuf, ksiz);
157
+ if(!cols) assert(!__LINE__);
158
+ tcmapdel(cols);
159
+ }
160
+ tclistdel(res);
161
+ tctdbqrydel(qry);
162
+ }
163
+ if(!tctdbclose(tdb)) assert(!__LINE__);
164
+ double etime = tctime() - stime;
165
+ printf("%.6f\n", etime);
166
+ sum += etime;
167
+ }
168
+ printf("TCTDB read average: %.6f\n", sum / SAMPLENUM);
169
+ }
170
+
171
+
172
+ /* generate a random number */
173
+ static int myrand(void){
174
+ static int cnt = 0;
175
+ return (lrand48() + cnt++) & 0x7FFFFFFF;
176
+ }
177
+
178
+
179
+ /* iterator of SQLite */
180
+ static int callback(void *opq, int argc, char **argv, char **colname){
181
+ return 0;
182
+ }
183
+
184
+
185
+
186
+ /* END OF FILE */
@@ -0,0 +1,216 @@
1
+ /*************************************************************************************************
2
+ * Writing test of GNU Database Manager
3
+ *************************************************************************************************/
4
+
5
+
6
+ #include <gdbm.h>
7
+ #include <stdlib.h>
8
+ #include <stdio.h>
9
+ #include <string.h>
10
+
11
+ #undef TRUE
12
+ #define TRUE 1 /* boolean true */
13
+ #undef FALSE
14
+ #define FALSE 0 /* boolean false */
15
+
16
+ #define RECBUFSIZ 32 /* buffer for records */
17
+ #define CACHESIZE 16 /* cache size */
18
+
19
+
20
+ /* global variables */
21
+ const char *progname; /* program name */
22
+ int showprgr; /* whether to show progression */
23
+
24
+
25
+ /* function prototypes */
26
+ int main(int argc, char **argv);
27
+ void usage(void);
28
+ int runwrite(int argc, char **argv);
29
+ int runread(int argc, char **argv);
30
+ int dowrite(char *name, int rnum);
31
+ int doread(char *name, int rnum);
32
+
33
+
34
+ /* main routine */
35
+ int main(int argc, char **argv){
36
+ int rv;
37
+ progname = argv[0];
38
+ showprgr = TRUE;
39
+ if(getenv("HIDEPRGR")) showprgr = FALSE;
40
+ if(argc < 2) usage();
41
+ rv = 0;
42
+ if(!strcmp(argv[1], "write")){
43
+ rv = runwrite(argc, argv);
44
+ } else if(!strcmp(argv[1], "read")){
45
+ rv = runread(argc, argv);
46
+ } else {
47
+ usage();
48
+ }
49
+ return rv;
50
+ }
51
+
52
+
53
+ /* print the usage and exit */
54
+ void usage(void){
55
+ fprintf(stderr, "%s: test cases for GNU Database Manager\n", progname);
56
+ fprintf(stderr, "\n");
57
+ fprintf(stderr, "usage:\n");
58
+ fprintf(stderr, " %s write name rnum\n", progname);
59
+ fprintf(stderr, " %s read name rnum\n", progname);
60
+ fprintf(stderr, "\n");
61
+ exit(1);
62
+ }
63
+
64
+
65
+ /* parse arguments of write command */
66
+ int runwrite(int argc, char **argv){
67
+ char *name, *rstr;
68
+ int i, rnum, rv;
69
+ name = NULL;
70
+ rstr = NULL;
71
+ rnum = 0;
72
+ for(i = 2; i < argc; i++){
73
+ if(!name && argv[i][0] == '-'){
74
+ usage();
75
+ } else if(!name){
76
+ name = argv[i];
77
+ } else if(!rstr){
78
+ rstr = argv[i];
79
+ } else {
80
+ usage();
81
+ }
82
+ }
83
+ if(!name || !rstr) usage();
84
+ rnum = atoi(rstr);
85
+ if(rnum < 1) usage();
86
+ rv = dowrite(name, rnum);
87
+ return rv;
88
+ }
89
+
90
+
91
+ /* parse arguments of read command */
92
+ int runread(int argc, char **argv){
93
+ char *name, *rstr;
94
+ int i, rnum, rv;
95
+ name = NULL;
96
+ rstr = NULL;
97
+ rnum = 0;
98
+ for(i = 2; i < argc; i++){
99
+ if(!name && argv[i][0] == '-'){
100
+ usage();
101
+ } else if(!name){
102
+ name = argv[i];
103
+ } else if(!rstr){
104
+ rstr = argv[i];
105
+ } else {
106
+ usage();
107
+ }
108
+ }
109
+ if(!name || !rstr) usage();
110
+ rnum = atoi(rstr);
111
+ if(rnum < 1) usage();
112
+ rv = doread(name, rnum);
113
+ return rv;
114
+ }
115
+
116
+
117
+ /* perform write command */
118
+ int dowrite(char *name, int rnum){
119
+ GDBM_FILE dbf;
120
+ datum key, content;
121
+ int i, err, optval, len;
122
+ char buf[RECBUFSIZ];
123
+ if(showprgr) printf("<Writing Test>\n name=%s rnum=%d\n\n", name, rnum);
124
+ /* open a database */
125
+ if(!(dbf = gdbm_open(name, 0, GDBM_NEWDB, 00644, NULL))){
126
+ fprintf(stderr, "gdbm_open failed\n");
127
+ return 1;
128
+ }
129
+ optval = CACHESIZE;
130
+ if(gdbm_setopt(dbf, GDBM_CACHESIZE, &optval, sizeof(int)) != 0){
131
+ fprintf(stderr, "gdbm_setopt failed\n");
132
+ gdbm_close(dbf);
133
+ return 1;
134
+ }
135
+ err = FALSE;
136
+ /* loop for each record */
137
+ for(i = 1; i <= rnum; i++){
138
+ len = sprintf(buf, "%08d", i);
139
+ key.dptr = buf;
140
+ key.dsize = len;
141
+ content.dptr = buf;
142
+ content.dsize = len;
143
+ /* store a record */
144
+ if(gdbm_store(dbf, key, content, GDBM_REPLACE) != 0){
145
+ fprintf(stderr, "gdbm_store failed\n");
146
+ err = TRUE;
147
+ break;
148
+ }
149
+ /* print progression */
150
+ if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
151
+ putchar('.');
152
+ fflush(stdout);
153
+ if(i == rnum || i % (rnum / 10) == 0){
154
+ printf(" (%08d)\n", i);
155
+ fflush(stdout);
156
+ }
157
+ }
158
+ }
159
+ /* close the database */
160
+ gdbm_close(dbf);
161
+ if(showprgr && !err) printf("ok\n\n");
162
+ return err ? 1 : 0;
163
+ }
164
+
165
+
166
+ /* perform read command */
167
+ int doread(char *name, int rnum){
168
+ GDBM_FILE dbf;
169
+ datum key, content;
170
+ int i, err, optval, len;
171
+ char buf[RECBUFSIZ];
172
+ if(showprgr) printf("<Reading Test>\n name=%s rnum=%d\n\n", name, rnum);
173
+ /* open a database */
174
+ if(!(dbf = gdbm_open(name, 0, GDBM_READER, 00644, NULL))){
175
+ fprintf(stderr, "gdbm_open failed\n");
176
+ return 1;
177
+ }
178
+ optval = CACHESIZE;
179
+ if(gdbm_setopt(dbf, GDBM_CACHESIZE, &optval, sizeof(int)) != 0){
180
+ fprintf(stderr, "gdbm_setopt failed\n");
181
+ gdbm_close(dbf);
182
+ return 1;
183
+ }
184
+ err = FALSE;
185
+ /* loop for each record */
186
+ for(i = 1; i <= rnum; i++){
187
+ /* retrieve a record */
188
+ len = sprintf(buf, "%08d", i);
189
+ key.dptr = buf;
190
+ key.dsize = len;
191
+ content = gdbm_fetch(dbf, key);
192
+ if(!content.dptr){
193
+ fprintf(stderr, "gdbm_fetch failed\n");
194
+ err = TRUE;
195
+ break;
196
+ }
197
+ free(content.dptr);
198
+ /* print progression */
199
+ if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
200
+ putchar('.');
201
+ fflush(stdout);
202
+ if(i == rnum || i % (rnum / 10) == 0){
203
+ printf(" (%08d)\n", i);
204
+ fflush(stdout);
205
+ }
206
+ }
207
+ }
208
+ /* close the database */
209
+ gdbm_close(dbf);
210
+ if(showprgr && !err) printf("ok\n\n");
211
+ return err ? 1 : 0;
212
+ }
213
+
214
+
215
+
216
+ /* END OF FILE */