heroku-tokyotyrant 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +504 -0
- data/README.rdoc +231 -0
- data/Rakefile +72 -0
- data/benchmarks/balancer.rb +101 -0
- data/benchmarks/bulk_db.rb +74 -0
- data/benchmarks/bulk_table.rb +87 -0
- data/benchmarks/db.rb +114 -0
- data/benchmarks/table.rb +161 -0
- data/ext/extconf.rb +43 -0
- data/ext/tokyo/bin/tcamgr +0 -0
- data/ext/tokyo/bin/tcamttest +0 -0
- data/ext/tokyo/bin/tcatest +0 -0
- data/ext/tokyo/bin/tcbmgr +0 -0
- data/ext/tokyo/bin/tcbmttest +0 -0
- data/ext/tokyo/bin/tcbtest +0 -0
- data/ext/tokyo/bin/tcfmgr +0 -0
- data/ext/tokyo/bin/tcfmttest +0 -0
- data/ext/tokyo/bin/tcftest +0 -0
- data/ext/tokyo/bin/tchmgr +0 -0
- data/ext/tokyo/bin/tchmttest +0 -0
- data/ext/tokyo/bin/tchtest +0 -0
- data/ext/tokyo/bin/tcrmgr +0 -0
- data/ext/tokyo/bin/tcrmttest +0 -0
- data/ext/tokyo/bin/tcrtest +0 -0
- data/ext/tokyo/bin/tctmgr +0 -0
- data/ext/tokyo/bin/tctmttest +0 -0
- data/ext/tokyo/bin/tcttest +0 -0
- data/ext/tokyo/bin/tcucodec +0 -0
- data/ext/tokyo/bin/tcumttest +0 -0
- data/ext/tokyo/bin/tcutest +0 -0
- data/ext/tokyo/bin/ttserver +0 -0
- data/ext/tokyo/bin/ttulmgr +0 -0
- data/ext/tokyo/bin/ttultest +0 -0
- data/ext/tokyo/include/tcadb.h +548 -0
- data/ext/tokyo/include/tcbdb.h +1101 -0
- data/ext/tokyo/include/tcfdb.h +858 -0
- data/ext/tokyo/include/tchdb.h +871 -0
- data/ext/tokyo/include/tcrdb.h +801 -0
- data/ext/tokyo/include/tctdb.h +1086 -0
- data/ext/tokyo/include/tculog.h +392 -0
- data/ext/tokyo/include/tcutil.h +4184 -0
- data/ext/tokyo/include/ttutil.h +494 -0
- data/ext/tokyo/lib/libtokyocabinet.9.4.0.dylib +0 -0
- data/ext/tokyo/lib/libtokyocabinet.9.dylib +0 -0
- data/ext/tokyo/lib/libtokyocabinet.a +0 -0
- data/ext/tokyo/lib/libtokyocabinet.dylib +0 -0
- data/ext/tokyo/lib/libtokyotyrant.3.22.0.dylib +0 -0
- data/ext/tokyo/lib/libtokyotyrant.3.dylib +0 -0
- data/ext/tokyo/lib/libtokyotyrant.a +0 -0
- data/ext/tokyo/lib/libtokyotyrant.dylib +0 -0
- data/ext/tokyo/lib/pkgconfig/tokyocabinet.pc +14 -0
- data/ext/tokyo/lib/pkgconfig/tokyotyrant.pc +14 -0
- data/ext/tokyo/lib/ttskeldir.bundle +0 -0
- data/ext/tokyo/lib/ttskelmock.bundle +0 -0
- data/ext/tokyo/lib/ttskelnull.bundle +0 -0
- data/ext/tokyo/lib/ttskelproxy.bundle +0 -0
- data/ext/tokyo/libexec/tcawmgr.cgi +0 -0
- data/ext/tokyo/sbin/ttservctl +163 -0
- data/ext/tokyo/share/man/man1/tcamgr.1 +97 -0
- data/ext/tokyo/share/man/man1/tcamttest.1 +35 -0
- data/ext/tokyo/share/man/man1/tcatest.1 +55 -0
- data/ext/tokyo/share/man/man1/tcbmgr.1 +125 -0
- data/ext/tokyo/share/man/man1/tcbmttest.1 +81 -0
- data/ext/tokyo/share/man/man1/tcbtest.1 +107 -0
- data/ext/tokyo/share/man/man1/tcfmgr.1 +98 -0
- data/ext/tokyo/share/man/man1/tcfmttest.1 +62 -0
- data/ext/tokyo/share/man/man1/tcftest.1 +73 -0
- data/ext/tokyo/share/man/man1/tchmgr.1 +110 -0
- data/ext/tokyo/share/man/man1/tchmttest.1 +85 -0
- data/ext/tokyo/share/man/man1/tchtest.1 +95 -0
- data/ext/tokyo/share/man/man1/tcrmgr.1 +164 -0
- data/ext/tokyo/share/man/man1/tcrmttest.1 +55 -0
- data/ext/tokyo/share/man/man1/tcrtest.1 +89 -0
- data/ext/tokyo/share/man/man1/tctmgr.1 +140 -0
- data/ext/tokyo/share/man/man1/tctmttest.1 +92 -0
- data/ext/tokyo/share/man/man1/tcttest.1 +105 -0
- data/ext/tokyo/share/man/man1/tcucodec.1 +162 -0
- data/ext/tokyo/share/man/man1/tcumttest.1 +41 -0
- data/ext/tokyo/share/man/man1/tcutest.1 +81 -0
- data/ext/tokyo/share/man/man1/ttserver.1 +84 -0
- data/ext/tokyo/share/man/man1/ttulmgr.1 +40 -0
- data/ext/tokyo/share/man/man1/ttultest.1 +16 -0
- data/ext/tokyo/share/man/man3/tcadb.3 +676 -0
- data/ext/tokyo/share/man/man3/tcbdb.3 +1355 -0
- data/ext/tokyo/share/man/man3/tcfdb.3 +975 -0
- data/ext/tokyo/share/man/man3/tchdb.3 +898 -0
- data/ext/tokyo/share/man/man3/tclist.3 +1 -0
- data/ext/tokyo/share/man/man3/tcmap.3 +1 -0
- data/ext/tokyo/share/man/man3/tcmdb.3 +1 -0
- data/ext/tokyo/share/man/man3/tcmpool.3 +1 -0
- data/ext/tokyo/share/man/man3/tcrdb.3 +1309 -0
- data/ext/tokyo/share/man/man3/tctdb.3 +1110 -0
- data/ext/tokyo/share/man/man3/tctree.3 +1 -0
- data/ext/tokyo/share/man/man3/tculog.3 +15 -0
- data/ext/tokyo/share/man/man3/tcutil.3 +4518 -0
- data/ext/tokyo/share/man/man3/tcxstr.3 +1 -0
- data/ext/tokyo/share/man/man3/tokyocabinet.3 +132 -0
- data/ext/tokyo/share/man/man3/ttutil.3 +14 -0
- data/ext/tokyo/share/man/man8/ttservctl.8 +37 -0
- data/ext/tokyo/share/tokyocabinet/COPYING +504 -0
- data/ext/tokyo/share/tokyocabinet/ChangeLog +1252 -0
- data/ext/tokyo/share/tokyocabinet/THANKS +12 -0
- data/ext/tokyo/share/tokyocabinet/doc/benchmark.pdf +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/common.css +211 -0
- data/ext/tokyo/share/tokyocabinet/doc/icon16.png +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/index.html +156 -0
- data/ext/tokyo/share/tokyocabinet/doc/index.ja.html +197 -0
- data/ext/tokyo/share/tokyocabinet/doc/logo-ja.png +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/logo.png +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/spex-en.html +7145 -0
- data/ext/tokyo/share/tokyocabinet/doc/spex-ja.html +7476 -0
- data/ext/tokyo/share/tokyocabinet/doc/tokyoproducts.pdf +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/tokyoproducts.ppt +0 -0
- data/ext/tokyo/share/tokyotyrant/COPYING +504 -0
- data/ext/tokyo/share/tokyotyrant/ChangeLog +578 -0
- data/ext/tokyo/share/tokyotyrant/THANKS +15 -0
- data/ext/tokyo/share/tokyotyrant/doc/common.css +211 -0
- data/ext/tokyo/share/tokyotyrant/doc/index.html +79 -0
- data/ext/tokyo/share/tokyotyrant/doc/spex.html +2264 -0
- data/ext/tokyo/share/tokyotyrant/ext/mapreduce.lua +57 -0
- data/ext/tokyo/share/tokyotyrant/ext/queue.lua +55 -0
- data/ext/tokyo/share/tokyotyrant/ext/senatus.lua +532 -0
- data/ext/tokyo/share/tokyotyrant/ext/usherette.lua +438 -0
- data/ext/tokyo_tyrant.c +147 -0
- data/ext/tokyo_tyrant.h +48 -0
- data/ext/tokyo_tyrant_db.c +227 -0
- data/ext/tokyo_tyrant_db.h +8 -0
- data/ext/tokyo_tyrant_module.c +453 -0
- data/ext/tokyo_tyrant_module.h +10 -0
- data/ext/tokyo_tyrant_query.c +226 -0
- data/ext/tokyo_tyrant_query.h +9 -0
- data/ext/tokyo_tyrant_table.c +319 -0
- data/ext/tokyo_tyrant_table.h +8 -0
- data/ext/tokyocabinet-1.4.41/COPYING +504 -0
- data/ext/tokyocabinet-1.4.41/ChangeLog +1252 -0
- data/ext/tokyocabinet-1.4.41/Makefile.in +825 -0
- data/ext/tokyocabinet-1.4.41/README +38 -0
- data/ext/tokyocabinet-1.4.41/THANKS +12 -0
- data/ext/tokyocabinet-1.4.41/bros/Makefile +133 -0
- data/ext/tokyocabinet-1.4.41/bros/bdbtest.c +438 -0
- data/ext/tokyocabinet-1.4.41/bros/cdbtest.c +219 -0
- data/ext/tokyocabinet-1.4.41/bros/cmpsqltctest.c +186 -0
- data/ext/tokyocabinet-1.4.41/bros/gdbmtest.c +216 -0
- data/ext/tokyocabinet-1.4.41/bros/mapreporter +72 -0
- data/ext/tokyocabinet-1.4.41/bros/maptest.cc +677 -0
- data/ext/tokyocabinet-1.4.41/bros/ndbmtest.c +204 -0
- data/ext/tokyocabinet-1.4.41/bros/qdbmtest.c +375 -0
- data/ext/tokyocabinet-1.4.41/bros/reporter +141 -0
- data/ext/tokyocabinet-1.4.41/bros/result.xls +0 -0
- data/ext/tokyocabinet-1.4.41/bros/sdbmtest.c +204 -0
- data/ext/tokyocabinet-1.4.41/bros/sqltest.c +404 -0
- data/ext/tokyocabinet-1.4.41/bros/tctest.c +748 -0
- data/ext/tokyocabinet-1.4.41/bros/tdbtest.c +205 -0
- data/ext/tokyocabinet-1.4.41/configure +7402 -0
- data/ext/tokyocabinet-1.4.41/configure.in +362 -0
- data/ext/tokyocabinet-1.4.41/doc/benchmark.pdf +0 -0
- data/ext/tokyocabinet-1.4.41/doc/common.css +211 -0
- data/ext/tokyocabinet-1.4.41/doc/icon16.png +0 -0
- data/ext/tokyocabinet-1.4.41/doc/index.html +156 -0
- data/ext/tokyocabinet-1.4.41/doc/index.ja.html +197 -0
- data/ext/tokyocabinet-1.4.41/doc/logo-ja.png +0 -0
- data/ext/tokyocabinet-1.4.41/doc/logo.png +0 -0
- data/ext/tokyocabinet-1.4.41/doc/spex-en.html +7145 -0
- data/ext/tokyocabinet-1.4.41/doc/spex-ja.html +7476 -0
- data/ext/tokyocabinet-1.4.41/doc/tokyoproducts.pdf +0 -0
- data/ext/tokyocabinet-1.4.41/doc/tokyoproducts.ppt +0 -0
- data/ext/tokyocabinet-1.4.41/example/Makefile +113 -0
- data/ext/tokyocabinet-1.4.41/example/tcadbex.c +55 -0
- data/ext/tokyocabinet-1.4.41/example/tcbdbex.c +64 -0
- data/ext/tokyocabinet-1.4.41/example/tcfdbex.c +60 -0
- data/ext/tokyocabinet-1.4.41/example/tchdbex.c +60 -0
- data/ext/tokyocabinet-1.4.41/example/tctchat.c +97 -0
- data/ext/tokyocabinet-1.4.41/example/tctchat.tmpl +141 -0
- data/ext/tokyocabinet-1.4.41/example/tctdbex.c +85 -0
- data/ext/tokyocabinet-1.4.41/example/tctsearch.c +95 -0
- data/ext/tokyocabinet-1.4.41/example/tctsearch.tmpl +122 -0
- data/ext/tokyocabinet-1.4.41/example/tcutilex.c +77 -0
- data/ext/tokyocabinet-1.4.41/f.tsv +2 -0
- data/ext/tokyocabinet-1.4.41/lab/calccomp +118 -0
- data/ext/tokyocabinet-1.4.41/lab/datechange +56 -0
- data/ext/tokyocabinet-1.4.41/lab/diffcheck +45 -0
- data/ext/tokyocabinet-1.4.41/lab/htmltotsv +102 -0
- data/ext/tokyocabinet-1.4.41/lab/magic +19 -0
- data/ext/tokyocabinet-1.4.41/lab/printenv.cgi +27 -0
- data/ext/tokyocabinet-1.4.41/lab/stepcount +26 -0
- data/ext/tokyocabinet-1.4.41/lab/stopwatch +61 -0
- data/ext/tokyocabinet-1.4.41/lab/tabcheck +43 -0
- data/ext/tokyocabinet-1.4.41/lab/wgettsv +239 -0
- data/ext/tokyocabinet-1.4.41/lab/widthcheck +57 -0
- data/ext/tokyocabinet-1.4.41/man/htmltoman +104 -0
- data/ext/tokyocabinet-1.4.41/man/tcadb.3 +676 -0
- data/ext/tokyocabinet-1.4.41/man/tcamgr.1 +97 -0
- data/ext/tokyocabinet-1.4.41/man/tcamttest.1 +35 -0
- data/ext/tokyocabinet-1.4.41/man/tcatest.1 +55 -0
- data/ext/tokyocabinet-1.4.41/man/tcbdb.3 +1355 -0
- data/ext/tokyocabinet-1.4.41/man/tcbmgr.1 +125 -0
- data/ext/tokyocabinet-1.4.41/man/tcbmttest.1 +81 -0
- data/ext/tokyocabinet-1.4.41/man/tcbtest.1 +107 -0
- data/ext/tokyocabinet-1.4.41/man/tcfdb.3 +975 -0
- data/ext/tokyocabinet-1.4.41/man/tcfmgr.1 +98 -0
- data/ext/tokyocabinet-1.4.41/man/tcfmttest.1 +62 -0
- data/ext/tokyocabinet-1.4.41/man/tcftest.1 +73 -0
- data/ext/tokyocabinet-1.4.41/man/tchdb.3 +898 -0
- data/ext/tokyocabinet-1.4.41/man/tchmgr.1 +110 -0
- data/ext/tokyocabinet-1.4.41/man/tchmttest.1 +85 -0
- data/ext/tokyocabinet-1.4.41/man/tchtest.1 +95 -0
- data/ext/tokyocabinet-1.4.41/man/tclist.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tcmap.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tcmdb.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tcmpool.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tctdb.3 +1110 -0
- data/ext/tokyocabinet-1.4.41/man/tctmgr.1 +140 -0
- data/ext/tokyocabinet-1.4.41/man/tctmttest.1 +92 -0
- data/ext/tokyocabinet-1.4.41/man/tctree.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tcttest.1 +105 -0
- data/ext/tokyocabinet-1.4.41/man/tcucodec.1 +162 -0
- data/ext/tokyocabinet-1.4.41/man/tcumttest.1 +41 -0
- data/ext/tokyocabinet-1.4.41/man/tcutest.1 +81 -0
- data/ext/tokyocabinet-1.4.41/man/tcutil.3 +4518 -0
- data/ext/tokyocabinet-1.4.41/man/tcxstr.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tokyocabinet.3 +132 -0
- data/ext/tokyocabinet-1.4.41/md5.c +381 -0
- data/ext/tokyocabinet-1.4.41/md5.h +101 -0
- data/ext/tokyocabinet-1.4.41/myconf.c +493 -0
- data/ext/tokyocabinet-1.4.41/myconf.h +549 -0
- data/ext/tokyocabinet-1.4.41/tcadb.c +4339 -0
- data/ext/tokyocabinet-1.4.41/tcadb.h +548 -0
- data/ext/tokyocabinet-1.4.41/tcamgr.c +1019 -0
- data/ext/tokyocabinet-1.4.41/tcamttest.c +542 -0
- data/ext/tokyocabinet-1.4.41/tcatest.c +1845 -0
- data/ext/tokyocabinet-1.4.41/tcawmgr.c +482 -0
- data/ext/tokyocabinet-1.4.41/tcbdb.c +4180 -0
- data/ext/tokyocabinet-1.4.41/tcbdb.h +1101 -0
- data/ext/tokyocabinet-1.4.41/tcbmgr.c +1012 -0
- data/ext/tokyocabinet-1.4.41/tcbmttest.c +1810 -0
- data/ext/tokyocabinet-1.4.41/tcbtest.c +2586 -0
- data/ext/tokyocabinet-1.4.41/tcfdb.c +2746 -0
- data/ext/tokyocabinet-1.4.41/tcfdb.h +858 -0
- data/ext/tokyocabinet-1.4.41/tcfmgr.c +786 -0
- data/ext/tokyocabinet-1.4.41/tcfmttest.c +1220 -0
- data/ext/tokyocabinet-1.4.41/tcftest.c +1695 -0
- data/ext/tokyocabinet-1.4.41/tchdb.c +5153 -0
- data/ext/tokyocabinet-1.4.41/tchdb.h +871 -0
- data/ext/tokyocabinet-1.4.41/tchmgr.c +842 -0
- data/ext/tokyocabinet-1.4.41/tchmttest.c +1757 -0
- data/ext/tokyocabinet-1.4.41/tchtest.c +2129 -0
- data/ext/tokyocabinet-1.4.41/tctdb.c +6199 -0
- data/ext/tokyocabinet-1.4.41/tctdb.h +1086 -0
- data/ext/tokyocabinet-1.4.41/tctmgr.c +1241 -0
- data/ext/tokyocabinet-1.4.41/tctmttest.c +1563 -0
- data/ext/tokyocabinet-1.4.41/tcttest.c +2062 -0
- data/ext/tokyocabinet-1.4.41/tcucodec.c +1357 -0
- data/ext/tokyocabinet-1.4.41/tcumttest.c +578 -0
- data/ext/tokyocabinet-1.4.41/tcutest.c +1875 -0
- data/ext/tokyocabinet-1.4.41/tcutil.c +10528 -0
- data/ext/tokyocabinet-1.4.41/tcutil.h +4184 -0
- data/ext/tokyocabinet-1.4.41/tokyocabinet.idl +336 -0
- data/ext/tokyocabinet-1.4.41/tokyocabinet.pc.in +14 -0
- data/ext/tokyotyrant-1.1.39/COPYING +504 -0
- data/ext/tokyotyrant-1.1.39/ChangeLog +578 -0
- data/ext/tokyotyrant-1.1.39/Makefile.in +365 -0
- data/ext/tokyotyrant-1.1.39/README +38 -0
- data/ext/tokyotyrant-1.1.39/THANKS +15 -0
- data/ext/tokyotyrant-1.1.39/configure +6979 -0
- data/ext/tokyotyrant-1.1.39/configure.in +300 -0
- data/ext/tokyotyrant-1.1.39/doc/common.css +211 -0
- data/ext/tokyotyrant-1.1.39/doc/index.html +79 -0
- data/ext/tokyotyrant-1.1.39/doc/spex.html +2264 -0
- data/ext/tokyotyrant-1.1.39/example/Makefile +68 -0
- data/ext/tokyotyrant-1.1.39/example/httptest.pl +88 -0
- data/ext/tokyotyrant-1.1.39/example/mcftest.pl +39 -0
- data/ext/tokyotyrant-1.1.39/example/mctest.pl +43 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbex +0 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbex.c +49 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbex.o +0 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbtblex +0 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbtblex.c +79 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbtblex.o +0 -0
- data/ext/tokyotyrant-1.1.39/ext/mapreduce.lua +57 -0
- data/ext/tokyotyrant-1.1.39/ext/queue.lua +55 -0
- data/ext/tokyotyrant-1.1.39/ext/senatus.lua +532 -0
- data/ext/tokyotyrant-1.1.39/ext/usherette.lua +438 -0
- data/ext/tokyotyrant-1.1.39/lab/datechange +56 -0
- data/ext/tokyotyrant-1.1.39/lab/diffcheck +45 -0
- data/ext/tokyotyrant-1.1.39/lab/fibonacci.lua +20 -0
- data/ext/tokyotyrant-1.1.39/lab/footprint.lua +67 -0
- data/ext/tokyotyrant-1.1.39/lab/highlow.lua +88 -0
- data/ext/tokyotyrant-1.1.39/lab/killdualmaster +12 -0
- data/ext/tokyotyrant-1.1.39/lab/rundualmaster +38 -0
- data/ext/tokyotyrant-1.1.39/lab/stepcount +26 -0
- data/ext/tokyotyrant-1.1.39/lab/tabcheck +43 -0
- data/ext/tokyotyrant-1.1.39/lab/ushrtregister.pl +55 -0
- data/ext/tokyotyrant-1.1.39/lab/widthcheck +57 -0
- data/ext/tokyotyrant-1.1.39/man/htmltoman +100 -0
- data/ext/tokyotyrant-1.1.39/man/tcrdb.3 +1309 -0
- data/ext/tokyotyrant-1.1.39/man/tcrmgr.1 +164 -0
- data/ext/tokyotyrant-1.1.39/man/tcrmttest.1 +55 -0
- data/ext/tokyotyrant-1.1.39/man/tcrtest.1 +89 -0
- data/ext/tokyotyrant-1.1.39/man/tculog.3 +15 -0
- data/ext/tokyotyrant-1.1.39/man/ttservctl.8 +37 -0
- data/ext/tokyotyrant-1.1.39/man/ttserver.1 +84 -0
- data/ext/tokyotyrant-1.1.39/man/ttulmgr.1 +40 -0
- data/ext/tokyotyrant-1.1.39/man/ttultest.1 +16 -0
- data/ext/tokyotyrant-1.1.39/man/ttutil.3 +14 -0
- data/ext/tokyotyrant-1.1.39/myconf.c +169 -0
- data/ext/tokyotyrant-1.1.39/myconf.h +408 -0
- data/ext/tokyotyrant-1.1.39/scrext.c +2394 -0
- data/ext/tokyotyrant-1.1.39/scrext.h +96 -0
- data/ext/tokyotyrant-1.1.39/tcrdb.c +2637 -0
- data/ext/tokyotyrant-1.1.39/tcrdb.h +801 -0
- data/ext/tokyotyrant-1.1.39/tcrmgr.c +1559 -0
- data/ext/tokyotyrant-1.1.39/tcrmttest.c +915 -0
- data/ext/tokyotyrant-1.1.39/tcrtest.c +1542 -0
- data/ext/tokyotyrant-1.1.39/tculog.c +1211 -0
- data/ext/tokyotyrant-1.1.39/tculog.h +392 -0
- data/ext/tokyotyrant-1.1.39/tokyotyrant.idl +143 -0
- data/ext/tokyotyrant-1.1.39/tokyotyrant.pc.in +14 -0
- data/ext/tokyotyrant-1.1.39/ttservctl +163 -0
- data/ext/tokyotyrant-1.1.39/ttserver.c +3583 -0
- data/ext/tokyotyrant-1.1.39/ttskeldir.c +141 -0
- data/ext/tokyotyrant-1.1.39/ttskelmock.c +64 -0
- data/ext/tokyotyrant-1.1.39/ttskelnull.c +79 -0
- data/ext/tokyotyrant-1.1.39/ttskelproxy.c +74 -0
- data/ext/tokyotyrant-1.1.39/ttulmgr.c +266 -0
- data/ext/tokyotyrant-1.1.39/ttultest.c +371 -0
- data/ext/tokyotyrant-1.1.39/ttutil.c +1510 -0
- data/ext/tokyotyrant-1.1.39/ttutil.h +494 -0
- data/lib/tokyo_tyrant/balancer.rb +189 -0
- data/spec/ext.lua +4 -0
- data/spec/plu_db.rb +538 -0
- data/spec/spec.rb +1 -0
- data/spec/spec_base.rb +17 -0
- data/spec/start_tyrants.sh +36 -0
- data/spec/stop_tyrants.sh +9 -0
- data/spec/tokyo_tyrant_balancer_db_spec.rb +160 -0
- data/spec/tokyo_tyrant_balancer_table_spec.rb +177 -0
- data/spec/tokyo_tyrant_query_spec.rb +159 -0
- data/spec/tokyo_tyrant_spec.rb +254 -0
- data/spec/tokyo_tyrant_table_spec.rb +301 -0
- metadata +402 -0
@@ -0,0 +1,141 @@
|
|
1
|
+
#! /usr/bin/perl
|
2
|
+
|
3
|
+
#================================================================
|
4
|
+
# reporter
|
5
|
+
# Measure elapsed time and database size of DBM brothers
|
6
|
+
#================================================================
|
7
|
+
|
8
|
+
use strict;
|
9
|
+
use warnings;
|
10
|
+
use Time::HiRes qw(gettimeofday);
|
11
|
+
|
12
|
+
use constant {
|
13
|
+
RECNUM => 1000000,
|
14
|
+
TESTCOUNT => 20,
|
15
|
+
REMOVETOP => 2,
|
16
|
+
REMOVEBOTTOM => 8,
|
17
|
+
};
|
18
|
+
|
19
|
+
my @commands = (
|
20
|
+
'./tctest write casket.tch ' . RECNUM,
|
21
|
+
'./tctest read casket.tch ' . RECNUM,
|
22
|
+
'./qdbmtest write casket.qdbh ' . RECNUM,
|
23
|
+
'./qdbmtest read casket.qdbh ' . RECNUM,
|
24
|
+
'./ndbmtest write casket.ndbh ' . RECNUM,
|
25
|
+
'./ndbmtest read casket.ndbh ' . RECNUM,
|
26
|
+
'./sdbmtest write casket.sdbh ' . RECNUM,
|
27
|
+
'./sdbmtest read casket.sdbh ' . RECNUM,
|
28
|
+
'./gdbmtest write casket.gdbh ' . RECNUM,
|
29
|
+
'./gdbmtest read casket.gdbh ' . RECNUM,
|
30
|
+
'./tdbtest write casket.tdbh ' . RECNUM,
|
31
|
+
'./tdbtest read casket.tdbh ' . RECNUM,
|
32
|
+
'./cdbtest write casket.cdbh ' . RECNUM,
|
33
|
+
'./cdbtest read casket.cdbh ' . RECNUM,
|
34
|
+
'./bdbtest write casket.bdbh ' . RECNUM,
|
35
|
+
'./bdbtest read casket.bdbh ' . RECNUM,
|
36
|
+
'./tctest btwrite casket.tcb ' . RECNUM,
|
37
|
+
'./tctest btread casket.tcb ' . RECNUM,
|
38
|
+
'./tctest btwrite -rnd casket.tcb_r ' . RECNUM,
|
39
|
+
'./tctest btread -rnd casket.tcb_r ' . RECNUM,
|
40
|
+
'./qdbmtest btwrite casket.qdbb ' . RECNUM,
|
41
|
+
'./qdbmtest btread casket.qdbb ' . RECNUM,
|
42
|
+
'./qdbmtest btwrite -rnd casket.qdbb_r ' . RECNUM,
|
43
|
+
'./qdbmtest btread -rnd casket.qdbb_r ' . RECNUM,
|
44
|
+
'./bdbtest btwrite casket.bdbb ' . RECNUM,
|
45
|
+
'./bdbtest btread casket.bdbb ' . RECNUM,
|
46
|
+
'./bdbtest btwrite -rnd casket.bdbb_r ' . RECNUM,
|
47
|
+
'./bdbtest btread -rnd casket.bdbb_r ' . RECNUM,
|
48
|
+
'./tctest flwrite casket.tcf ' . RECNUM,
|
49
|
+
'./tctest flread casket.tcf ' . RECNUM,
|
50
|
+
);
|
51
|
+
|
52
|
+
my @names = (
|
53
|
+
'casket.tch',
|
54
|
+
'casket.qdbh',
|
55
|
+
'casket.ndbh',
|
56
|
+
'casket.sdbh',
|
57
|
+
'casket.gdbh',
|
58
|
+
'casket.tdbh',
|
59
|
+
'casket.cdbh',
|
60
|
+
'casket.bdbh',
|
61
|
+
'casket.tcb',
|
62
|
+
'casket.tcb_r',
|
63
|
+
'casket.qdbb',
|
64
|
+
'casket.qdbb_r',
|
65
|
+
'casket.bdbb',
|
66
|
+
'casket.bdbb_r',
|
67
|
+
'casket.tcf',
|
68
|
+
);
|
69
|
+
|
70
|
+
foreach my $name (@names){
|
71
|
+
my @paths = glob("$name*");
|
72
|
+
foreach my $path (@paths){
|
73
|
+
unlink($path);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
my @table;
|
78
|
+
foreach my $command (@commands){
|
79
|
+
system('sync ; sync');
|
80
|
+
$ENV{'HIDEPRGR'} = 1;
|
81
|
+
my @result;
|
82
|
+
for(my $i = 0; $i < TESTCOUNT; $i++){
|
83
|
+
my $stime = gettimeofday();
|
84
|
+
system("$command >/dev/null 2>&1");
|
85
|
+
$stime = gettimeofday() - $stime;
|
86
|
+
printf("%s\t%d\t%0.5f\n", $command, $i + 1, $stime);
|
87
|
+
push(@result, $stime);
|
88
|
+
}
|
89
|
+
@result = sort { $a <=> $b } @result;
|
90
|
+
for(my $i = 0; $i < REMOVETOP; $i++){
|
91
|
+
shift(@result);
|
92
|
+
}
|
93
|
+
for(my $i = 0; $i < REMOVEBOTTOM; $i++){
|
94
|
+
pop(@result);
|
95
|
+
}
|
96
|
+
my $sum = 0;
|
97
|
+
foreach my $result (@result){
|
98
|
+
$sum += $result;
|
99
|
+
}
|
100
|
+
my $avg = $sum / scalar(@result);
|
101
|
+
push(@table, [$command, $avg]);
|
102
|
+
}
|
103
|
+
|
104
|
+
printf("\n\nRESULT\n\n");
|
105
|
+
foreach my $row (@table){
|
106
|
+
printf("%s\t%0.5f\n", $$row[0], $$row[1]);
|
107
|
+
}
|
108
|
+
printf("\n");
|
109
|
+
|
110
|
+
my @sizes;
|
111
|
+
foreach my $name (@names){
|
112
|
+
my @paths = glob("$name*");
|
113
|
+
my $sum = 0;
|
114
|
+
foreach my $path (@paths){
|
115
|
+
my @sbuf = stat($path);
|
116
|
+
$sum += $sbuf[7];
|
117
|
+
}
|
118
|
+
printf("%s\t%s\n", $name, $sum);
|
119
|
+
push(@sizes, $sum);
|
120
|
+
}
|
121
|
+
printf("\n");
|
122
|
+
|
123
|
+
printf("%s,%.5f,%.5f,%d\n", "TC", $table[0][1], $table[1][1], $sizes[0]);
|
124
|
+
printf("%s,%.5f,%.5f,%d\n", "QDBM", $table[2][1], $table[3][1], $sizes[1]);
|
125
|
+
printf("%s,%.5f,%.5f,%d\n", "NDBM", $table[4][1], $table[5][1], $sizes[2]);
|
126
|
+
printf("%s,%.5f,%.5f,%d\n", "SDBM", $table[6][1], $table[7][1], $sizes[3]);
|
127
|
+
printf("%s,%.5f,%.5f,%d\n", "GDBM", $table[8][1], $table[9][1], $sizes[4]);
|
128
|
+
printf("%s,%.5f,%.5f,%d\n", "TDB", $table[10][1], $table[11][1], $sizes[5]);
|
129
|
+
printf("%s,%.5f,%.5f,%d\n", "CDB", $table[12][1], $table[13][1], $sizes[6]);
|
130
|
+
printf("%s,%.5f,%.5f,%d\n", "BDB", $table[14][1], $table[15][1], $sizes[7]);
|
131
|
+
printf("%s,%.5f,%.5f,%d\n", "TC-BT-ASC", $table[16][1], $table[17][1], $sizes[8]);
|
132
|
+
printf("%s,%.5f,%.5f,%d\n", "TC-BT-RND", $table[18][1], $table[19][1], $sizes[9]);
|
133
|
+
printf("%s,%.5f,%.5f,%d\n", "QDBM-BT-ASC", $table[20][1], $table[21][1], $sizes[10]);
|
134
|
+
printf("%s,%.5f,%.5f,%d\n", "QDBM-BT-RND", $table[22][1], $table[23][1], $sizes[11]);
|
135
|
+
printf("%s,%.5f,%.5f,%d\n", "BDB-BT-ASC", $table[24][1], $table[25][1], $sizes[12]);
|
136
|
+
printf("%s,%.5f,%.5f,%d\n", "BDB-BT-RND", $table[26][1], $table[27][1], $sizes[13]);
|
137
|
+
printf("%s,%.5f,%.5f,%d\n", "TC-FIXED", $table[28][1], $table[29][1], $sizes[14]);
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
# END OF FILE
|
Binary file
|
@@ -0,0 +1,204 @@
|
|
1
|
+
/*************************************************************************************************
|
2
|
+
* Writing test of Substitute Database Manager
|
3
|
+
*************************************************************************************************/
|
4
|
+
|
5
|
+
|
6
|
+
#include <sdbm.h>
|
7
|
+
#include <sys/types.h>
|
8
|
+
#include <fcntl.h>
|
9
|
+
#include <stdlib.h>
|
10
|
+
#include <stdio.h>
|
11
|
+
#include <string.h>
|
12
|
+
|
13
|
+
#undef TRUE
|
14
|
+
#define TRUE 1 /* boolean true */
|
15
|
+
#undef FALSE
|
16
|
+
#define FALSE 0 /* boolean false */
|
17
|
+
|
18
|
+
#define RECBUFSIZ 32 /* buffer for records */
|
19
|
+
|
20
|
+
|
21
|
+
/* global variables */
|
22
|
+
const char *progname; /* program name */
|
23
|
+
int showprgr; /* whether to show progression */
|
24
|
+
|
25
|
+
|
26
|
+
/* function prototypes */
|
27
|
+
int main(int argc, char **argv);
|
28
|
+
void usage(void);
|
29
|
+
int runwrite(int argc, char **argv);
|
30
|
+
int runread(int argc, char **argv);
|
31
|
+
int dowrite(char *name, int rnum);
|
32
|
+
int doread(char *name, int rnum);
|
33
|
+
|
34
|
+
|
35
|
+
/* main routine */
|
36
|
+
int main(int argc, char **argv){
|
37
|
+
int rv;
|
38
|
+
progname = argv[0];
|
39
|
+
showprgr = TRUE;
|
40
|
+
if(getenv("HIDEPRGR")) showprgr = FALSE;
|
41
|
+
if(argc < 2) usage();
|
42
|
+
rv = 0;
|
43
|
+
if(!strcmp(argv[1], "write")){
|
44
|
+
rv = runwrite(argc, argv);
|
45
|
+
} else if(!strcmp(argv[1], "read")){
|
46
|
+
rv = runread(argc, argv);
|
47
|
+
} else {
|
48
|
+
usage();
|
49
|
+
}
|
50
|
+
return rv;
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
/* print the usage and exit */
|
55
|
+
void usage(void){
|
56
|
+
fprintf(stderr, "%s: test cases for Substitute Database Manager\n", progname);
|
57
|
+
fprintf(stderr, "\n");
|
58
|
+
fprintf(stderr, "usage:\n");
|
59
|
+
fprintf(stderr, " %s write name rnum\n", progname);
|
60
|
+
fprintf(stderr, " %s read name rnum\n", progname);
|
61
|
+
fprintf(stderr, "\n");
|
62
|
+
exit(1);
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
/* parse arguments of write command */
|
67
|
+
int runwrite(int argc, char **argv){
|
68
|
+
char *name, *rstr;
|
69
|
+
int i, rnum, rv;
|
70
|
+
name = NULL;
|
71
|
+
rstr = NULL;
|
72
|
+
rnum = 0;
|
73
|
+
for(i = 2; i < argc; i++){
|
74
|
+
if(!name && argv[i][0] == '-'){
|
75
|
+
usage();
|
76
|
+
} else if(!name){
|
77
|
+
name = argv[i];
|
78
|
+
} else if(!rstr){
|
79
|
+
rstr = argv[i];
|
80
|
+
} else {
|
81
|
+
usage();
|
82
|
+
}
|
83
|
+
}
|
84
|
+
if(!name || !rstr) usage();
|
85
|
+
rnum = atoi(rstr);
|
86
|
+
if(rnum < 1) usage();
|
87
|
+
rv = dowrite(name, rnum);
|
88
|
+
return rv;
|
89
|
+
}
|
90
|
+
|
91
|
+
|
92
|
+
/* parse arguments of read command */
|
93
|
+
int runread(int argc, char **argv){
|
94
|
+
char *name, *rstr;
|
95
|
+
int i, rnum, rv;
|
96
|
+
name = NULL;
|
97
|
+
rstr = NULL;
|
98
|
+
rnum = 0;
|
99
|
+
for(i = 2; i < argc; i++){
|
100
|
+
if(!name && argv[i][0] == '-'){
|
101
|
+
usage();
|
102
|
+
} else if(!name){
|
103
|
+
name = argv[i];
|
104
|
+
} else if(!rstr){
|
105
|
+
rstr = argv[i];
|
106
|
+
} else {
|
107
|
+
usage();
|
108
|
+
}
|
109
|
+
}
|
110
|
+
if(!name || !rstr) usage();
|
111
|
+
rnum = atoi(rstr);
|
112
|
+
if(rnum < 1) usage();
|
113
|
+
rv = doread(name, rnum);
|
114
|
+
return rv;
|
115
|
+
}
|
116
|
+
|
117
|
+
|
118
|
+
/* perform write command */
|
119
|
+
int dowrite(char *name, int rnum){
|
120
|
+
DBM *db;
|
121
|
+
datum key, val;
|
122
|
+
int i, err, len;
|
123
|
+
char buf[RECBUFSIZ];
|
124
|
+
if(showprgr) printf("<Writing Test>\n name=%s rnum=%d\n\n", name, rnum);
|
125
|
+
/* open a database */
|
126
|
+
if(!(db = dbm_open(name, O_RDWR | O_CREAT | O_TRUNC, 00644))){
|
127
|
+
fprintf(stderr, "dbm_open failed\n");
|
128
|
+
return 1;
|
129
|
+
}
|
130
|
+
err = FALSE;
|
131
|
+
/* loop for each record */
|
132
|
+
for(i = 1; i <= rnum; i++){
|
133
|
+
len = sprintf(buf, "%08d", i);
|
134
|
+
key.dptr = buf;
|
135
|
+
key.dsize = len;
|
136
|
+
val.dptr = buf;
|
137
|
+
val.dsize = len;
|
138
|
+
/* store a record */
|
139
|
+
if(dbm_store(db, key, val, DBM_REPLACE) < 0){
|
140
|
+
fprintf(stderr, "dbm_store failed\n");
|
141
|
+
err = TRUE;
|
142
|
+
break;
|
143
|
+
}
|
144
|
+
/* print progression */
|
145
|
+
if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
|
146
|
+
putchar('.');
|
147
|
+
fflush(stdout);
|
148
|
+
if(i == rnum || i % (rnum / 10) == 0){
|
149
|
+
printf(" (%08d)\n", i);
|
150
|
+
fflush(stdout);
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
/* close the database */
|
155
|
+
dbm_close(db);
|
156
|
+
if(showprgr && !err) printf("ok\n\n");
|
157
|
+
return err ? 1 : 0;
|
158
|
+
}
|
159
|
+
|
160
|
+
|
161
|
+
/* perform read command */
|
162
|
+
int doread(char *name, int rnum){
|
163
|
+
DBM *db;
|
164
|
+
datum key, val;
|
165
|
+
int i, err, len;
|
166
|
+
char buf[RECBUFSIZ];
|
167
|
+
if(showprgr) printf("<Reading Test>\n name=%s rnum=%d\n\n", name, rnum);
|
168
|
+
/* open a database */
|
169
|
+
if(!(db = dbm_open(name, O_RDONLY, 00644))){
|
170
|
+
fprintf(stderr, "dbm_open failed\n");
|
171
|
+
return 1;
|
172
|
+
}
|
173
|
+
err = FALSE;
|
174
|
+
/* loop for each record */
|
175
|
+
for(i = 1; i <= rnum; i++){
|
176
|
+
/* retrieve a record */
|
177
|
+
len = sprintf(buf, "%08d", i);
|
178
|
+
key.dptr = buf;
|
179
|
+
key.dsize = len;
|
180
|
+
val = dbm_fetch(db, key);
|
181
|
+
if(!val.dptr){
|
182
|
+
fprintf(stderr, "dbm_fetch failed\n");
|
183
|
+
err = TRUE;
|
184
|
+
break;
|
185
|
+
}
|
186
|
+
/* print progression */
|
187
|
+
if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
|
188
|
+
putchar('.');
|
189
|
+
fflush(stdout);
|
190
|
+
if(i == rnum || i % (rnum / 10) == 0){
|
191
|
+
printf(" (%08d)\n", i);
|
192
|
+
fflush(stdout);
|
193
|
+
}
|
194
|
+
}
|
195
|
+
}
|
196
|
+
/* close the database */
|
197
|
+
dbm_close(db);
|
198
|
+
if(showprgr && !err) printf("ok\n\n");
|
199
|
+
return err ? 1 : 0;
|
200
|
+
}
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
/* END OF FILE */
|
@@ -0,0 +1,404 @@
|
|
1
|
+
#include <stdio.h>
|
2
|
+
#include <stdlib.h>
|
3
|
+
#include <string.h>
|
4
|
+
#include <unistd.h>
|
5
|
+
#include <sqlite3.h>
|
6
|
+
|
7
|
+
#undef TRUE
|
8
|
+
#define TRUE 1 /* boolean true */
|
9
|
+
#undef FALSE
|
10
|
+
#define FALSE 0 /* boolean false */
|
11
|
+
|
12
|
+
#define RECBUFSIZ 256 /* buffer for records */
|
13
|
+
|
14
|
+
|
15
|
+
/* global variables */
|
16
|
+
const char *progname; /* program name */
|
17
|
+
int showprgr; /* whether to show progression */
|
18
|
+
|
19
|
+
|
20
|
+
/* function prototypes */
|
21
|
+
int main(int argc, char **argv);
|
22
|
+
void usage(void);
|
23
|
+
int runwrite(int argc, char **argv);
|
24
|
+
int runread(int argc, char **argv);
|
25
|
+
int runtblwrite(int argc, char **argv);
|
26
|
+
int runtblread(int argc, char **argv);
|
27
|
+
int myrand(void);
|
28
|
+
int callback(void *opq, int argc, char **argv, char **colname);
|
29
|
+
int dowrite(char *name, int rnum);
|
30
|
+
int doread(char *name, int rnum);
|
31
|
+
int dotblwrite(char *name, int rnum);
|
32
|
+
int dotblread(char *name, int rnum);
|
33
|
+
|
34
|
+
|
35
|
+
/* main routine */
|
36
|
+
int main(int argc, char **argv){
|
37
|
+
int rv;
|
38
|
+
progname = argv[0];
|
39
|
+
showprgr = TRUE;
|
40
|
+
if(getenv("HIDEPRGR")) showprgr = FALSE;
|
41
|
+
if(argc < 2) usage();
|
42
|
+
rv = 0;
|
43
|
+
if(!strcmp(argv[1], "write")){
|
44
|
+
rv = runwrite(argc, argv);
|
45
|
+
} else if(!strcmp(argv[1], "read")){
|
46
|
+
rv = runread(argc, argv);
|
47
|
+
} else if(!strcmp(argv[1], "tblwrite")){
|
48
|
+
rv = runtblwrite(argc, argv);
|
49
|
+
} else if(!strcmp(argv[1], "tblread")){
|
50
|
+
rv = runtblread(argc, argv);
|
51
|
+
} else {
|
52
|
+
usage();
|
53
|
+
}
|
54
|
+
return rv;
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
/* print the usage and exit */
|
59
|
+
void usage(void){
|
60
|
+
fprintf(stderr, "%s: test cases for SQLite\n", progname);
|
61
|
+
fprintf(stderr, "\n");
|
62
|
+
fprintf(stderr, "usage:\n");
|
63
|
+
fprintf(stderr, " %s write name rnum\n", progname);
|
64
|
+
fprintf(stderr, " %s read name rnum\n", progname);
|
65
|
+
fprintf(stderr, " %s tblwrite name rnum\n", progname);
|
66
|
+
fprintf(stderr, " %s tblread name rnum\n", progname);
|
67
|
+
fprintf(stderr, "\n");
|
68
|
+
exit(1);
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
/* parse arguments of write command */
|
73
|
+
int runwrite(int argc, char **argv){
|
74
|
+
char *name, *rstr;
|
75
|
+
int i, rnum, rv;
|
76
|
+
name = NULL;
|
77
|
+
rstr = NULL;
|
78
|
+
rnum = 0;
|
79
|
+
for(i = 2; i < argc; i++){
|
80
|
+
if(!name && argv[i][0] == '-'){
|
81
|
+
usage();
|
82
|
+
} else if(!name){
|
83
|
+
name = argv[i];
|
84
|
+
} else if(!rstr){
|
85
|
+
rstr = argv[i];
|
86
|
+
} else {
|
87
|
+
usage();
|
88
|
+
}
|
89
|
+
}
|
90
|
+
if(!name || !rstr) usage();
|
91
|
+
rnum = atoi(rstr);
|
92
|
+
if(rnum < 1) usage();
|
93
|
+
rv = dowrite(name, rnum);
|
94
|
+
return rv;
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
/* parse arguments of read command */
|
99
|
+
int runread(int argc, char **argv){
|
100
|
+
char *name, *rstr;
|
101
|
+
int i, rnum, rv;
|
102
|
+
name = NULL;
|
103
|
+
rstr = NULL;
|
104
|
+
rnum = 0;
|
105
|
+
for(i = 2; i < argc; i++){
|
106
|
+
if(!name && argv[i][0] == '-'){
|
107
|
+
usage();
|
108
|
+
} else if(!name){
|
109
|
+
name = argv[i];
|
110
|
+
} else if(!rstr){
|
111
|
+
rstr = argv[i];
|
112
|
+
} else {
|
113
|
+
usage();
|
114
|
+
}
|
115
|
+
}
|
116
|
+
if(!name || !rstr) usage();
|
117
|
+
rnum = atoi(rstr);
|
118
|
+
if(rnum < 1) usage();
|
119
|
+
rv = doread(name, rnum);
|
120
|
+
return rv;
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
/* parse arguments of tblwrite command */
|
125
|
+
int runtblwrite(int argc, char **argv){
|
126
|
+
char *name, *rstr;
|
127
|
+
int i, rnum, rv;
|
128
|
+
name = NULL;
|
129
|
+
rstr = NULL;
|
130
|
+
rnum = 0;
|
131
|
+
for(i = 2; i < argc; i++){
|
132
|
+
if(!name && argv[i][0] == '-'){
|
133
|
+
usage();
|
134
|
+
} else if(!name){
|
135
|
+
name = argv[i];
|
136
|
+
} else if(!rstr){
|
137
|
+
rstr = argv[i];
|
138
|
+
} else {
|
139
|
+
usage();
|
140
|
+
}
|
141
|
+
}
|
142
|
+
if(!name || !rstr) usage();
|
143
|
+
rnum = atoi(rstr);
|
144
|
+
if(rnum < 1) usage();
|
145
|
+
rv = dotblwrite(name, rnum);
|
146
|
+
return rv;
|
147
|
+
}
|
148
|
+
|
149
|
+
|
150
|
+
/* parse arguments of tblread command */
|
151
|
+
int runtblread(int argc, char **argv){
|
152
|
+
char *name, *rstr;
|
153
|
+
int i, rnum, rv;
|
154
|
+
name = NULL;
|
155
|
+
rstr = NULL;
|
156
|
+
rnum = 0;
|
157
|
+
for(i = 2; i < argc; i++){
|
158
|
+
if(!name && argv[i][0] == '-'){
|
159
|
+
usage();
|
160
|
+
} else if(!name){
|
161
|
+
name = argv[i];
|
162
|
+
} else if(!rstr){
|
163
|
+
rstr = argv[i];
|
164
|
+
} else {
|
165
|
+
usage();
|
166
|
+
}
|
167
|
+
}
|
168
|
+
if(!name || !rstr) usage();
|
169
|
+
rnum = atoi(rstr);
|
170
|
+
if(rnum < 1) usage();
|
171
|
+
rv = dotblread(name, rnum);
|
172
|
+
return rv;
|
173
|
+
}
|
174
|
+
|
175
|
+
|
176
|
+
/* pseudo random number generator */
|
177
|
+
int myrand(void){
|
178
|
+
static int cnt = 0;
|
179
|
+
return (lrand48() + cnt++) & 0x7FFFFFFF;
|
180
|
+
}
|
181
|
+
|
182
|
+
|
183
|
+
/* call back function for select statement */
|
184
|
+
int callback(void *opq, int argc, char **argv, char **colname){
|
185
|
+
return 0;
|
186
|
+
}
|
187
|
+
|
188
|
+
|
189
|
+
/* perform write command */
|
190
|
+
int dowrite(char *name, int rnum){
|
191
|
+
sqlite3 *db;
|
192
|
+
char sql[RECBUFSIZ], *errmsg;
|
193
|
+
int i, err;
|
194
|
+
if(showprgr) printf("<Writing Test of Hash>\n name=%s rnum=%d\n\n", name, rnum);
|
195
|
+
/* open a database */
|
196
|
+
unlink(name);
|
197
|
+
if(sqlite3_open(name, &db) != 0){
|
198
|
+
fprintf(stderr, "sqlite3_open failed\n");
|
199
|
+
return 1;
|
200
|
+
}
|
201
|
+
sprintf(sql, "CREATE TABLE tbl ( key TEXT PRIMARY KEY, val TEXT );");
|
202
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
203
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
204
|
+
sqlite3_free(errmsg);
|
205
|
+
}
|
206
|
+
sprintf(sql, "PRAGMA cache_size = %d;", rnum);
|
207
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
208
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
209
|
+
sqlite3_free(errmsg);
|
210
|
+
}
|
211
|
+
sprintf(sql, "BEGIN TRANSACTION;");
|
212
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
213
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
214
|
+
sqlite3_free(errmsg);
|
215
|
+
}
|
216
|
+
err = FALSE;
|
217
|
+
/* loop for each record */
|
218
|
+
for(i = 1; i <= rnum; i++){
|
219
|
+
/* store a record */
|
220
|
+
sprintf(sql, "INSERT INTO tbl VALUES ( '%08d', '%08d' );", i, i);
|
221
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
222
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
223
|
+
sqlite3_free(errmsg);
|
224
|
+
err = TRUE;
|
225
|
+
}
|
226
|
+
/* print progression */
|
227
|
+
if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
|
228
|
+
putchar('.');
|
229
|
+
fflush(stdout);
|
230
|
+
if(i == rnum || i % (rnum / 10) == 0){
|
231
|
+
printf(" (%08d)\n", i);
|
232
|
+
fflush(stdout);
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
/* close the database */
|
237
|
+
sprintf(sql, "END TRANSACTION;");
|
238
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
239
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
240
|
+
sqlite3_free(errmsg);
|
241
|
+
}
|
242
|
+
sqlite3_close(db);
|
243
|
+
if(showprgr && !err) printf("ok\n\n");
|
244
|
+
return err ? 1 : 0;
|
245
|
+
}
|
246
|
+
|
247
|
+
|
248
|
+
/* perform read command */
|
249
|
+
int doread(char *name, int rnum){
|
250
|
+
sqlite3 *db;
|
251
|
+
char sql[RECBUFSIZ], *errmsg;
|
252
|
+
int i, err;
|
253
|
+
if(showprgr) printf("<Reading Test of Hash>\n name=%s rnum=%d\n\n", name, rnum);
|
254
|
+
/* open a database */
|
255
|
+
if(sqlite3_open(name, &db) != 0){
|
256
|
+
fprintf(stderr, "sqlite3_open failed\n");
|
257
|
+
return 1;
|
258
|
+
}
|
259
|
+
sprintf(sql, "PRAGMA cache_size = %d;", rnum);
|
260
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
261
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
262
|
+
sqlite3_free(errmsg);
|
263
|
+
}
|
264
|
+
err = FALSE;
|
265
|
+
/* loop for each record */
|
266
|
+
for(i = 1; i <= rnum; i++){
|
267
|
+
/* store a record */
|
268
|
+
sprintf(sql, "SELECT * FROM tbl WHERE key = '%08d';", i);
|
269
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
270
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
271
|
+
sqlite3_free(errmsg);
|
272
|
+
err = TRUE;
|
273
|
+
}
|
274
|
+
/* print progression */
|
275
|
+
if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
|
276
|
+
putchar('.');
|
277
|
+
fflush(stdout);
|
278
|
+
if(i == rnum || i % (rnum / 10) == 0){
|
279
|
+
printf(" (%08d)\n", i);
|
280
|
+
fflush(stdout);
|
281
|
+
}
|
282
|
+
}
|
283
|
+
}
|
284
|
+
/* close the database */
|
285
|
+
sqlite3_close(db);
|
286
|
+
if(showprgr && !err) printf("ok\n\n");
|
287
|
+
return err ? 1 : 0;
|
288
|
+
}
|
289
|
+
|
290
|
+
|
291
|
+
/* perform tblwrite command */
|
292
|
+
int dotblwrite(char *name, int rnum){
|
293
|
+
sqlite3 *db;
|
294
|
+
char sql[RECBUFSIZ], *errmsg;
|
295
|
+
int i, err;
|
296
|
+
if(showprgr) printf("<Writing Test of Table>\n name=%s rnum=%d\n\n", name, rnum);
|
297
|
+
/* open a database */
|
298
|
+
unlink(name);
|
299
|
+
if(sqlite3_open(name, &db) != 0){
|
300
|
+
fprintf(stderr, "sqlite3_open failed\n");
|
301
|
+
return 1;
|
302
|
+
}
|
303
|
+
sprintf(sql, "CREATE TABLE tbl ( key INTEGER PRIMARY KEY, s TEXT, n INTEGER,"
|
304
|
+
" t TEXT, f TEXT );");
|
305
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
306
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
307
|
+
sqlite3_free(errmsg);
|
308
|
+
}
|
309
|
+
sprintf(sql, "CREATE INDEX tbl_s ON tbl ( s );");
|
310
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
311
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
312
|
+
sqlite3_free(errmsg);
|
313
|
+
}
|
314
|
+
sprintf(sql, "CREATE INDEX tbl_n ON tbl ( n );");
|
315
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
316
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
317
|
+
sqlite3_free(errmsg);
|
318
|
+
}
|
319
|
+
sprintf(sql, "PRAGMA cache_size = %d;", rnum);
|
320
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
321
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
322
|
+
sqlite3_free(errmsg);
|
323
|
+
}
|
324
|
+
sprintf(sql, "BEGIN TRANSACTION;");
|
325
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
326
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
327
|
+
sqlite3_free(errmsg);
|
328
|
+
}
|
329
|
+
err = FALSE;
|
330
|
+
/* loop for each record */
|
331
|
+
for(i = 1; i <= rnum; i++){
|
332
|
+
/* store a record */
|
333
|
+
sprintf(sql, "INSERT INTO tbl VALUES ( %d, '%08d', %d, '%08d', '%08d' );",
|
334
|
+
i, i, myrand() % i, i, myrand() % rnum);
|
335
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
336
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
337
|
+
sqlite3_free(errmsg);
|
338
|
+
}
|
339
|
+
/* print progression */
|
340
|
+
if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
|
341
|
+
putchar('.');
|
342
|
+
fflush(stdout);
|
343
|
+
if(i == rnum || i % (rnum / 10) == 0){
|
344
|
+
printf(" (%08d)\n", i);
|
345
|
+
fflush(stdout);
|
346
|
+
}
|
347
|
+
}
|
348
|
+
}
|
349
|
+
/* close the database */
|
350
|
+
sprintf(sql, "END TRANSACTION;");
|
351
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
352
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
353
|
+
sqlite3_free(errmsg);
|
354
|
+
}
|
355
|
+
sqlite3_close(db);
|
356
|
+
if(showprgr && !err) printf("ok\n\n");
|
357
|
+
return err ? 1 : 0;
|
358
|
+
}
|
359
|
+
|
360
|
+
|
361
|
+
/* perform tblread command */
|
362
|
+
int dotblread(char *name, int rnum){
|
363
|
+
sqlite3 *db;
|
364
|
+
char sql[RECBUFSIZ], *errmsg;
|
365
|
+
int i, err;
|
366
|
+
if(showprgr) printf("<Reading Test of Table>\n name=%s rnum=%d\n\n", name, rnum);
|
367
|
+
/* open a database */
|
368
|
+
if(sqlite3_open(name, &db) != 0){
|
369
|
+
fprintf(stderr, "sqlite3_open failed\n");
|
370
|
+
return 1;
|
371
|
+
}
|
372
|
+
sprintf(sql, "PRAGMA cache_size = %d;", rnum);
|
373
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
374
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
375
|
+
sqlite3_free(errmsg);
|
376
|
+
}
|
377
|
+
err = FALSE;
|
378
|
+
/* loop for each record */
|
379
|
+
for(i = 1; i <= rnum; i++){
|
380
|
+
/* store a record */
|
381
|
+
sprintf(sql, "SELECT * FROM tbl WHERE key = '%08d';", i);
|
382
|
+
if(sqlite3_exec(db, sql, callback, 0, &errmsg) != SQLITE_OK){
|
383
|
+
fprintf(stderr, "sqlite3_exec failed: %s\n", errmsg);
|
384
|
+
sqlite3_free(errmsg);
|
385
|
+
}
|
386
|
+
/* print progression */
|
387
|
+
if(showprgr && rnum > 250 && i % (rnum / 250) == 0){
|
388
|
+
putchar('.');
|
389
|
+
fflush(stdout);
|
390
|
+
if(i == rnum || i % (rnum / 10) == 0){
|
391
|
+
printf(" (%08d)\n", i);
|
392
|
+
fflush(stdout);
|
393
|
+
}
|
394
|
+
}
|
395
|
+
}
|
396
|
+
/* close the database */
|
397
|
+
sqlite3_close(db);
|
398
|
+
if(showprgr && !err) printf("ok\n\n");
|
399
|
+
return err ? 1 : 0;
|
400
|
+
}
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
/* END OF FILE */
|