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,43 @@
|
|
1
|
+
#! /bin/sh
|
2
|
+
|
3
|
+
#================================================================
|
4
|
+
# tabcheck
|
5
|
+
# Find files including dispensable tab and space characters
|
6
|
+
#================================================================
|
7
|
+
|
8
|
+
|
9
|
+
# set variables
|
10
|
+
LANG=C
|
11
|
+
LC_ALL=C
|
12
|
+
export LANG LC_ALL
|
13
|
+
regex='\.(h|c|cc|cpp|cxx|java|pl|pm|pod|rb|rd|lua)$'
|
14
|
+
tabcode=`printf '\t'`
|
15
|
+
|
16
|
+
|
17
|
+
# find tab
|
18
|
+
find . -type f | egrep $regex |
|
19
|
+
while read file
|
20
|
+
do
|
21
|
+
printf 'Checking %s ... ' $file
|
22
|
+
err=0
|
23
|
+
if grep "$tabcode" $file > /dev/null
|
24
|
+
then
|
25
|
+
printf '### !!! TAB FOUND !!! ###'
|
26
|
+
err=1
|
27
|
+
fi
|
28
|
+
if grep ' $' $file > /dev/null
|
29
|
+
then
|
30
|
+
printf '### !!! TAILING SPACE FOUND !!! ###'
|
31
|
+
err=1
|
32
|
+
fi
|
33
|
+
[ "$err" = 0 ] && printf 'ok'
|
34
|
+
printf '\n'
|
35
|
+
done
|
36
|
+
|
37
|
+
|
38
|
+
# exit normally
|
39
|
+
exit 0
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
# END OF FILE
|
@@ -0,0 +1,239 @@
|
|
1
|
+
#! /usr/bin/ruby -w
|
2
|
+
|
3
|
+
#================================================================
|
4
|
+
# wgettsv
|
5
|
+
# Collect WWW resources and generate TSV data
|
6
|
+
#================================================================
|
7
|
+
|
8
|
+
require 'open-uri'
|
9
|
+
require 'iconv'
|
10
|
+
require 'kconv'
|
11
|
+
require 'date'
|
12
|
+
require 'time'
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
def main
|
16
|
+
seeds = []
|
17
|
+
hist = {}
|
18
|
+
filters = []
|
19
|
+
max = 1 << 30
|
20
|
+
lim = 1 << 20
|
21
|
+
wait = 0
|
22
|
+
ndf = false
|
23
|
+
i = 0
|
24
|
+
while i < ARGV.length
|
25
|
+
if seeds.length < 1 && ARGV[i] =~ /^-/
|
26
|
+
if ARGV[i] == '-allow'
|
27
|
+
usage if (i += 1) >= ARGV.length
|
28
|
+
regex = Regexp::new(ARGV[i])
|
29
|
+
filters.push([true, regex]) if regex
|
30
|
+
elsif ARGV[i] == '-deny'
|
31
|
+
usage if (i += 1) >= ARGV.length
|
32
|
+
regex = Regexp::new(ARGV[i])
|
33
|
+
filters.push([false, regex]) if regex
|
34
|
+
elsif ARGV[i] == '-max'
|
35
|
+
usage if (i += 1) >= ARGV.length
|
36
|
+
max = ARGV[i].to_i
|
37
|
+
elsif ARGV[i] == '-lim'
|
38
|
+
usage if (i += 1) >= ARGV.length
|
39
|
+
lim = ARGV[i].to_i
|
40
|
+
elsif ARGV[i] == '-wait'
|
41
|
+
usage if (i += 1) >= ARGV.length
|
42
|
+
wait = ARGV[i].to_f
|
43
|
+
elsif ARGV[i] == '-ndf'
|
44
|
+
ndf = true
|
45
|
+
else
|
46
|
+
usage
|
47
|
+
end
|
48
|
+
else
|
49
|
+
if ARGV[i] =~ /^http:\/\//i
|
50
|
+
seeds.push(ARGV[i])
|
51
|
+
hist[ARGV[i]] = true
|
52
|
+
else
|
53
|
+
usage
|
54
|
+
end
|
55
|
+
end
|
56
|
+
i += 1
|
57
|
+
end
|
58
|
+
usage if seeds.length < 1
|
59
|
+
if !ndf
|
60
|
+
filters.push([false, /\.(txt|text|asc|c|cc|cxx|cpp|h|hxx|hpp|in)$/i])
|
61
|
+
filters.push([false, /\.(css|js|csv|tsv|log|md5|crc|conf|ini|inf|lnk|sys|tmp|bak)$/i])
|
62
|
+
filters.push([false, /\.(xml|xsl|xslt|rdf|rss|dtd|sgml|sgm)$/i])
|
63
|
+
filters.push([false, /\.(pgp|sig|cer|csr|pem|key|b64|uu|uue|[0-9])$/i])
|
64
|
+
filters.push([false, /\.(rtf|pdf|ps|eps|ai|doc|xls|ppt|sxw|sxc|sxi|xdw|jtd|oas|swf)$/i])
|
65
|
+
filters.push([false, /\.(zip|tar|tgz|gz|bz2|tbz2|z|lha|lzh)?$/i])
|
66
|
+
filters.push([false, /\.(7z|lzo|lzma|cpio|shar|cab|rar|sit|ace|hqx)?$/i])
|
67
|
+
filters.push([false, /\.(bin|o|a|so|exe|dll|lib|obj|ocx|class|jar|war)?$/i])
|
68
|
+
filters.push([false, /\.(rpm|deb|qdb|qdb|dbx|dbf|dat|msi|bat|com|iso)?$/i])
|
69
|
+
filters.push([false, /\.(png|gif|jpg|jpeg|tif|tiff|bmp|ico|pbm|pgm|ppm|xbm|xpm|dvi)$/i])
|
70
|
+
filters.push([false, /\.(au|snd|mid|midi|kar|smf|mp2|mp3|m3u|wav|wma|wmp|asx|at3|aif)$/i])
|
71
|
+
filters.push([false, /\.(mpg|mpeg|qt|mov|avi|wmv|wvx|asf|ram|rm)$/i])
|
72
|
+
filters.push([false, /\.(tch|tdb|tdf|tct)$/i])
|
73
|
+
filters.push([false, /\.idx\./i])
|
74
|
+
filters.push([false, /(core|casket|Makefile|README|NEWS|COPYING|LISENCE)($|\/)/i])
|
75
|
+
end
|
76
|
+
return proc(seeds, hist, filters, max, lim, wait) ? 0 : 1
|
77
|
+
end
|
78
|
+
|
79
|
+
def usage
|
80
|
+
STDERR.printf("%s: collect WWW resources and generate TSV data\n", $progname)
|
81
|
+
STDERR.printf("\n")
|
82
|
+
STDERR.printf("usage:\n")
|
83
|
+
STDERR.printf(" %s [-allow regex] [-deny regex] [-max num] [-lim num] [-wait num]" +
|
84
|
+
" url ...\n", $progname)
|
85
|
+
STDERR.printf("\n")
|
86
|
+
exit(1)
|
87
|
+
end
|
88
|
+
|
89
|
+
def proc(seeds, hist, filters, max, lim, wait)
|
90
|
+
cnt = 0
|
91
|
+
while (url = seeds.shift) && cnt < max
|
92
|
+
STDERR.printf("%d: getting: %s\n", cnt + 1, url)
|
93
|
+
begin
|
94
|
+
opts = {}
|
95
|
+
OpenURI.open_uri(url, 0, 0, opts) do |sio|
|
96
|
+
baseuri = sio.base_uri
|
97
|
+
if baseuri && baseuri.to_s != url
|
98
|
+
url = baseuri.to_s
|
99
|
+
hist[url] = true
|
100
|
+
end
|
101
|
+
size = sio.size
|
102
|
+
raise "invalid size" if size > lim || size < 3
|
103
|
+
type = sio.content_type
|
104
|
+
type = "text/plain" if !type
|
105
|
+
str = sio.read
|
106
|
+
head = str[0,2048]
|
107
|
+
if (head[0] == 0xfe && head[1] == 0xff) || (head[0] == 0xff && head[1] == 0xfe)
|
108
|
+
str = Kconv::kconv(str, Kconv::UTF8, Kconv::UTF16)
|
109
|
+
charset = "UTF-8"
|
110
|
+
elsif str.include?(0)
|
111
|
+
raise "binary data"
|
112
|
+
end
|
113
|
+
raise "not HTML" if type != "text/html" && head !~ /<html/i && head !~ /<body/i
|
114
|
+
if !charset && head =~ /<\?xml.*encoding=("|')?[-_a-zA-Z0-9]+("|')/im
|
115
|
+
charset = head.gsub(/.*<\?xml.*encoding=["']?([-_a-zA-Z0-9]+)["']?.*/im, '\1')
|
116
|
+
end
|
117
|
+
if !charset && head =~ /<meta.*content-type.*charset=[-_a-zA-Z0-9]+/im
|
118
|
+
charset = head.gsub(/.*<meta.*content-type.*charset=([-_a-zA-Z0-9]+).*/im, '\1')
|
119
|
+
end
|
120
|
+
charset = sio.charset if !charset || charset.length < 1
|
121
|
+
if charset && charset.length > 0
|
122
|
+
if charset !~ /^UTF-?8$/i
|
123
|
+
begin
|
124
|
+
nstr = Iconv.conv("UTF-8", charset, str)
|
125
|
+
str = nstr if nstr && nstr.length > 0
|
126
|
+
rescue
|
127
|
+
str = str.toutf8
|
128
|
+
end
|
129
|
+
end
|
130
|
+
else
|
131
|
+
str = str.toutf8
|
132
|
+
end
|
133
|
+
body = str.gsub(/.*<body[^>]*>/im, "")
|
134
|
+
body = body.gsub(/<\/body>.*/im, "")
|
135
|
+
body = htmltotext(body)
|
136
|
+
if str =~ /<title[^>]*>[^<]*<\/title>/im
|
137
|
+
title = str.gsub(/.*<title[^>]*>([^<]*)<\/title>.*/im, '\1')
|
138
|
+
title = htmltotext(title)
|
139
|
+
end
|
140
|
+
title = "" if !title
|
141
|
+
title = title[0,128] if title.length > 128
|
142
|
+
mtime = sio.last_modified
|
143
|
+
if mtime
|
144
|
+
mtime = Time::parse(mtime.to_s).to_i
|
145
|
+
else
|
146
|
+
mtime = 0
|
147
|
+
end
|
148
|
+
printf("%d", cnt + 1)
|
149
|
+
printf("\turl\t%s", url)
|
150
|
+
printf("\tsize\t%s", size) if size > 0
|
151
|
+
printf("\tmtime\t%s", mtime) if mtime > 0
|
152
|
+
printf("\ttitle\t%s", title) if title.length > 0
|
153
|
+
printf("\tbody\t%s", body) if body.length > 0
|
154
|
+
printf("\n")
|
155
|
+
str.gsub(/<a[^>]*>/im) do |tag|
|
156
|
+
if tag =~ /href=["']?[^"'>]+["']?/
|
157
|
+
href = tag.gsub(/.*href=["']?([^"'>]+)["']?.*/, '\1')
|
158
|
+
href = URI::join(url, href).to_s
|
159
|
+
href = href.gsub(/#.*/, "")
|
160
|
+
if !hist[href] && checkurl(href, filters)
|
161
|
+
seeds.push(href)
|
162
|
+
hist[href] = true
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
cnt += 1
|
168
|
+
rescue
|
169
|
+
STDERR.printf("%d: failed: %s: %s\n", cnt + 1, url, $!)
|
170
|
+
end
|
171
|
+
sleep(wait) if wait > 0
|
172
|
+
end
|
173
|
+
return 0
|
174
|
+
end
|
175
|
+
|
176
|
+
def htmltotext(str)
|
177
|
+
str = str.gsub(/<style[^>]*>.*?<\/style>/im, " ")
|
178
|
+
str = str.gsub(/<script[^>]*>.*?<\/script>/im, " ")
|
179
|
+
str = str.gsub(/<\/?(p|br|div|h1|h2|h3|h4|h5|h6|ul|ol|dl|li|dd|dt|td|th|pre)[^>]*>/im, " ")
|
180
|
+
str = str.gsub(/<[^>]*>/, "")
|
181
|
+
str = str.gsub(/&(nbsp|#160|#0160|#xa0|#x00a0);/i, " ")
|
182
|
+
hexrx = Regexp::new("^&#x[0-9a-zA-Z]+;")
|
183
|
+
decrx = Regexp::new("^&#[0-9]+;")
|
184
|
+
str = str.gsub(/&#?[A-Za-z0-9]+;/) do |pat|
|
185
|
+
case pat
|
186
|
+
when "<"
|
187
|
+
pat = '<'
|
188
|
+
when ">"
|
189
|
+
pat = '>'
|
190
|
+
when """
|
191
|
+
pat = '"'
|
192
|
+
when "'"
|
193
|
+
pat = "'"
|
194
|
+
when " "
|
195
|
+
pat = " "
|
196
|
+
else
|
197
|
+
begin
|
198
|
+
if pat =~ hexrx
|
199
|
+
pat = [ pat.gsub(/&#x([A-Za-z0-9]+);/i, '\1').hex ].pack("n")
|
200
|
+
pat = Iconv.conv("UTF-8", "UTF-16BE", pat)
|
201
|
+
elsif pat =~ decrx
|
202
|
+
pat = [ pat.gsub(/&#([A-Za-z0-9]+);/i, '\1').to_i ].pack("n")
|
203
|
+
pat = Iconv.conv("UTF-8", "UTF-16BE", pat)
|
204
|
+
else
|
205
|
+
pat = " "
|
206
|
+
end
|
207
|
+
rescue
|
208
|
+
pat = ""
|
209
|
+
end
|
210
|
+
end
|
211
|
+
pat
|
212
|
+
end
|
213
|
+
str = str.gsub(/[\x00-\x20]/, " ")
|
214
|
+
str = str.gsub(/\xe3\x80\x80/, " ")
|
215
|
+
str = str.gsub(/ +/, " ")
|
216
|
+
str = str.gsub(/^ */, "")
|
217
|
+
str = str.gsub(/ *$/, "")
|
218
|
+
return str
|
219
|
+
end
|
220
|
+
|
221
|
+
def checkurl(url, filters)
|
222
|
+
return false if url !~ /^http:\/\//i;
|
223
|
+
return true if filters.length < 1
|
224
|
+
ok = !filters[0][0]
|
225
|
+
filters.each do |filter|
|
226
|
+
ok = filter[0] if url =~ filter[1]
|
227
|
+
end
|
228
|
+
return ok
|
229
|
+
end
|
230
|
+
|
231
|
+
STDOUT.sync = true
|
232
|
+
$progname = $0.dup
|
233
|
+
$progname.gsub!(/.*\//, "")
|
234
|
+
srand
|
235
|
+
exit(main)
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
# END OF FILE
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#! /usr/bin/ruby -w
|
2
|
+
|
3
|
+
#================================================================
|
4
|
+
# widthcheck
|
5
|
+
# Find files including too wide lines
|
6
|
+
#================================================================
|
7
|
+
|
8
|
+
|
9
|
+
LIMITWIDTH = 97
|
10
|
+
|
11
|
+
def checkfile(path)
|
12
|
+
printf("Checking: %s\n", path)
|
13
|
+
ok = true
|
14
|
+
open(path, "r") do |file|
|
15
|
+
num = 0
|
16
|
+
file.each do |line|
|
17
|
+
num += 1
|
18
|
+
line.chomp!
|
19
|
+
if line.length > LIMITWIDTH && !line.index("/*") && !line.index("*/")
|
20
|
+
printf("FOUND: %s: %d: %d: %s\n", path, num, line.length, line);
|
21
|
+
ok = false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
return ok
|
26
|
+
end
|
27
|
+
|
28
|
+
ok = true
|
29
|
+
list = Array::new(ARGV)
|
30
|
+
list.push(".") if list.empty?
|
31
|
+
while !list.empty?
|
32
|
+
path = list.shift
|
33
|
+
begin
|
34
|
+
if File::ftype(path) == "directory"
|
35
|
+
Dir.entries(path).each do |cpath|
|
36
|
+
if cpath != "." and cpath != ".."
|
37
|
+
list.push(path + "/" + cpath)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
else
|
41
|
+
ok = false if !checkfile(path)
|
42
|
+
end
|
43
|
+
rescue
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
if ok
|
48
|
+
printf("ALL OK\n")
|
49
|
+
exit(0)
|
50
|
+
else
|
51
|
+
printf("ERROR\n")
|
52
|
+
exit(1)
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
# END OF FILE
|
@@ -0,0 +1,104 @@
|
|
1
|
+
#! /usr/bin/awk -f
|
2
|
+
|
3
|
+
function strip(text){
|
4
|
+
gsub("^ *<[a-zA-Z0-9]*[^>]*>", "", text)
|
5
|
+
gsub("</[a-zA-Z0-9]*> *$", "", text)
|
6
|
+
return text
|
7
|
+
}
|
8
|
+
|
9
|
+
function unescape(text){
|
10
|
+
gsub("<", "<", text)
|
11
|
+
gsub(">", ">", text)
|
12
|
+
gsub(""", "\"", text)
|
13
|
+
gsub("&", "\\&", text)
|
14
|
+
gsub("-", "\\-", text)
|
15
|
+
return text
|
16
|
+
}
|
17
|
+
|
18
|
+
BEGIN {
|
19
|
+
date = strftime("%Y-%m-%d")
|
20
|
+
printf(".TH \"%s\" %d \"%s\" \"%s\" \"%s\"\n\n", "INTRO", 3, date, "Man Page", "Tokyo Cabinet")
|
21
|
+
}
|
22
|
+
|
23
|
+
/ *<h[1-3] *[^>]*>.*<\/h[1-3]> *$/ {
|
24
|
+
text = $0
|
25
|
+
text = strip(text)
|
26
|
+
text = unescape(text)
|
27
|
+
text = toupper(text)
|
28
|
+
printf("\n")
|
29
|
+
printf(".SH %s\n", text)
|
30
|
+
}
|
31
|
+
|
32
|
+
/ *<p *[^>]*>.*<\/p> *$/ {
|
33
|
+
text = $0
|
34
|
+
text = strip(text)
|
35
|
+
text = gensub("<code *[^>]*>([^<]*)</code>", "\\\\fB\\1\\\\fR", "g", text)
|
36
|
+
text = gensub("<var *[^>]*>([^<]*)</var>", "\\\\fI\\1\\\\fR", "g", text)
|
37
|
+
gsub("<[^>]*>", "", text)
|
38
|
+
text = unescape(text)
|
39
|
+
printf(".PP\n")
|
40
|
+
printf("%s\n", text)
|
41
|
+
}
|
42
|
+
|
43
|
+
/ *<dl *[^>]*> *$/ {
|
44
|
+
printf(".PP\n")
|
45
|
+
printf(".RS\n")
|
46
|
+
}
|
47
|
+
/ *<\/dl> *$/ {
|
48
|
+
printf(".RE\n")
|
49
|
+
}
|
50
|
+
/ *<dt *[^>]*>.*<\/dt> *$/ {
|
51
|
+
text = $0
|
52
|
+
text = strip(text)
|
53
|
+
text = gensub("<var *[^>]*>([^<]*)</var>", "\\\\fI\\1\\\\fB", "g", text)
|
54
|
+
gsub("<[^>]*>", "", text)
|
55
|
+
gsub("[\\||\\[|\\]]", "\\fR&\\fB", text)
|
56
|
+
text = unescape(text)
|
57
|
+
printf(".br\n")
|
58
|
+
printf("\\fB%s\\fR\n", text)
|
59
|
+
}
|
60
|
+
/ *<dd *[^>]*>.*<\/dd> *$/ {
|
61
|
+
text = $0
|
62
|
+
text = strip(text)
|
63
|
+
text = gensub("<code *[^>]*>([^<]*)</code>", "\\\\fB\\1\\\\fR", "g", text)
|
64
|
+
text = gensub("<var *[^>]*>([^<]*)</var>", "\\\\fI\\1\\\\fR", "g", text)
|
65
|
+
gsub("<[^>]*>", "", text)
|
66
|
+
text = unescape(text)
|
67
|
+
printf(".RS\n")
|
68
|
+
printf("%s\n", text)
|
69
|
+
printf(".RE\n")
|
70
|
+
}
|
71
|
+
|
72
|
+
/ *<ul *[^>]*> *$/ {
|
73
|
+
printf(".PP\n")
|
74
|
+
printf(".RS\n")
|
75
|
+
}
|
76
|
+
/ *<\/ul> *$/ {
|
77
|
+
printf(".RE\n")
|
78
|
+
}
|
79
|
+
/ *<li *[^>]*>.*<\/li> *$/ {
|
80
|
+
text = $0
|
81
|
+
text = strip(text)
|
82
|
+
text = gensub("<code *[^>]*>(.*)</code>", "\\\\fB\\1\\\\fR", "g", text)
|
83
|
+
text = gensub("<var *[^>]*>([^<]*)</var>", "\\\\fI\\1\\\\fR", "g", text)
|
84
|
+
gsub("<[^>]*>", "", text)
|
85
|
+
text = unescape(text)
|
86
|
+
printf("%s\n", text)
|
87
|
+
printf(".br\n")
|
88
|
+
}
|
89
|
+
|
90
|
+
END {
|
91
|
+
printf("\n")
|
92
|
+
printf(".SH SEE ALSO\n")
|
93
|
+
printf(".PP\n")
|
94
|
+
printf(".BR tcutil (3),\n")
|
95
|
+
printf(".BR tchdb (3),\n")
|
96
|
+
printf(".BR tcbdb (3),\n")
|
97
|
+
printf(".BR tcfdb (3),\n")
|
98
|
+
printf(".BR tctdb (3),\n")
|
99
|
+
printf(".BR tcadb (3)\n")
|
100
|
+
printf(".PP\n")
|
101
|
+
printf("Please see\n")
|
102
|
+
printf(".I http://1978th.net/tokyocabinet/\n")
|
103
|
+
printf("for detail.\n")
|
104
|
+
}
|
@@ -0,0 +1,676 @@
|
|
1
|
+
.TH "TCADB" 3 "2009-10-13" "Man Page" "Tokyo Cabinet"
|
2
|
+
|
3
|
+
.SH NAME
|
4
|
+
tcadb \- the abstract database API
|
5
|
+
|
6
|
+
.SH DESCRIPTION
|
7
|
+
.PP
|
8
|
+
Abstract database is a set of interfaces to use on\-memory hash database, on\-memory tree database, hash database, B+ tree database, fixed\-length database, and table database with the same API.
|
9
|
+
.PP
|
10
|
+
To use the abstract database API, include `\fBtcutil.h\fR', `\fBtcadb.h\fR', and related standard header files. Usually, write the following description near the front of a source file.
|
11
|
+
.PP
|
12
|
+
.RS
|
13
|
+
.br
|
14
|
+
\fB#include <tcutil.h>\fR
|
15
|
+
.br
|
16
|
+
\fB#include <tcadb.h>\fR
|
17
|
+
.br
|
18
|
+
\fB#include <stdlib.h>\fR
|
19
|
+
.br
|
20
|
+
\fB#include <stdbool.h>\fR
|
21
|
+
.br
|
22
|
+
\fB#include <stdint.h>\fR
|
23
|
+
.RE
|
24
|
+
.PP
|
25
|
+
Objects whose type is pointer to `\fBTCADB\fR' are used to handle abstract databases. An abstract database object is created with the function `\fBtcadbnew\fR' and is deleted with the function `\fBtcadbdel\fR'. To avoid memory leak, it is important to delete every object when it is no longer in use.
|
26
|
+
.PP
|
27
|
+
Before operations to store or retrieve records, it is necessary to connect the abstract database object to the concrete one. The function `\fBtcadbopen\fR' is used to open a concrete database and the function `\fBtcadbclose\fR' is used to close the database. To avoid data missing or corruption, it is important to close every database instance when it is no longer in use. It is forbidden for multible database objects in a process to open the same database at the same time.
|
28
|
+
|
29
|
+
.SH API
|
30
|
+
.PP
|
31
|
+
The function `tcadbnew' is used in order to create an abstract database object.
|
32
|
+
.PP
|
33
|
+
.RS
|
34
|
+
.br
|
35
|
+
\fBTCADB *tcadbnew(void);\fR
|
36
|
+
.RS
|
37
|
+
The return value is the new abstract database object.
|
38
|
+
.RE
|
39
|
+
.RE
|
40
|
+
.PP
|
41
|
+
The function `tcadbdel' is used in order to delete an abstract database object.
|
42
|
+
.PP
|
43
|
+
.RS
|
44
|
+
.br
|
45
|
+
\fBvoid tcadbdel(TCADB *\fIadb\fB);\fR
|
46
|
+
.RS
|
47
|
+
`\fIadb\fR' specifies the abstract database object.
|
48
|
+
.RE
|
49
|
+
.RE
|
50
|
+
.PP
|
51
|
+
The function `tcadbopen' is used in order to open an abstract database.
|
52
|
+
.PP
|
53
|
+
.RS
|
54
|
+
.br
|
55
|
+
\fBbool tcadbopen(TCADB *\fIadb\fB, const char *\fIname\fB);\fR
|
56
|
+
.RS
|
57
|
+
`\fIadb\fR' specifies the abstract database object.
|
58
|
+
.RE
|
59
|
+
.RS
|
60
|
+
`\fIname\fR' specifies the name of the database. If it is "*", the database will be an on\-memory hash database. If it is "+", the database will be an on\-memory tree database. If its suffix is ".tch", the database will be a hash database. If its suffix is ".tcb", the database will be a B+ tree database. If its suffix is ".tcf", the database will be a fixed\-length database. If its suffix is ".tct", the database will be a table database. Otherwise, this function fails. Tuning parameters can trail the name, separated by "#". Each parameter is composed of the name and the value, separated by "=". On\-memory hash database supports "bnum", "capnum", and "capsiz". On\-memory tree database supports "capnum" and "capsiz". Hash database supports "mode", "bnum", "apow", "fpow", "opts", "rcnum", "xmsiz", and "dfunit". B+ tree database supports "mode", "lmemb", "nmemb", "bnum", "apow", "fpow", "opts", "lcnum", "ncnum", "xmsiz", and "dfunit". Fixed\-length database supports "mode", "width", and "limsiz". Table database supports "mode", "bnum", "apow", "fpow", "opts", "rcnum", "lcnum", "ncnum", "xmsiz", "dfunit", and "idx".
|
61
|
+
.RE
|
62
|
+
.RS
|
63
|
+
If successful, the return value is true, else, it is false.
|
64
|
+
.RE
|
65
|
+
.RS
|
66
|
+
The tuning parameter "capnum" specifies the capacity number of records. "capsiz" specifies the capacity size of using memory. Records spilled the capacity are removed by the storing order. "mode" can contain "w" of writer, "r" of reader, "c" of creating, "t" of truncating, "e" of no locking, and "f" of non\-blocking lock. The default mode is relevant to "wc". "opts" can contains "l" of large option, "d" of Deflate option, "b" of BZIP2 option, and "t" of TCBS option. "idx" specifies the column name of an index and its type separated by ":". For example, "casket.tch#bnum=1000000#opts=ld" means that the name of the database file is "casket.tch", and the bucket number is 1000000, and the options are large and Deflate.
|
67
|
+
.RE
|
68
|
+
.RE
|
69
|
+
.PP
|
70
|
+
The function `tcadbclose' is used in order to close an abstract database object.
|
71
|
+
.PP
|
72
|
+
.RS
|
73
|
+
.br
|
74
|
+
\fBbool tcadbclose(TCADB *\fIadb\fB);\fR
|
75
|
+
.RS
|
76
|
+
`\fIadb\fR' specifies the abstract database object.
|
77
|
+
.RE
|
78
|
+
.RS
|
79
|
+
If successful, the return value is true, else, it is false.
|
80
|
+
.RE
|
81
|
+
.RS
|
82
|
+
Update of a database is assured to be written when the database is closed. If a writer opens a database but does not close it appropriately, the database will be broken.
|
83
|
+
.RE
|
84
|
+
.RE
|
85
|
+
.PP
|
86
|
+
The function `tcadbput' is used in order to store a record into an abstract database object.
|
87
|
+
.PP
|
88
|
+
.RS
|
89
|
+
.br
|
90
|
+
\fBbool tcadbput(TCADB *\fIadb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
|
91
|
+
.RS
|
92
|
+
`\fIadb\fR' specifies the abstract database object.
|
93
|
+
.RE
|
94
|
+
.RS
|
95
|
+
`\fIkbuf\fR' specifies the pointer to the region of the key.
|
96
|
+
.RE
|
97
|
+
.RS
|
98
|
+
`\fIksiz\fR' specifies the size of the region of the key.
|
99
|
+
.RE
|
100
|
+
.RS
|
101
|
+
`\fIvbuf\fR' specifies the pointer to the region of the value.
|
102
|
+
.RE
|
103
|
+
.RS
|
104
|
+
`\fIvsiz\fR' specifies the size of the region of the value.
|
105
|
+
.RE
|
106
|
+
.RS
|
107
|
+
If successful, the return value is true, else, it is false.
|
108
|
+
.RE
|
109
|
+
.RS
|
110
|
+
If a record with the same key exists in the database, it is overwritten.
|
111
|
+
.RE
|
112
|
+
.RE
|
113
|
+
.PP
|
114
|
+
The function `tcadbput2' is used in order to store a string record into an abstract object.
|
115
|
+
.PP
|
116
|
+
.RS
|
117
|
+
.br
|
118
|
+
\fBbool tcadbput2(TCADB *\fIadb\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
|
119
|
+
.RS
|
120
|
+
`\fIadb\fR' specifies the abstract database object.
|
121
|
+
.RE
|
122
|
+
.RS
|
123
|
+
`\fIkstr\fR' specifies the string of the key.
|
124
|
+
.RE
|
125
|
+
.RS
|
126
|
+
`\fIvstr\fR' specifies the string of the value.
|
127
|
+
.RE
|
128
|
+
.RS
|
129
|
+
If successful, the return value is true, else, it is false.
|
130
|
+
.RE
|
131
|
+
.RS
|
132
|
+
If a record with the same key exists in the database, it is overwritten.
|
133
|
+
.RE
|
134
|
+
.RE
|
135
|
+
.PP
|
136
|
+
The function `tcadbputkeep' is used in order to store a new record into an abstract database object.
|
137
|
+
.PP
|
138
|
+
.RS
|
139
|
+
.br
|
140
|
+
\fBbool tcadbputkeep(TCADB *\fIadb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
|
141
|
+
.RS
|
142
|
+
`\fIadb\fR' specifies the abstract database object.
|
143
|
+
.RE
|
144
|
+
.RS
|
145
|
+
`\fIkbuf\fR' specifies the pointer to the region of the key.
|
146
|
+
.RE
|
147
|
+
.RS
|
148
|
+
`\fIksiz\fR' specifies the size of the region of the key.
|
149
|
+
.RE
|
150
|
+
.RS
|
151
|
+
`\fIvbuf\fR' specifies the pointer to the region of the value.
|
152
|
+
.RE
|
153
|
+
.RS
|
154
|
+
`\fIvsiz\fR' specifies the size of the region of the value.
|
155
|
+
.RE
|
156
|
+
.RS
|
157
|
+
If successful, the return value is true, else, it is false.
|
158
|
+
.RE
|
159
|
+
.RS
|
160
|
+
If a record with the same key exists in the database, this function has no effect.
|
161
|
+
.RE
|
162
|
+
.RE
|
163
|
+
.PP
|
164
|
+
The function `tcadbputkeep2' is used in order to store a new string record into an abstract database object.
|
165
|
+
.PP
|
166
|
+
.RS
|
167
|
+
.br
|
168
|
+
\fBbool tcadbputkeep2(TCADB *\fIadb\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
|
169
|
+
.RS
|
170
|
+
`\fIadb\fR' specifies the abstract database object.
|
171
|
+
.RE
|
172
|
+
.RS
|
173
|
+
`\fIkstr\fR' specifies the string of the key.
|
174
|
+
.RE
|
175
|
+
.RS
|
176
|
+
`\fIvstr\fR' specifies the string of the value.
|
177
|
+
.RE
|
178
|
+
.RS
|
179
|
+
If successful, the return value is true, else, it is false.
|
180
|
+
.RE
|
181
|
+
.RS
|
182
|
+
If a record with the same key exists in the database, this function has no effect.
|
183
|
+
.RE
|
184
|
+
.RE
|
185
|
+
.PP
|
186
|
+
The function `tcadbputcat' is used in order to concatenate a value at the end of the existing record in an abstract database object.
|
187
|
+
.PP
|
188
|
+
.RS
|
189
|
+
.br
|
190
|
+
\fBbool tcadbputcat(TCADB *\fIadb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, const void *\fIvbuf\fB, int \fIvsiz\fB);\fR
|
191
|
+
.RS
|
192
|
+
`\fIadb\fR' specifies the abstract database object.
|
193
|
+
.RE
|
194
|
+
.RS
|
195
|
+
`\fIkbuf\fR' specifies the pointer to the region of the key.
|
196
|
+
.RE
|
197
|
+
.RS
|
198
|
+
`\fIksiz\fR' specifies the size of the region of the key.
|
199
|
+
.RE
|
200
|
+
.RS
|
201
|
+
`\fIvbuf\fR' specifies the pointer to the region of the value.
|
202
|
+
.RE
|
203
|
+
.RS
|
204
|
+
`\fIvsiz\fR' specifies the size of the region of the value.
|
205
|
+
.RE
|
206
|
+
.RS
|
207
|
+
If successful, the return value is true, else, it is false.
|
208
|
+
.RE
|
209
|
+
.RS
|
210
|
+
If there is no corresponding record, a new record is created.
|
211
|
+
.RE
|
212
|
+
.RE
|
213
|
+
.PP
|
214
|
+
The function `tcadbputcat2' is used in order to concatenate a string value at the end of the existing record in an abstract database object.
|
215
|
+
.PP
|
216
|
+
.RS
|
217
|
+
.br
|
218
|
+
\fBbool tcadbputcat2(TCADB *\fIadb\fB, const char *\fIkstr\fB, const char *\fIvstr\fB);\fR
|
219
|
+
.RS
|
220
|
+
`\fIadb\fR' specifies the abstract database object.
|
221
|
+
.RE
|
222
|
+
.RS
|
223
|
+
`\fIkstr\fR' specifies the string of the key.
|
224
|
+
.RE
|
225
|
+
.RS
|
226
|
+
`\fIvstr\fR' specifies the string of the value.
|
227
|
+
.RE
|
228
|
+
.RS
|
229
|
+
If successful, the return value is true, else, it is false.
|
230
|
+
.RE
|
231
|
+
.RS
|
232
|
+
If there is no corresponding record, a new record is created.
|
233
|
+
.RE
|
234
|
+
.RE
|
235
|
+
.PP
|
236
|
+
The function `tcadbout' is used in order to remove a record of an abstract database object.
|
237
|
+
.PP
|
238
|
+
.RS
|
239
|
+
.br
|
240
|
+
\fBbool tcadbout(TCADB *\fIadb\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR
|
241
|
+
.RS
|
242
|
+
`\fIadb\fR' specifies the abstract database object.
|
243
|
+
.RE
|
244
|
+
.RS
|
245
|
+
`\fIkbuf\fR' specifies the pointer to the region of the key.
|
246
|
+
.RE
|
247
|
+
.RS
|
248
|
+
`\fIksiz\fR' specifies the size of the region of the key.
|
249
|
+
.RE
|
250
|
+
.RS
|
251
|
+
If successful, the return value is true, else, it is false.
|
252
|
+
.RE
|
253
|
+
.RE
|
254
|
+
.PP
|
255
|
+
The function `tcadbout2' is used in order to remove a string record of an abstract database object.
|
256
|
+
.PP
|
257
|
+
.RS
|
258
|
+
.br
|
259
|
+
\fBbool tcadbout2(TCADB *\fIadb\fB, const char *\fIkstr\fB);\fR
|
260
|
+
.RS
|
261
|
+
`\fIadb\fR' specifies the abstract database object.
|
262
|
+
.RE
|
263
|
+
.RS
|
264
|
+
`\fIkstr\fR' specifies the string of the key.
|
265
|
+
.RE
|
266
|
+
.RS
|
267
|
+
If successful, the return value is true, else, it is false.
|
268
|
+
.RE
|
269
|
+
.RE
|
270
|
+
.PP
|
271
|
+
The function `tcadbget' is used in order to retrieve a record in an abstract database object.
|
272
|
+
.PP
|
273
|
+
.RS
|
274
|
+
.br
|
275
|
+
\fBvoid *tcadbget(TCADB *\fIadb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int *\fIsp\fB);\fR
|
276
|
+
.RS
|
277
|
+
`\fIadb\fR' specifies the abstract database object.
|
278
|
+
.RE
|
279
|
+
.RS
|
280
|
+
`\fIkbuf\fR' specifies the pointer to the region of the key.
|
281
|
+
.RE
|
282
|
+
.RS
|
283
|
+
`\fIksiz\fR' specifies the size of the region of the key.
|
284
|
+
.RE
|
285
|
+
.RS
|
286
|
+
`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
|
287
|
+
.RE
|
288
|
+
.RS
|
289
|
+
If successful, the return value is the pointer to the region of the value of the corresponding record. `NULL' is returned if no record corresponds.
|
290
|
+
.RE
|
291
|
+
.RS
|
292
|
+
Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
|
293
|
+
.RE
|
294
|
+
.RE
|
295
|
+
.PP
|
296
|
+
The function `tcadbget2' is used in order to retrieve a string record in an abstract database object.
|
297
|
+
.PP
|
298
|
+
.RS
|
299
|
+
.br
|
300
|
+
\fBchar *tcadbget2(TCADB *\fIadb\fB, const char *\fIkstr\fB);\fR
|
301
|
+
.RS
|
302
|
+
`\fIadb\fR' specifies the abstract database object.
|
303
|
+
.RE
|
304
|
+
.RS
|
305
|
+
`\fIkstr\fR' specifies the string of the key.
|
306
|
+
.RE
|
307
|
+
.RS
|
308
|
+
If successful, the return value is the string of the value of the corresponding record. `NULL' is returned if no record corresponds.
|
309
|
+
.RE
|
310
|
+
.RS
|
311
|
+
Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use.
|
312
|
+
.RE
|
313
|
+
.RE
|
314
|
+
.PP
|
315
|
+
The function `tcadbvsiz' is used in order to get the size of the value of a record in an abstract database object.
|
316
|
+
.PP
|
317
|
+
.RS
|
318
|
+
.br
|
319
|
+
\fBint tcadbvsiz(TCADB *\fIadb\fB, const void *\fIkbuf\fB, int \fIksiz\fB);\fR
|
320
|
+
.RS
|
321
|
+
`\fIadb\fR' specifies the abstract database object.
|
322
|
+
.RE
|
323
|
+
.RS
|
324
|
+
`\fIkbuf\fR' specifies the pointer to the region of the key.
|
325
|
+
.RE
|
326
|
+
.RS
|
327
|
+
`\fIksiz\fR' specifies the size of the region of the key.
|
328
|
+
.RE
|
329
|
+
.RS
|
330
|
+
If successful, the return value is the size of the value of the corresponding record, else, it is \-1.
|
331
|
+
.RE
|
332
|
+
.RE
|
333
|
+
.PP
|
334
|
+
The function `tcadbvsiz2' is used in order to get the size of the value of a string record in an abstract database object.
|
335
|
+
.PP
|
336
|
+
.RS
|
337
|
+
.br
|
338
|
+
\fBint tcadbvsiz2(TCADB *\fIadb\fB, const char *\fIkstr\fB);\fR
|
339
|
+
.RS
|
340
|
+
`\fIadb\fR' specifies the abstract database object.
|
341
|
+
.RE
|
342
|
+
.RS
|
343
|
+
`\fIkstr\fR' specifies the string of the key.
|
344
|
+
.RE
|
345
|
+
.RS
|
346
|
+
If successful, the return value is the size of the value of the corresponding record, else, it is \-1.
|
347
|
+
.RE
|
348
|
+
.RE
|
349
|
+
.PP
|
350
|
+
The function `tcadbiterinit' is used in order to initialize the iterator of an abstract database object.
|
351
|
+
.PP
|
352
|
+
.RS
|
353
|
+
.br
|
354
|
+
\fBbool tcadbiterinit(TCADB *\fIadb\fB);\fR
|
355
|
+
.RS
|
356
|
+
`\fIadb\fR' specifies the abstract database object.
|
357
|
+
.RE
|
358
|
+
.RS
|
359
|
+
If successful, the return value is true, else, it is false.
|
360
|
+
.RE
|
361
|
+
.RS
|
362
|
+
The iterator is used in order to access the key of every record stored in a database.
|
363
|
+
.RE
|
364
|
+
.RE
|
365
|
+
.PP
|
366
|
+
The function `tcadbiternext' is used in order to get the next key of the iterator of an abstract database object.
|
367
|
+
.PP
|
368
|
+
.RS
|
369
|
+
.br
|
370
|
+
\fBvoid *tcadbiternext(TCADB *\fIadb\fB, int *\fIsp\fB);\fR
|
371
|
+
.RS
|
372
|
+
`\fIadb\fR' specifies the abstract database object.
|
373
|
+
.RE
|
374
|
+
.RS
|
375
|
+
`\fIsp\fR' specifies the pointer to the variable into which the size of the region of the return value is assigned.
|
376
|
+
.RE
|
377
|
+
.RS
|
378
|
+
If successful, the return value is the pointer to the region of the next key, else, it is `NULL'. `NULL' is returned when no record is to be get out of the iterator.
|
379
|
+
.RE
|
380
|
+
.RS
|
381
|
+
Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use. It is possible to access every record by iteration of calling this function. It is allowed to update or remove records whose keys are fetched while the iteration. However, it is not assured if updating the database is occurred while the iteration. Besides, the order of this traversal access method is arbitrary, so it is not assured that the order of storing matches the one of the traversal access.
|
382
|
+
.RE
|
383
|
+
.RE
|
384
|
+
.PP
|
385
|
+
The function `tcadbiternext2' is used in order to get the next key string of the iterator of an abstract database object.
|
386
|
+
.PP
|
387
|
+
.RS
|
388
|
+
.br
|
389
|
+
\fBchar *tcadbiternext2(TCADB *\fIadb\fB);\fR
|
390
|
+
.RS
|
391
|
+
`\fIadb\fR' specifies the abstract database object.
|
392
|
+
.RE
|
393
|
+
.RS
|
394
|
+
If successful, the return value is the string of the next key, else, it is `NULL'. `NULL' is returned when no record is to be get out of the iterator.
|
395
|
+
.RE
|
396
|
+
.RS
|
397
|
+
Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call when it is no longer in use. It is possible to access every record by iteration of calling this function. However, it is not assured if updating the database is occurred while the iteration. Besides, the order of this traversal access method is arbitrary, so it is not assured that the order of storing matches the one of the traversal access.
|
398
|
+
.RE
|
399
|
+
.RE
|
400
|
+
.PP
|
401
|
+
The function `tcadbfwmkeys' is used in order to get forward matching keys in an abstract database object.
|
402
|
+
.PP
|
403
|
+
.RS
|
404
|
+
.br
|
405
|
+
\fBTCLIST *tcadbfwmkeys(TCADB *\fIadb\fB, const void *\fIpbuf\fB, int \fIpsiz\fB, int \fImax\fB);\fR
|
406
|
+
.RS
|
407
|
+
`\fIadb\fR' specifies the abstract database object.
|
408
|
+
.RE
|
409
|
+
.RS
|
410
|
+
`\fIpbuf\fR' specifies the pointer to the region of the prefix.
|
411
|
+
.RE
|
412
|
+
.RS
|
413
|
+
`\fIpsiz\fR' specifies the size of the region of the prefix.
|
414
|
+
.RE
|
415
|
+
.RS
|
416
|
+
`\fImax\fR' specifies the maximum number of keys to be fetched. If it is negative, no limit is specified.
|
417
|
+
.RE
|
418
|
+
.RS
|
419
|
+
The return value is a list object of the corresponding keys. This function does never fail. It returns an empty list even if no key corresponds.
|
420
|
+
.RE
|
421
|
+
.RS
|
422
|
+
Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use. Note that this function may be very slow because every key in the database is scanned.
|
423
|
+
.RE
|
424
|
+
.RE
|
425
|
+
.PP
|
426
|
+
The function `tcadbfwmkeys2' is used in order to get forward matching string keys in an abstract database object.
|
427
|
+
.PP
|
428
|
+
.RS
|
429
|
+
.br
|
430
|
+
\fBTCLIST *tcadbfwmkeys2(TCADB *\fIadb\fB, const char *\fIpstr\fB, int \fImax\fB);\fR
|
431
|
+
.RS
|
432
|
+
`\fIadb\fR' specifies the abstract database object.
|
433
|
+
.RE
|
434
|
+
.RS
|
435
|
+
`\fIpstr\fR' specifies the string of the prefix.
|
436
|
+
.RE
|
437
|
+
.RS
|
438
|
+
`\fImax\fR' specifies the maximum number of keys to be fetched. If it is negative, no limit is specified.
|
439
|
+
.RE
|
440
|
+
.RS
|
441
|
+
The return value is a list object of the corresponding keys. This function does never fail. It returns an empty list even if no key corresponds.
|
442
|
+
.RE
|
443
|
+
.RS
|
444
|
+
Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use. Note that this function may be very slow because every key in the database is scanned.
|
445
|
+
.RE
|
446
|
+
.RE
|
447
|
+
.PP
|
448
|
+
The function `tcadbaddint' is used in order to add an integer to a record in an abstract database object.
|
449
|
+
.PP
|
450
|
+
.RS
|
451
|
+
.br
|
452
|
+
\fBint tcadbaddint(TCADB *\fIadb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, int \fInum\fB);\fR
|
453
|
+
.RS
|
454
|
+
`\fIadb\fR' specifies the abstract database object.
|
455
|
+
.RE
|
456
|
+
.RS
|
457
|
+
`\fIkbuf\fR' specifies the pointer to the region of the key.
|
458
|
+
.RE
|
459
|
+
.RS
|
460
|
+
`\fIksiz\fR' specifies the size of the region of the key.
|
461
|
+
.RE
|
462
|
+
.RS
|
463
|
+
`\fInum\fR' specifies the additional value.
|
464
|
+
.RE
|
465
|
+
.RS
|
466
|
+
If successful, the return value is the summation value, else, it is `INT_MIN'.
|
467
|
+
.RE
|
468
|
+
.RS
|
469
|
+
If the corresponding record exists, the value is treated as an integer and is added to. If no record corresponds, a new record of the additional value is stored.
|
470
|
+
.RE
|
471
|
+
.RE
|
472
|
+
.PP
|
473
|
+
The function `tcadbadddouble' is used in order to add a real number to a record in an abstract database object.
|
474
|
+
.PP
|
475
|
+
.RS
|
476
|
+
.br
|
477
|
+
\fBdouble tcadbadddouble(TCADB *\fIadb\fB, const void *\fIkbuf\fB, int \fIksiz\fB, double \fInum\fB);\fR
|
478
|
+
.RS
|
479
|
+
`\fIadb\fR' specifies the abstract database object.
|
480
|
+
.RE
|
481
|
+
.RS
|
482
|
+
`\fIkbuf\fR' specifies the pointer to the region of the key.
|
483
|
+
.RE
|
484
|
+
.RS
|
485
|
+
`\fIksiz\fR' specifies the size of the region of the key.
|
486
|
+
.RE
|
487
|
+
.RS
|
488
|
+
`\fInum\fR' specifies the additional value.
|
489
|
+
.RE
|
490
|
+
.RS
|
491
|
+
If successful, the return value is the summation value, else, it is Not-a-Number.
|
492
|
+
.RE
|
493
|
+
.RS
|
494
|
+
If the corresponding record exists, the value is treated as a real number and is added to. If no record corresponds, a new record of the additional value is stored.
|
495
|
+
.RE
|
496
|
+
.RE
|
497
|
+
.PP
|
498
|
+
The function `tcadbsync' is used in order to synchronize updated contents of an abstract database object with the file and the device.
|
499
|
+
.PP
|
500
|
+
.RS
|
501
|
+
.br
|
502
|
+
\fBbool tcadbsync(TCADB *\fIadb\fB);\fR
|
503
|
+
.RS
|
504
|
+
`\fIadb\fR' specifies the abstract database object.
|
505
|
+
.RE
|
506
|
+
.RS
|
507
|
+
If successful, the return value is true, else, it is false.
|
508
|
+
.RE
|
509
|
+
.RE
|
510
|
+
.PP
|
511
|
+
The function `tcadboptimize' is used in order to optimize the storage of an abstract database object.
|
512
|
+
.PP
|
513
|
+
.RS
|
514
|
+
.br
|
515
|
+
\fBbool tcadboptimize(TCADB *\fIadb\fB, const char *\fIparams\fB);\fR
|
516
|
+
.RS
|
517
|
+
`\fIadb\fR' specifies the abstract database object.
|
518
|
+
.RE
|
519
|
+
.RS
|
520
|
+
`\fIparams\fR' specifies the string of the tuning parameters, which works as with the tuning of parameters the function `tcadbopen'. If it is `NULL', it is not used.
|
521
|
+
.RE
|
522
|
+
.RS
|
523
|
+
If successful, the return value is true, else, it is false.
|
524
|
+
.RE
|
525
|
+
.RS
|
526
|
+
This function is useful to reduce the size of the database storage with data fragmentation by successive updating.
|
527
|
+
.RE
|
528
|
+
.RE
|
529
|
+
.PP
|
530
|
+
The function `tcadbvanish' is used in order to remove all records of an abstract database object.
|
531
|
+
.PP
|
532
|
+
.RS
|
533
|
+
.br
|
534
|
+
\fBbool tcadbvanish(TCADB *\fIadb\fB);\fR
|
535
|
+
.RS
|
536
|
+
`\fIadb\fR' specifies the abstract database object.
|
537
|
+
.RE
|
538
|
+
.RS
|
539
|
+
If successful, the return value is true, else, it is false.
|
540
|
+
.RE
|
541
|
+
.RE
|
542
|
+
.PP
|
543
|
+
The function `tcadbcopy' is used in order to copy the database file of an abstract database object.
|
544
|
+
.PP
|
545
|
+
.RS
|
546
|
+
.br
|
547
|
+
\fBbool tcadbcopy(TCADB *\fIadb\fB, const char *\fIpath\fB);\fR
|
548
|
+
.RS
|
549
|
+
`\fIadb\fR' specifies the abstract database object.
|
550
|
+
.RE
|
551
|
+
.RS
|
552
|
+
`\fIpath\fR' specifies the path of the destination file. If it begins with `@', the trailing substring is executed as a command line.
|
553
|
+
.RE
|
554
|
+
.RS
|
555
|
+
If successful, the return value is true, else, it is false. False is returned if the executed command returns non\-zero code.
|
556
|
+
.RE
|
557
|
+
.RS
|
558
|
+
The database file is assured to be kept synchronized and not modified while the copying or executing operation is in progress. So, this function is useful to create a backup file of the database file.
|
559
|
+
.RE
|
560
|
+
.RE
|
561
|
+
.PP
|
562
|
+
The function `tcadbtranbegin' is used in order to begin the transaction of an abstract database object.
|
563
|
+
.PP
|
564
|
+
.RS
|
565
|
+
.br
|
566
|
+
\fBbool tcadbtranbegin(TCADB *\fIadb\fB);\fR
|
567
|
+
.RS
|
568
|
+
`\fIadb\fR' specifies the abstract database object.
|
569
|
+
.RE
|
570
|
+
.RS
|
571
|
+
If successful, the return value is true, else, it is false.
|
572
|
+
.RE
|
573
|
+
.RS
|
574
|
+
The database is locked by the thread while the transaction so that only one transaction can be activated with a database object at the same time. Thus, the serializable isolation level is assumed if every database operation is performed in the transaction. All updated regions are kept track of by write ahead logging while the transaction. If the database is closed during transaction, the transaction is aborted implicitly.
|
575
|
+
.RE
|
576
|
+
.RE
|
577
|
+
.PP
|
578
|
+
The function `tcadbtrancommit' is used in order to commit the transaction of an abstract database object.
|
579
|
+
.PP
|
580
|
+
.RS
|
581
|
+
.br
|
582
|
+
\fBbool tcadbtrancommit(TCADB *\fIadb\fB);\fR
|
583
|
+
.RS
|
584
|
+
`\fIadb\fR' specifies the abstract database object.
|
585
|
+
.RE
|
586
|
+
.RS
|
587
|
+
If successful, the return value is true, else, it is false.
|
588
|
+
.RE
|
589
|
+
.RS
|
590
|
+
Update in the transaction is fixed when it is committed successfully.
|
591
|
+
.RE
|
592
|
+
.RE
|
593
|
+
.PP
|
594
|
+
The function `tcadbtranabort' is used in order to abort the transaction of an abstract database object.
|
595
|
+
.PP
|
596
|
+
.RS
|
597
|
+
.br
|
598
|
+
\fBbool tcadbtranabort(TCADB *\fIadb\fB);\fR
|
599
|
+
.RS
|
600
|
+
`\fIadb\fR' specifies the abstract database object.
|
601
|
+
.RE
|
602
|
+
.RS
|
603
|
+
If successful, the return value is true, else, it is false.
|
604
|
+
.RE
|
605
|
+
.RS
|
606
|
+
Update in the transaction is discarded when it is aborted. The state of the database is rollbacked to before transaction.
|
607
|
+
.RE
|
608
|
+
.RE
|
609
|
+
.PP
|
610
|
+
The function `tcadbpath' is used in order to get the file path of an abstract database object.
|
611
|
+
.PP
|
612
|
+
.RS
|
613
|
+
.br
|
614
|
+
\fBconst char *tcadbpath(TCADB *\fIadb\fB);\fR
|
615
|
+
.RS
|
616
|
+
`\fIadb\fR' specifies the abstract database object.
|
617
|
+
.RE
|
618
|
+
.RS
|
619
|
+
The return value is the path of the database file or `NULL' if the object does not connect to any database. "*" stands for on\-memory hash database. "+" stands for on\-memory tree database.
|
620
|
+
.RE
|
621
|
+
.RE
|
622
|
+
.PP
|
623
|
+
The function `tcadbrnum' is used in order to get the number of records of an abstract database object.
|
624
|
+
.PP
|
625
|
+
.RS
|
626
|
+
.br
|
627
|
+
\fBuint64_t tcadbrnum(TCADB *\fIadb\fB);\fR
|
628
|
+
.RS
|
629
|
+
`\fIadb\fR' specifies the abstract database object.
|
630
|
+
.RE
|
631
|
+
.RS
|
632
|
+
The return value is the number of records or 0 if the object does not connect to any database instance.
|
633
|
+
.RE
|
634
|
+
.RE
|
635
|
+
.PP
|
636
|
+
The function `tcadbsize' is used in order to get the size of the database of an abstract database object.
|
637
|
+
.PP
|
638
|
+
.RS
|
639
|
+
.br
|
640
|
+
\fBuint64_t tcadbsize(TCADB *\fIadb\fB);\fR
|
641
|
+
.RS
|
642
|
+
`\fIadb\fR' specifies the abstract database object.
|
643
|
+
.RE
|
644
|
+
.RS
|
645
|
+
The return value is the size of the database or 0 if the object does not connect to any database instance.
|
646
|
+
.RE
|
647
|
+
.RE
|
648
|
+
.PP
|
649
|
+
The function `tcadbmisc' is used in order to call a versatile function for miscellaneous operations of an abstract database object.
|
650
|
+
.PP
|
651
|
+
.RS
|
652
|
+
.br
|
653
|
+
\fBTCLIST *tcadbmisc(TCADB *\fIadb\fB, const char *\fIname\fB, const TCLIST *\fIargs\fB);\fR
|
654
|
+
.RS
|
655
|
+
`\fIadb\fR' specifies the abstract database object.
|
656
|
+
.RE
|
657
|
+
.RS
|
658
|
+
`\fIname\fR' specifies the name of the function. All databases support "put", "out", "get", "putlist", "outlist", "getlist", and "getpart". "put" is to store a record. It receives a key and a value, and returns an empty list. "out" is to remove a record. It receives a key, and returns an empty list. "get" is to retrieve a record. It receives a key, and returns a list of the values. "putlist" is to store records. It receives keys and values one after the other, and returns an empty list. "outlist" is to remove records. It receives keys, and returns an empty list. "getlist" is to retrieve records. It receives keys, and returns keys and values of corresponding records one after the other. "getpart" is to retrieve the partial value of a record. It receives a key, the offset of the region, and the length of the region.
|
659
|
+
.RE
|
660
|
+
.RS
|
661
|
+
`\fIargs\fR' specifies a list object containing arguments.
|
662
|
+
.RE
|
663
|
+
.RS
|
664
|
+
If successful, the return value is a list object of the result. `NULL' is returned on failure.
|
665
|
+
.RE
|
666
|
+
.RS
|
667
|
+
Because the object of the return value is created with the function `tclistnew', it should be deleted with the function `tclistdel' when it is no longer in use.
|
668
|
+
.RE
|
669
|
+
.RE
|
670
|
+
|
671
|
+
.SH SEE ALSO
|
672
|
+
.PP
|
673
|
+
.BR tcatest (1),
|
674
|
+
.BR tcamttest (1),
|
675
|
+
.BR tcamgr (1),
|
676
|
+
.BR tokyocabinet (3)
|