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,801 @@
1
+ /*************************************************************************************************
2
+ * The remote database API of Tokyo Tyrant
3
+ * Copyright (C) 2006-2009 Mikio Hirabayashi
4
+ * This file is part of Tokyo Tyrant.
5
+ * Tokyo Tyrant is free software; you can redistribute it and/or modify it under the terms of
6
+ * the GNU Lesser General Public License as published by the Free Software Foundation; either
7
+ * version 2.1 of the License or any later version. Tokyo Tyrant is distributed in the hope
8
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10
+ * License for more details.
11
+ * You should have received a copy of the GNU Lesser General Public License along with Tokyo
12
+ * Tyrant; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
13
+ * Boston, MA 02111-1307 USA.
14
+ *************************************************************************************************/
15
+
16
+
17
+ #ifndef _TCRDB_H /* duplication check */
18
+ #define _TCRDB_H
19
+
20
+ #if defined(__cplusplus)
21
+ #define __TCRDB_CLINKAGEBEGIN extern "C" {
22
+ #define __TCRDB_CLINKAGEEND }
23
+ #else
24
+ #define __TCRDB_CLINKAGEBEGIN
25
+ #define __TCRDB_CLINKAGEEND
26
+ #endif
27
+ __TCRDB_CLINKAGEBEGIN
28
+
29
+
30
+ #include <ttutil.h>
31
+
32
+
33
+
34
+ /*************************************************************************************************
35
+ * API
36
+ *************************************************************************************************/
37
+
38
+
39
+ typedef struct { /* type of structure for a remote database */
40
+ pthread_mutex_t mmtx; /* mutex for method */
41
+ pthread_key_t eckey; /* key for thread specific error code */
42
+ char *host; /* host name */
43
+ int port; /* port number */
44
+ char *expr; /* simple server expression */
45
+ int fd; /* file descriptor */
46
+ TTSOCK *sock; /* socket object */
47
+ double timeout; /* timeout */
48
+ int opts; /* options */
49
+ } TCRDB;
50
+
51
+ enum { /* enumeration for error codes */
52
+ TTESUCCESS, /* success */
53
+ TTEINVALID, /* invalid operation */
54
+ TTENOHOST, /* host not found */
55
+ TTEREFUSED, /* connection refused */
56
+ TTESEND, /* send error */
57
+ TTERECV, /* recv error */
58
+ TTEKEEP, /* existing record */
59
+ TTENOREC, /* no record found */
60
+ TTEMISC = 9999 /* miscellaneous error */
61
+ };
62
+
63
+ enum { /* enumeration for tuning options */
64
+ RDBTRECON = 1 << 0 /* reconnect automatically */
65
+ };
66
+
67
+ enum { /* enumeration for scripting extension options */
68
+ RDBXOLCKREC = 1 << 0, /* record locking */
69
+ RDBXOLCKGLB = 1 << 1 /* global locking */
70
+ };
71
+
72
+ enum { /* enumeration for restore options */
73
+ RDBROCHKCON = 1 << 0 /* consistency checking */
74
+ };
75
+
76
+ enum { /* enumeration for miscellaneous operation options */
77
+ RDBMONOULOG = 1 << 0 /* omission of update log */
78
+ };
79
+
80
+
81
+ /* Get the message string corresponding to an error code.
82
+ `ecode' specifies the error code.
83
+ The return value is the message string of the error code. */
84
+ const char *tcrdberrmsg(int ecode);
85
+
86
+
87
+ /* Create a remote database object.
88
+ The return value is the new remote database object. */
89
+ TCRDB *tcrdbnew(void);
90
+
91
+
92
+ /* Delete a remote database object.
93
+ `rdb' specifies the remote database object. */
94
+ void tcrdbdel(TCRDB *rdb);
95
+
96
+
97
+ /* Get the last happened error code of a remote database object.
98
+ `rdb' specifies the remote database object.
99
+ The return value is the last happened error code.
100
+ The following error code is defined: `TTESUCCESS' for success, `TTEINVALID' for invalid
101
+ operation, `TTENOHOST' for host not found, `TTEREFUSED' for connection refused, `TTESEND' for
102
+ send error, `TTERECV' for recv error, `TTEKEEP' for existing record, `TTENOREC' for no record
103
+ found, `TTEMISC' for miscellaneous error. */
104
+ int tcrdbecode(TCRDB *rdb);
105
+
106
+
107
+ /* Set the tuning parameters of a hash database object.
108
+ `rdb' specifies the remote database object.
109
+ `timeout' specifies the timeout of each query in seconds. If it is not more than 0, the
110
+ timeout is not specified.
111
+ `opts' specifies options by bitwise-or: `RDBTRECON' specifies that the connection is recovered
112
+ automatically when it is disconnected.
113
+ If successful, the return value is true, else, it is false.
114
+ Note that the tuning parameters should be set before the database is opened. */
115
+ bool tcrdbtune(TCRDB *rdb, double timeout, int opts);
116
+
117
+
118
+ /* Open a remote database.
119
+ `rdb' specifies the remote database object.
120
+ `host' specifies the name or the address of the server.
121
+ `port' specifies the port number. If it is not more than 0, UNIX domain socket is used and
122
+ the path of the socket file is specified by the host parameter.
123
+ If successful, the return value is true, else, it is false. */
124
+ bool tcrdbopen(TCRDB *rdb, const char *host, int port);
125
+
126
+
127
+ /* Open a remote database with a simple server expression.
128
+ `rdb' specifies the remote database object.
129
+ `expr' specifies the simple server expression. It is composed of two substrings separated
130
+ by ":". The former field specifies the name or the address of the server. The latter field
131
+ specifies the port number. If the latter field is omitted, the default port number is
132
+ specified.
133
+ If successful, the return value is true, else, it is false. */
134
+ bool tcrdbopen2(TCRDB *rdb, const char *expr);
135
+
136
+
137
+ /* Close a remote database object.
138
+ `rdb' specifies the remote database object.
139
+ If successful, the return value is true, else, it is false. */
140
+ bool tcrdbclose(TCRDB *rdb);
141
+
142
+
143
+ /* Store a record into a remote database object.
144
+ `rdb' specifies the remote database object.
145
+ `kbuf' specifies the pointer to the region of the key.
146
+ `ksiz' specifies the size of the region of the key.
147
+ `vbuf' specifies the pointer to the region of the value.
148
+ `vsiz' specifies the size of the region of the value.
149
+ If successful, the return value is true, else, it is false.
150
+ If a record with the same key exists in the database, it is overwritten. */
151
+ bool tcrdbput(TCRDB *rdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);
152
+
153
+
154
+ /* Store a string record into a remote object.
155
+ `rdb' specifies the remote database object.
156
+ `kstr' specifies the string of the key.
157
+ `vstr' specifies the string of the value.
158
+ If successful, the return value is true, else, it is false.
159
+ If a record with the same key exists in the database, it is overwritten. */
160
+ bool tcrdbput2(TCRDB *rdb, const char *kstr, const char *vstr);
161
+
162
+
163
+ /* Store a new record into a remote database object.
164
+ `rdb' specifies the remote database object.
165
+ `kbuf' specifies the pointer to the region of the key.
166
+ `ksiz' specifies the size of the region of the key.
167
+ `vbuf' specifies the pointer to the region of the value.
168
+ `vsiz' specifies the size of the region of the value.
169
+ If successful, the return value is true, else, it is false.
170
+ If a record with the same key exists in the database, this function has no effect. */
171
+ bool tcrdbputkeep(TCRDB *rdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);
172
+
173
+
174
+ /* Store a new string record into a remote database object.
175
+ `rdb' specifies the remote database object.
176
+ `kstr' specifies the string of the key.
177
+ `vstr' specifies the string of the value.
178
+ If successful, the return value is true, else, it is false.
179
+ If a record with the same key exists in the database, this function has no effect. */
180
+ bool tcrdbputkeep2(TCRDB *rdb, const char *kstr, const char *vstr);
181
+
182
+
183
+ /* Concatenate a value at the end of the existing record in a remote database object.
184
+ `rdb' specifies the remote database object.
185
+ `kbuf' specifies the pointer to the region of the key.
186
+ `ksiz' specifies the size of the region of the key.
187
+ `vbuf' specifies the pointer to the region of the value.
188
+ `vsiz' specifies the size of the region of the value.
189
+ If successful, the return value is true, else, it is false.
190
+ If there is no corresponding record, a new record is created. */
191
+ bool tcrdbputcat(TCRDB *rdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);
192
+
193
+
194
+ /* Concatenate a string value at the end of the existing record in a remote database object.
195
+ `rdb' specifies the remote database object.
196
+ `kstr' specifies the string of the key.
197
+ `vstr' specifies the string of the value.
198
+ If successful, the return value is true, else, it is false.
199
+ If there is no corresponding record, a new record is created. */
200
+ bool tcrdbputcat2(TCRDB *rdb, const char *kstr, const char *vstr);
201
+
202
+
203
+ /* Concatenate a value at the end of the existing record and shift it to the left.
204
+ `rdb' specifies the remote database object.
205
+ `kbuf' specifies the pointer to the region of the key.
206
+ `ksiz' specifies the size of the region of the key.
207
+ `vbuf' specifies the pointer to the region of the value.
208
+ `vsiz' specifies the size of the region of the value.
209
+ `width' specifies the width of the record.
210
+ If successful, the return value is true, else, it is false.
211
+ If there is no corresponding record, a new record is created. */
212
+ bool tcrdbputshl(TCRDB *rdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz, int width);
213
+
214
+
215
+ /* Concatenate a string value at the end of the existing record and shift it to the left.
216
+ `rdb' specifies the remote database object.
217
+ `kstr' specifies the string of the key.
218
+ `vstr' specifies the string of the value.
219
+ `width' specifies the width of the record.
220
+ If successful, the return value is true, else, it is false.
221
+ If there is no corresponding record, a new record is created. */
222
+ bool tcrdbputshl2(TCRDB *rdb, const char *kstr, const char *vstr, int width);
223
+
224
+
225
+ /* Store a record into a remote database object without response from the server.
226
+ `rdb' specifies the remote database object.
227
+ `kbuf' specifies the pointer to the region of the key.
228
+ `ksiz' specifies the size of the region of the key.
229
+ `vbuf' specifies the pointer to the region of the value.
230
+ `vsiz' specifies the size of the region of the value.
231
+ If successful, the return value is true, else, it is false.
232
+ If a record with the same key exists in the database, it is overwritten. */
233
+ bool tcrdbputnr(TCRDB *rdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);
234
+
235
+
236
+ /* Store a string record into a remote object without response from the server.
237
+ `rdb' specifies the remote database object.
238
+ `kstr' specifies the string of the key.
239
+ `vstr' specifies the string of the value.
240
+ If successful, the return value is true, else, it is false.
241
+ If a record with the same key exists in the database, it is overwritten. */
242
+ bool tcrdbputnr2(TCRDB *rdb, const char *kstr, const char *vstr);
243
+
244
+
245
+ /* Remove a record of a remote database object.
246
+ `rdb' specifies the remote database object.
247
+ `kbuf' specifies the pointer to the region of the key.
248
+ `ksiz' specifies the size of the region of the key.
249
+ If successful, the return value is true, else, it is false. */
250
+ bool tcrdbout(TCRDB *rdb, const void *kbuf, int ksiz);
251
+
252
+
253
+ /* Remove a string record of a remote database object.
254
+ `rdb' specifies the remote database object.
255
+ `kstr' specifies the string of the key.
256
+ If successful, the return value is true, else, it is false. */
257
+ bool tcrdbout2(TCRDB *rdb, const char *kstr);
258
+
259
+
260
+ /* Retrieve a record in a remote database object.
261
+ `rdb' specifies the remote database object.
262
+ `kbuf' specifies the pointer to the region of the key.
263
+ `ksiz' specifies the size of the region of the key.
264
+ `sp' specifies the pointer to the variable into which the size of the region of the return
265
+ value is assigned.
266
+ If successful, the return value is the pointer to the region of the value of the corresponding
267
+ record. `NULL' is returned if no record corresponds.
268
+ Because an additional zero code is appended at the end of the region of the return value,
269
+ the return value can be treated as a character string. Because the region of the return
270
+ value is allocated with the `malloc' call, it should be released with the `free' call when
271
+ it is no longer in use. */
272
+ void *tcrdbget(TCRDB *rdb, const void *kbuf, int ksiz, int *sp);
273
+
274
+
275
+ /* Retrieve a string record in a remote database object.
276
+ `rdb' specifies the remote database object.
277
+ `kstr' specifies the string of the key.
278
+ If successful, the return value is the string of the value of the corresponding record.
279
+ `NULL' is returned if no record corresponds.
280
+ Because the region of the return value is allocated with the `malloc' call, it should be
281
+ released with the `free' call when it is no longer in use. */
282
+ char *tcrdbget2(TCRDB *rdb, const char *kstr);
283
+
284
+
285
+ /* Retrieve records in a remote database object.
286
+ `rdb' specifies the remote database object.
287
+ `recs' specifies a map object containing the retrieval keys. As a result of this function,
288
+ keys existing in the database have the corresponding values and keys not existing in the
289
+ database are removed.
290
+ If successful, the return value is true, else, it is false. */
291
+ bool tcrdbget3(TCRDB *rdb, TCMAP *recs);
292
+
293
+
294
+ /* Get the size of the value of a record in a remote database object.
295
+ `rdb' specifies the remote database object.
296
+ `kbuf' specifies the pointer to the region of the key.
297
+ `ksiz' specifies the size of the region of the key.
298
+ If successful, the return value is the size of the value of the corresponding record, else,
299
+ it is -1. */
300
+ int tcrdbvsiz(TCRDB *rdb, const void *kbuf, int ksiz);
301
+
302
+
303
+ /* Get the size of the value of a string record in a remote database object.
304
+ `rdb' specifies the remote database object.
305
+ `kstr' specifies the string of the key.
306
+ If successful, the return value is the size of the value of the corresponding record, else,
307
+ it is -1. */
308
+ int tcrdbvsiz2(TCRDB *rdb, const char *kstr);
309
+
310
+
311
+ /* Initialize the iterator of a remote database object.
312
+ `rdb' specifies the remote database object.
313
+ If successful, the return value is true, else, it is false.
314
+ The iterator is used in order to access the key of every record stored in a database. */
315
+ bool tcrdbiterinit(TCRDB *rdb);
316
+
317
+
318
+ /* Get the next key of the iterator of a remote database object.
319
+ `rdb' specifies the remote database object.
320
+ `sp' specifies the pointer to the variable into which the size of the region of the return
321
+ value is assigned.
322
+ If successful, the return value is the pointer to the region of the next key, else, it is
323
+ `NULL'. `NULL' is returned when no record is to be get out of the iterator.
324
+ Because an additional zero code is appended at the end of the region of the return value, the
325
+ return value can be treated as a character string. Because the region of the return value is
326
+ allocated with the `malloc' call, it should be released with the `free' call when it is no
327
+ longer in use. The iterator can be updated by multiple connections and then it is not assured
328
+ that every record is traversed. */
329
+ void *tcrdbiternext(TCRDB *rdb, int *sp);
330
+
331
+
332
+ /* Get the next key string of the iterator of a remote database object.
333
+ `rdb' specifies the remote database object.
334
+ If successful, the return value is the string of the next key, else, it is `NULL'. `NULL' is
335
+ returned when no record is to be get out of the iterator.
336
+ Because the region of the return value is allocated with the `malloc' call, it should be
337
+ released with the `free' call when it is no longer in use. The iterator can be updated by
338
+ multiple connections and then it is not assured that every record is traversed. */
339
+ char *tcrdbiternext2(TCRDB *rdb);
340
+
341
+
342
+ /* Get forward matching keys in a remote database object.
343
+ `rdb' specifies the remote database object.
344
+ `pbuf' specifies the pointer to the region of the prefix.
345
+ `psiz' specifies the size of the region of the prefix.
346
+ `max' specifies the maximum number of keys to be fetched. If it is negative, no limit is
347
+ specified.
348
+ The return value is a list object of the corresponding keys. This function does never fail.
349
+ It returns an empty list even if no key corresponds.
350
+ Because the object of the return value is created with the function `tclistnew', it should be
351
+ deleted with the function `tclistdel' when it is no longer in use. */
352
+ TCLIST *tcrdbfwmkeys(TCRDB *rdb, const void *pbuf, int psiz, int max);
353
+
354
+
355
+ /* Get forward matching string keys in a remote database object.
356
+ `rdb' specifies the remote database object.
357
+ `pstr' specifies the string of the prefix.
358
+ `max' specifies the maximum number of keys to be fetched. If it is negative, no limit is
359
+ specified.
360
+ The return value is a list object of the corresponding keys. This function does never fail.
361
+ It returns an empty list even if no key corresponds.
362
+ Because the object of the return value is created with the function `tclistnew', it should be
363
+ deleted with the function `tclistdel' when it is no longer in use. */
364
+ TCLIST *tcrdbfwmkeys2(TCRDB *rdb, const char *pstr, int max);
365
+
366
+
367
+ /* Add an integer to a record in a remote database object.
368
+ `rdb' specifies the remote database object.
369
+ `kbuf' specifies the pointer to the region of the key.
370
+ `ksiz' specifies the size of the region of the key.
371
+ `num' specifies the additional value.
372
+ If successful, the return value is the summation value, else, it is `INT_MIN'.
373
+ If the corresponding record exists, the value is treated as an integer and is added to. If no
374
+ record corresponds, a new record of the additional value is stored. */
375
+ int tcrdbaddint(TCRDB *rdb, const void *kbuf, int ksiz, int num);
376
+
377
+
378
+ /* Add a real number to a record in a remote database object.
379
+ `rdb' specifies the remote database object.
380
+ `kbuf' specifies the pointer to the region of the key.
381
+ `ksiz' specifies the size of the region of the key.
382
+ `num' specifies the additional value.
383
+ If successful, the return value is the summation value, else, it is Not-a-Number.
384
+ If the corresponding record exists, the value is treated as a real number and is added to. If
385
+ no record corresponds, a new record of the additional value is stored. */
386
+ double tcrdbadddouble(TCRDB *rdb, const void *kbuf, int ksiz, double num);
387
+
388
+
389
+ /* Call a function of the scripting language extension.
390
+ `rdb' specifies the remote database object.
391
+ `name' specifies the function name.
392
+ `opts' specifies options by bitwise-or: `RDBXOLCKREC' for record locking, `RDBXOLCKGLB' for
393
+ global locking.
394
+ `kbuf' specifies the pointer to the region of the key.
395
+ `ksiz' specifies the size of the region of the key.
396
+ `vbuf' specifies the pointer to the region of the value.
397
+ `vsiz' specifies the size of the region of the value.
398
+ `sp' specifies the pointer to the variable into which the size of the region of the return
399
+ value is assigned.
400
+ If successful, the return value is the pointer to the region of the value of the response.
401
+ `NULL' is returned on failure.
402
+ Because an additional zero code is appended at the end of the region of the return value,
403
+ the return value can be treated as a character string. Because the region of the return
404
+ value is allocated with the `malloc' call, it should be released with the `free' call when
405
+ it is no longer in use. */
406
+ void *tcrdbext(TCRDB *rdb, const char *name, int opts,
407
+ const void *kbuf, int ksiz, const void *vbuf, int vsiz, int *sp);
408
+
409
+
410
+ /* Call a function of the scripting language extension with string parameters.
411
+ `rdb' specifies the remote database object.
412
+ `name' specifies the function name.
413
+ `opts' specifies options by bitwise-or: `RDBXOLCKREC' for record locking, `RDBXOLCKGLB' for
414
+ global locking.
415
+ `kstr' specifies the string of the key.
416
+ `vstr' specifies the string of the value.
417
+ If successful, the return value is the string of the value of the response. `NULL' is
418
+ returned on failure.
419
+ Because the region of the return value is allocated with the `malloc' call, it should be
420
+ released with the `free' call when it is no longer in use. */
421
+ char *tcrdbext2(TCRDB *rdb, const char *name, int opts, const char *kstr, const char *vstr);
422
+
423
+
424
+ /* Synchronize updated contents of a remote database object with the file and the device.
425
+ `rdb' specifies the remote database object.
426
+ If successful, the return value is true, else, it is false. */
427
+ bool tcrdbsync(TCRDB *rdb);
428
+
429
+
430
+ /* Optimize the storage of a remove database object.
431
+ `rdb' specifies the remote database object.
432
+ `params' specifies the string of the tuning parameters. If it is `NULL', it is not used.
433
+ If successful, the return value is true, else, it is false. */
434
+ bool tcrdboptimize(TCRDB *rdb, const char *params);
435
+
436
+
437
+ /* Remove all records of a remote database object.
438
+ `rdb' specifies the remote database object.
439
+ If successful, the return value is true, else, it is false. */
440
+ bool tcrdbvanish(TCRDB *rdb);
441
+
442
+
443
+ /* Copy the database file of a remote database object.
444
+ `rdb' specifies the remote database object.
445
+ `path' specifies the path of the destination file. If it begins with `@', the trailing
446
+ substring is executed as a command line.
447
+ If successful, the return value is true, else, it is false. False is returned if the executed
448
+ command returns non-zero code.
449
+ The database file is assured to be kept synchronized and not modified while the copying or
450
+ executing operation is in progress. So, this function is useful to create a backup file of
451
+ the database file. */
452
+ bool tcrdbcopy(TCRDB *rdb, const char *path);
453
+
454
+
455
+ /* Restore the database file of a remote database object from the update log.
456
+ `rdb' specifies the remote database object.
457
+ `path' specifies the path of the update log directory.
458
+ `ts' specifies the beginning timestamp in microseconds.
459
+ `opts' specifies options by bitwise-or: `RDBROCHKCON' for consistency checking.
460
+ If successful, the return value is true, else, it is false. */
461
+ bool tcrdbrestore(TCRDB *rdb, const char *path, uint64_t ts, int opts);
462
+
463
+
464
+ /* Set the replication master of a remote database object.
465
+ `rdb' specifies the remote database object.
466
+ `host' specifies the name or the address of the server. If it is `NULL', replication of the
467
+ database is disabled.
468
+ `port' specifies the port number.
469
+ `ts' specifies the beginning timestamp in microseconds.
470
+ `opts' specifies options by bitwise-or: `RDBROCHKCON' for consistency checking.
471
+ If successful, the return value is true, else, it is false. */
472
+ bool tcrdbsetmst(TCRDB *rdb, const char *host, int port, uint64_t ts, int opts);
473
+
474
+
475
+ /* Set the replication master of a remote database object with a simple server expression.
476
+ `rdb' specifies the remote database object.
477
+ `expr' specifies the simple server expression. It is composed of two substrings separated
478
+ by ":". The former field specifies the name or the address of the server. The latter field
479
+ specifies the port number. If the latter field is omitted, the default port number is
480
+ specified.
481
+ `ts' specifies the beginning timestamp in microseconds.
482
+ `opts' specifies options by bitwise-or: `RDBROCHKCON' for consistency checking.
483
+ If successful, the return value is true, else, it is false. */
484
+ bool tcrdbsetmst2(TCRDB *rdb, const char *expr, uint64_t ts, int opts);
485
+
486
+
487
+ /* Get the simple server expression of an abstract database object.
488
+ `rdb' specifies the remote database object.
489
+ The return value is the simple server expression or `NULL' if the object does not connect to
490
+ any database server. */
491
+ const char *tcrdbexpr(TCRDB *rdb);
492
+
493
+
494
+ /* Get the number of records of a remote database object.
495
+ `rdb' specifies the remote database object.
496
+ The return value is the number of records or 0 if the object does not connect to any database
497
+ server. */
498
+ uint64_t tcrdbrnum(TCRDB *rdb);
499
+
500
+
501
+ /* Get the size of the database of a remote database object.
502
+ `rdb' specifies the remote database object.
503
+ The return value is the size of the database or 0 if the object does not connect to any
504
+ database server. */
505
+ uint64_t tcrdbsize(TCRDB *rdb);
506
+
507
+
508
+ /* Get the status string of the database of a remote database object.
509
+ `rdb' specifies the remote database object.
510
+ The return value is the status message of the database or `NULL' if the object does not
511
+ connect to any database server. The message format is TSV. The first field of each line
512
+ means the parameter name and the second field means the value.
513
+ Because the region of the return value is allocated with the `malloc' call, it should be
514
+ released with the `free' call when it is no longer in use. */
515
+ char *tcrdbstat(TCRDB *rdb);
516
+
517
+
518
+ /* Call a versatile function for miscellaneous operations of a remote database object.
519
+ `rdb' specifies the remote database object.
520
+ `name' specifies the name of the function. All databases support "putlist", "outlist", and
521
+ "getlist". "putlist" is to store records. It receives keys and values one after the other,
522
+ and returns an empty list. "outlist" is to remove records. It receives keys, and returns an
523
+ empty list. "getlist" is to retrieve records. It receives keys, and returns keys and values
524
+ of corresponding records one after the other. Table database supports "setindex", "search",
525
+ and "genuid".
526
+ `opts' specifies options by bitwise-or: `RDBMONOULOG' for omission of the update log.
527
+ `args' specifies a list object containing arguments.
528
+ If successful, the return value is a list object of the result. `NULL' is returned on failure.
529
+ Because the object of the return value is created with the function `tclistnew', it
530
+ should be deleted with the function `tclistdel' when it is no longer in use. */
531
+ TCLIST *tcrdbmisc(TCRDB *rdb, const char *name, int opts, const TCLIST *args);
532
+
533
+
534
+
535
+ /*************************************************************************************************
536
+ * table extension
537
+ *************************************************************************************************/
538
+
539
+
540
+ enum { /* enumeration for index types */
541
+ RDBITLEXICAL = TDBITLEXICAL, /* lexical string */
542
+ RDBITDECIMAL = TDBITDECIMAL, /* decimal string */
543
+ RDBITTOKEN = TDBITTOKEN, /* token inverted index */
544
+ RDBITQGRAM = TDBITQGRAM, /* q-gram inverted index */
545
+ RDBITOPT = TDBITOPT, /* optimize */
546
+ RDBITVOID = TDBITVOID, /* void */
547
+ RDBITKEEP = TDBITKEEP /* keep existing index */
548
+ };
549
+
550
+ typedef struct { /* type of structure for a query */
551
+ TCRDB *rdb; /* database object */
552
+ TCLIST *args; /* arguments for the method */
553
+ TCXSTR *hint; /* hint string */
554
+ } RDBQRY;
555
+
556
+ enum { /* enumeration for query conditions */
557
+ RDBQCSTREQ = TDBQCSTREQ, /* string is equal to */
558
+ RDBQCSTRINC = TDBQCSTRINC, /* string is included in */
559
+ RDBQCSTRBW = TDBQCSTRBW, /* string begins with */
560
+ RDBQCSTREW = TDBQCSTREW, /* string ends with */
561
+ RDBQCSTRAND = TDBQCSTRAND, /* string includes all tokens in */
562
+ RDBQCSTROR = TDBQCSTROR, /* string includes at least one token in */
563
+ RDBQCSTROREQ = TDBQCSTROREQ, /* string is equal to at least one token in */
564
+ RDBQCSTRRX = TDBQCSTRRX, /* string matches regular expressions of */
565
+ RDBQCNUMEQ = TDBQCNUMEQ, /* number is equal to */
566
+ RDBQCNUMGT = TDBQCNUMGT, /* number is greater than */
567
+ RDBQCNUMGE = TDBQCNUMGE, /* number is greater than or equal to */
568
+ RDBQCNUMLT = TDBQCNUMLT, /* number is less than */
569
+ RDBQCNUMLE = TDBQCNUMLE, /* number is less than or equal to */
570
+ RDBQCNUMBT = TDBQCNUMBT, /* number is between two tokens of */
571
+ RDBQCNUMOREQ = TDBQCNUMOREQ, /* number is equal to at least one token in */
572
+ RDBQCFTSPH = TDBQCFTSPH, /* full-text search with the phrase of */
573
+ RDBQCFTSAND = TDBQCFTSAND, /* full-text search with all tokens in */
574
+ RDBQCFTSOR = TDBQCFTSOR, /* full-text search with at least one token in */
575
+ RDBQCFTSEX = TDBQCFTSEX, /* full-text search with the compound expression of */
576
+ RDBQCNEGATE = TDBQCNEGATE, /* negation flag */
577
+ RDBQCNOIDX = TDBQCNOIDX /* no index flag */
578
+ };
579
+
580
+ enum { /* enumeration for order types */
581
+ RDBQOSTRASC = TDBQOSTRASC, /* string ascending */
582
+ RDBQOSTRDESC = TDBQOSTRDESC, /* string descending */
583
+ RDBQONUMASC = TDBQONUMASC, /* number ascending */
584
+ RDBQONUMDESC = TDBQONUMDESC /* number descending */
585
+ };
586
+
587
+ enum { /* enumeration for set operation types */
588
+ RDBMSUNION = TDBMSUNION, /* union */
589
+ RDBMSISECT = TDBMSISECT, /* intersection */
590
+ RDBMSDIFF = TDBMSDIFF /* difference */
591
+ };
592
+
593
+
594
+ /* Store a record into a remote database object.
595
+ `rdb' specifies the remote database object.
596
+ `pkbuf' specifies the pointer to the region of the primary key.
597
+ `pksiz' specifies the size of the region of the primary key.
598
+ `cols' specifies a map object containing columns.
599
+ If successful, the return value is true, else, it is false.
600
+ If a record with the same key exists in the database, it is overwritten. */
601
+ bool tcrdbtblput(TCRDB *rdb, const void *pkbuf, int pksiz, TCMAP *cols);
602
+
603
+
604
+ /* Store a new record into a remote database object.
605
+ `rdb' specifies the remote database object.
606
+ `pkbuf' specifies the pointer to the region of the primary key.
607
+ `pksiz' specifies the size of the region of the primary key.
608
+ `cols' specifies a map object containing columns.
609
+ If successful, the return value is true, else, it is false.
610
+ If a record with the same key exists in the database, this function has no effect. */
611
+ bool tcrdbtblputkeep(TCRDB *rdb, const void *pkbuf, int pksiz, TCMAP *cols);
612
+
613
+
614
+ /* Concatenate columns of the existing record in a remote database object.
615
+ `rdb' specifies the remote database object.
616
+ `pkbuf' specifies the pointer to the region of the primary key.
617
+ `pksiz' specifies the size of the region of the primary key.
618
+ `cols' specifies a map object containing columns.
619
+ If successful, the return value is true, else, it is false.
620
+ If there is no corresponding record, a new record is created. */
621
+ bool tcrdbtblputcat(TCRDB *rdb, const void *pkbuf, int pksiz, TCMAP *cols);
622
+
623
+
624
+ /* Remove a record of a remote database object.
625
+ `rdb' specifies the remote database object.
626
+ `pkbuf' specifies the pointer to the region of the primary key.
627
+ `pksiz' specifies the size of the region of the primary key.
628
+ If successful, the return value is true, else, it is false. */
629
+ bool tcrdbtblout(TCRDB *rdb, const void *pkbuf, int pksiz);
630
+
631
+
632
+ /* Retrieve a record in a remote database object.
633
+ `rdb' specifies the remote database object.
634
+ `pkbuf' specifies the pointer to the region of the primary key.
635
+ `pksiz' specifies the size of the region of the primary key.
636
+ If successful, the return value is a map object of the columns of the corresponding record.
637
+ `NULL' is returned if no record corresponds.
638
+ Because the object of the return value is created with the function `tcmapnew', it should be
639
+ deleted with the function `tcmapdel' when it is no longer in use. */
640
+ TCMAP *tcrdbtblget(TCRDB *rdb, const void *pkbuf, int pksiz);
641
+
642
+
643
+ /* Set a column index to a remote database object.
644
+ `rdb' specifies the remote database object.
645
+ `name' specifies the name of a column. If the name of an existing index is specified, the
646
+ index is rebuilt. An empty string means the primary key.
647
+ `type' specifies the index type: `RDBITLEXICAL' for lexical string, `RDBITDECIMAL' for decimal
648
+ string, `RDBITTOKEN' for token inverted index, `RDBITQGRAM' for q-gram inverted index. If it
649
+ is `RDBITOPT', the index is optimized. If it is `RDBITVOID', the index is removed. If
650
+ `RDBITKEEP' is added by bitwise-or and the index exists, this function merely returns failure.
651
+ If successful, the return value is true, else, it is false. */
652
+ bool tcrdbtblsetindex(TCRDB *rdb, const char *name, int type);
653
+
654
+
655
+ /* Generate a unique ID number of a remote database object.
656
+ `rdb' specifies the remote database object.
657
+ The return value is the new unique ID number or -1 on failure. */
658
+ int64_t tcrdbtblgenuid(TCRDB *rdb);
659
+
660
+
661
+ /* Create a query object.
662
+ `rdb' specifies the remote database object.
663
+ The return value is the new query object. */
664
+ RDBQRY *tcrdbqrynew(TCRDB *rdb);
665
+
666
+
667
+ /* Delete a query object.
668
+ `qry' specifies the query object. */
669
+ void tcrdbqrydel(RDBQRY *qry);
670
+
671
+
672
+ /* Add a narrowing condition to a query object.
673
+ `qry' specifies the query object.
674
+ `name' specifies the name of a column. An empty string means the primary key.
675
+ `op' specifies an operation type: `RDBQCSTREQ' for string which is equal to the expression,
676
+ `RDBQCSTRINC' for string which is included in the expression, `RDBQCSTRBW' for string which
677
+ begins with the expression, `RDBQCSTREW' for string which ends with the expression,
678
+ `RDBQCSTRAND' for string which includes all tokens in the expression, `RDBQCSTROR' for string
679
+ which includes at least one token in the expression, `RDBQCSTROREQ' for string which is equal
680
+ to at least one token in the expression, `RDBQCSTRRX' for string which matches regular
681
+ expressions of the expression, `RDBQCNUMEQ' for number which is equal to the expression,
682
+ `RDBQCNUMGT' for number which is greater than the expression, `RDBQCNUMGE' for number which is
683
+ greater than or equal to the expression, `RDBQCNUMLT' for number which is less than the
684
+ expression, `RDBQCNUMLE' for number which is less than or equal to the expression, `RDBQCNUMBT'
685
+ for number which is between two tokens of the expression, `RDBQCNUMOREQ' for number which is
686
+ equal to at least one token in the expression, `RDBQCFTSPH' for full-text search with the
687
+ phrase of the expression, `RDBQCFTSAND' for full-text search with all tokens in the expression,
688
+ `RDBQCFTSOR' for full-text search with at least one token in the expression, `RDBQCFTSEX' for
689
+ full-text search with the compound expression. All operations can be flagged by bitwise-or:
690
+ `RDBQCNEGATE' for negation, `RDBQCNOIDX' for using no index.
691
+ `expr' specifies an operand exression. */
692
+ void tcrdbqryaddcond(RDBQRY *qry, const char *name, int op, const char *expr);
693
+
694
+
695
+ /* Set the order of a query object.
696
+ `qry' specifies the query object.
697
+ `name' specifies the name of a column. An empty string means the primary key.
698
+ `type' specifies the order type: `RDBQOSTRASC' for string ascending, `RDBQOSTRDESC' for
699
+ string descending, `RDBQONUMASC' for number ascending, `RDBQONUMDESC' for number descending. */
700
+ void tcrdbqrysetorder(RDBQRY *qry, const char *name, int type);
701
+
702
+
703
+ /* Set the limit number of records of the result of a query object.
704
+ `qry' specifies the query object.
705
+ `max' specifies the maximum number of records of the result. If it is negative, no limit is
706
+ specified.
707
+ `skip' specifies the number of skipped records of the result. If it is not more than 0, no
708
+ record is skipped. */
709
+ void tcrdbqrysetlimit(RDBQRY *qry, int max, int skip);
710
+
711
+
712
+ /* Execute the search of a query object.
713
+ `qry' specifies the query object.
714
+ The return value is a list object of the primary keys of the corresponding records. This
715
+ function does never fail. It returns an empty list even if no record corresponds.
716
+ Because the object of the return value is created with the function `tclistnew', it should
717
+ be deleted with the function `tclistdel' when it is no longer in use. */
718
+ TCLIST *tcrdbqrysearch(RDBQRY *qry);
719
+
720
+
721
+ /* Remove each record corresponding to a query object.
722
+ `qry' specifies the query object of the database.
723
+ If successful, the return value is true, else, it is false. */
724
+ bool tcrdbqrysearchout(RDBQRY *qry);
725
+
726
+
727
+ /* Get records corresponding to the search of a query object.
728
+ `qry' specifies the query object.
729
+ The return value is a list object of zero separated columns of the corresponding records.
730
+ This function does never fail. It returns an empty list even if no record corresponds.
731
+ Each element of the list can be treated with the function `tcrdbqryrescols'. Because the
732
+ object of the return value is created with the function `tclistnew', it should be deleted with
733
+ the function `tclistdel' when it is no longer in use. */
734
+ TCLIST *tcrdbqrysearchget(RDBQRY *qry);
735
+
736
+
737
+ /* Get columns of a record in a search result.
738
+ `res' specifies a list of zero separated columns of the search result.
739
+ `index' the index of a element of the search result.
740
+ The return value is a map object containing columns.
741
+ Because the object of the return value is created with the function `tcmapnew', it should be
742
+ deleted with the function `tcmapdel' when it is no longer in use. */
743
+ TCMAP *tcrdbqryrescols(TCLIST *res, int index);
744
+
745
+
746
+ /* Get the count of corresponding records of a query object.
747
+ `qry' specifies the query object.
748
+ The return value is the count of corresponding records or 0 on failure. */
749
+ int tcrdbqrysearchcount(RDBQRY *qry);
750
+
751
+
752
+ /* Get the hint string of a query object.
753
+ `qry' specifies the query object.
754
+ The return value is the hint string.
755
+ This function should be called after the query execution by `tcrdbqrysearch' and so on. The
756
+ region of the return value is overwritten when this function is called again. */
757
+ const char *tcrdbqryhint(RDBQRY *qry);
758
+
759
+
760
+ /* Retrieve records with multiple query objects and get the set of the result.
761
+ `qrys' specifies an array of the query objects.
762
+ `num' specifies the number of elements of the array.
763
+ `type' specifies a set operation type: `RDBMSUNION' for the union set, `RDBMSISECT' for the
764
+ intersection set, `RDBMSDIFF' for the difference set.
765
+ The return value is a list object of the primary keys of the corresponding records. This
766
+ function does never fail. It returns an empty list even if no record corresponds.
767
+ If the first query object has the order setting, the result array is sorted by the order.
768
+ Because the object of the return value is created with the function `tclistnew', it should be
769
+ deleted with the function `tclistdel' when it is no longer in use. */
770
+ TCLIST *tcrdbmetasearch(RDBQRY **qrys, int num, int type);
771
+
772
+
773
+ /* Search for multiple servers in parallel.
774
+ `qrys' specifies an array of the query objects.
775
+ `num' specifies the number of elements of the array.
776
+ The return value is a list object of zero separated columns of the corresponding records.
777
+ This function does never fail. It returns an empty list even if no record corresponds.
778
+ Each element of the list can be treated with the function `tcrdbqryrescols'. Because the
779
+ object of the return value is created with the function `tclistnew', it should be deleted with
780
+ the function `tclistdel' when it is no longer in use. */
781
+ TCLIST *tcrdbparasearch(RDBQRY **qrys, int num);
782
+
783
+
784
+
785
+ /*************************************************************************************************
786
+ * features for experts
787
+ *************************************************************************************************/
788
+
789
+
790
+ /* Set the error code of a remote database object.
791
+ `rdb' specifies the remote database object.
792
+ `ecode' specifies the error code. */
793
+ void tcrdbsetecode(TCRDB *rdb, int ecode);
794
+
795
+
796
+
797
+ __TCRDB_CLINKAGEEND
798
+ #endif /* duplication check */
799
+
800
+
801
+ /* END OF FILE */