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,871 @@
|
|
1
|
+
/*************************************************************************************************
|
2
|
+
* The hash database API of Tokyo Cabinet
|
3
|
+
* Copyright (C) 2006-2009 Mikio Hirabayashi
|
4
|
+
* This file is part of Tokyo Cabinet.
|
5
|
+
* Tokyo Cabinet is free software; you can redistribute it and/or modify it under the terms of
|
6
|
+
* the GNU Lesser General Public License as published by the Free Software Foundation; either
|
7
|
+
* version 2.1 of the License or any later version. Tokyo Cabinet is distributed in the hope
|
8
|
+
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
10
|
+
* License for more details.
|
11
|
+
* You should have received a copy of the GNU Lesser General Public License along with Tokyo
|
12
|
+
* Cabinet; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
13
|
+
* Boston, MA 02111-1307 USA.
|
14
|
+
*************************************************************************************************/
|
15
|
+
|
16
|
+
|
17
|
+
#ifndef _TCHDB_H /* duplication check */
|
18
|
+
#define _TCHDB_H
|
19
|
+
|
20
|
+
#if defined(__cplusplus)
|
21
|
+
#define __TCHDB_CLINKAGEBEGIN extern "C" {
|
22
|
+
#define __TCHDB_CLINKAGEEND }
|
23
|
+
#else
|
24
|
+
#define __TCHDB_CLINKAGEBEGIN
|
25
|
+
#define __TCHDB_CLINKAGEEND
|
26
|
+
#endif
|
27
|
+
__TCHDB_CLINKAGEBEGIN
|
28
|
+
|
29
|
+
|
30
|
+
#include <tcutil.h>
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
/*************************************************************************************************
|
35
|
+
* API
|
36
|
+
*************************************************************************************************/
|
37
|
+
|
38
|
+
|
39
|
+
typedef struct { /* type of structure for a hash database */
|
40
|
+
void *mmtx; /* mutex for method */
|
41
|
+
void *rmtxs; /* mutexes for records */
|
42
|
+
void *dmtx; /* mutex for the while database */
|
43
|
+
void *tmtx; /* mutex for transaction */
|
44
|
+
void *wmtx; /* mutex for write ahead logging */
|
45
|
+
void *eckey; /* key for thread specific error code */
|
46
|
+
char *rpath; /* real path for locking */
|
47
|
+
uint8_t type; /* database type */
|
48
|
+
uint8_t flags; /* additional flags */
|
49
|
+
uint64_t bnum; /* number of the bucket array */
|
50
|
+
uint8_t apow; /* power of record alignment */
|
51
|
+
uint8_t fpow; /* power of free block pool number */
|
52
|
+
uint8_t opts; /* options */
|
53
|
+
char *path; /* path of the database file */
|
54
|
+
int fd; /* file descriptor of the database file */
|
55
|
+
uint32_t omode; /* open mode */
|
56
|
+
uint64_t rnum; /* number of the records */
|
57
|
+
uint64_t fsiz; /* size of the database file */
|
58
|
+
uint64_t frec; /* offset of the first record */
|
59
|
+
uint64_t dfcur; /* offset of the cursor for defragmentation */
|
60
|
+
uint64_t iter; /* offset of the iterator */
|
61
|
+
char *map; /* pointer to the mapped memory */
|
62
|
+
uint64_t msiz; /* size of the mapped memory */
|
63
|
+
uint64_t xmsiz; /* size of the extra mapped memory */
|
64
|
+
uint64_t xfsiz; /* extra size of the file for mapped memory */
|
65
|
+
uint32_t *ba32; /* 32-bit bucket array */
|
66
|
+
uint64_t *ba64; /* 64-bit bucket array */
|
67
|
+
uint32_t align; /* record alignment */
|
68
|
+
uint32_t runit; /* record reading unit */
|
69
|
+
bool zmode; /* whether compression is used */
|
70
|
+
int32_t fbpmax; /* maximum number of the free block pool */
|
71
|
+
void *fbpool; /* free block pool */
|
72
|
+
int32_t fbpnum; /* number of the free block pool */
|
73
|
+
int32_t fbpmis; /* number of missing retrieval of the free block pool */
|
74
|
+
bool async; /* whether asynchronous storing is called */
|
75
|
+
TCXSTR *drpool; /* delayed record pool */
|
76
|
+
TCXSTR *drpdef; /* deferred records of the delayed record pool */
|
77
|
+
uint64_t drpoff; /* offset of the delayed record pool */
|
78
|
+
TCMDB *recc; /* cache for records */
|
79
|
+
uint32_t rcnum; /* maximum number of cached records */
|
80
|
+
TCCODEC enc; /* pointer to the encoding function */
|
81
|
+
void *encop; /* opaque object for the encoding functions */
|
82
|
+
TCCODEC dec; /* pointer to the decoding function */
|
83
|
+
void *decop; /* opaque object for the decoding functions */
|
84
|
+
int ecode; /* last happened error code */
|
85
|
+
bool fatal; /* whether a fatal error occured */
|
86
|
+
uint64_t inode; /* inode number */
|
87
|
+
time_t mtime; /* modification time */
|
88
|
+
uint32_t dfunit; /* unit step number of auto defragmentation */
|
89
|
+
uint32_t dfcnt; /* counter of auto defragmentation */
|
90
|
+
bool tran; /* whether in the transaction */
|
91
|
+
int walfd; /* file descriptor of write ahead logging */
|
92
|
+
uint64_t walend; /* end offset of write ahead logging */
|
93
|
+
int dbgfd; /* file descriptor for debugging */
|
94
|
+
int64_t cnt_writerec; /* tesing counter for record write times */
|
95
|
+
int64_t cnt_reuserec; /* tesing counter for record reuse times */
|
96
|
+
int64_t cnt_moverec; /* tesing counter for record move times */
|
97
|
+
int64_t cnt_readrec; /* tesing counter for record read times */
|
98
|
+
int64_t cnt_searchfbp; /* tesing counter for FBP search times */
|
99
|
+
int64_t cnt_insertfbp; /* tesing counter for FBP insert times */
|
100
|
+
int64_t cnt_splicefbp; /* tesing counter for FBP splice times */
|
101
|
+
int64_t cnt_dividefbp; /* tesing counter for FBP divide times */
|
102
|
+
int64_t cnt_mergefbp; /* tesing counter for FBP merge times */
|
103
|
+
int64_t cnt_reducefbp; /* tesing counter for FBP reduce times */
|
104
|
+
int64_t cnt_appenddrp; /* tesing counter for DRP append times */
|
105
|
+
int64_t cnt_deferdrp; /* tesing counter for DRP defer times */
|
106
|
+
int64_t cnt_flushdrp; /* tesing counter for DRP flush times */
|
107
|
+
int64_t cnt_adjrecc; /* tesing counter for record cache adjust times */
|
108
|
+
int64_t cnt_defrag; /* tesing counter for defragmentation times */
|
109
|
+
int64_t cnt_shiftrec; /* tesing counter for record shift times */
|
110
|
+
int64_t cnt_trunc; /* tesing counter for truncation times */
|
111
|
+
} TCHDB;
|
112
|
+
|
113
|
+
enum { /* enumeration for additional flags */
|
114
|
+
HDBFOPEN = 1 << 0, /* whether opened */
|
115
|
+
HDBFFATAL = 1 << 1 /* whetehr with fatal error */
|
116
|
+
};
|
117
|
+
|
118
|
+
enum { /* enumeration for tuning options */
|
119
|
+
HDBTLARGE = 1 << 0, /* use 64-bit bucket array */
|
120
|
+
HDBTDEFLATE = 1 << 1, /* compress each record with Deflate */
|
121
|
+
HDBTBZIP = 1 << 2, /* compress each record with BZIP2 */
|
122
|
+
HDBTTCBS = 1 << 3, /* compress each record with TCBS */
|
123
|
+
HDBTEXCODEC = 1 << 4 /* compress each record with custom functions */
|
124
|
+
};
|
125
|
+
|
126
|
+
enum { /* enumeration for open modes */
|
127
|
+
HDBOREADER = 1 << 0, /* open as a reader */
|
128
|
+
HDBOWRITER = 1 << 1, /* open as a writer */
|
129
|
+
HDBOCREAT = 1 << 2, /* writer creating */
|
130
|
+
HDBOTRUNC = 1 << 3, /* writer truncating */
|
131
|
+
HDBONOLCK = 1 << 4, /* open without locking */
|
132
|
+
HDBOLCKNB = 1 << 5, /* lock without blocking */
|
133
|
+
HDBOTSYNC = 1 << 6 /* synchronize every transaction */
|
134
|
+
};
|
135
|
+
|
136
|
+
|
137
|
+
/* Get the message string corresponding to an error code.
|
138
|
+
`ecode' specifies the error code.
|
139
|
+
The return value is the message string of the error code. */
|
140
|
+
const char *tchdberrmsg(int ecode);
|
141
|
+
|
142
|
+
|
143
|
+
/* Create a hash database object.
|
144
|
+
The return value is the new hash database object. */
|
145
|
+
TCHDB *tchdbnew(void);
|
146
|
+
|
147
|
+
|
148
|
+
/* Delete a hash database object.
|
149
|
+
`hdb' specifies the hash database object.
|
150
|
+
If the database is not closed, it is closed implicitly. Note that the deleted object and its
|
151
|
+
derivatives can not be used anymore. */
|
152
|
+
void tchdbdel(TCHDB *hdb);
|
153
|
+
|
154
|
+
|
155
|
+
/* Get the last happened error code of a hash database object.
|
156
|
+
`hdb' specifies the hash database object.
|
157
|
+
The return value is the last happened error code.
|
158
|
+
The following error codes are defined: `TCESUCCESS' for success, `TCETHREAD' for threading
|
159
|
+
error, `TCEINVALID' for invalid operation, `TCENOFILE' for file not found, `TCENOPERM' for no
|
160
|
+
permission, `TCEMETA' for invalid meta data, `TCERHEAD' for invalid record header, `TCEOPEN'
|
161
|
+
for open error, `TCECLOSE' for close error, `TCETRUNC' for trunc error, `TCESYNC' for sync
|
162
|
+
error, `TCESTAT' for stat error, `TCESEEK' for seek error, `TCEREAD' for read error,
|
163
|
+
`TCEWRITE' for write error, `TCEMMAP' for mmap error, `TCELOCK' for lock error, `TCEUNLINK'
|
164
|
+
for unlink error, `TCERENAME' for rename error, `TCEMKDIR' for mkdir error, `TCERMDIR' for
|
165
|
+
rmdir error, `TCEKEEP' for existing record, `TCENOREC' for no record found, and `TCEMISC' for
|
166
|
+
miscellaneous error. */
|
167
|
+
int tchdbecode(TCHDB *hdb);
|
168
|
+
|
169
|
+
|
170
|
+
/* Set mutual exclusion control of a hash database object for threading.
|
171
|
+
`hdb' specifies the hash database object which is not opened.
|
172
|
+
If successful, the return value is true, else, it is false.
|
173
|
+
Note that the mutual exclusion control is needed if the object is shared by plural threads and
|
174
|
+
this function should be called before the database is opened. */
|
175
|
+
bool tchdbsetmutex(TCHDB *hdb);
|
176
|
+
|
177
|
+
|
178
|
+
/* Set the tuning parameters of a hash database object.
|
179
|
+
`hdb' specifies the hash database object which is not opened.
|
180
|
+
`bnum' specifies the number of elements of the bucket array. If it is not more than 0, the
|
181
|
+
default value is specified. The default value is 131071. Suggested size of the bucket array
|
182
|
+
is about from 0.5 to 4 times of the number of all records to be stored.
|
183
|
+
`apow' specifies the size of record alignment by power of 2. If it is negative, the default
|
184
|
+
value is specified. The default value is 4 standing for 2^4=16.
|
185
|
+
`fpow' specifies the maximum number of elements of the free block pool by power of 2. If it
|
186
|
+
is negative, the default value is specified. The default value is 10 standing for 2^10=1024.
|
187
|
+
`opts' specifies options by bitwise-or: `HDBTLARGE' specifies that the size of the database
|
188
|
+
can be larger than 2GB by using 64-bit bucket array, `HDBTDEFLATE' specifies that each record
|
189
|
+
is compressed with Deflate encoding, `HDBTBZIP' specifies that each record is compressed with
|
190
|
+
BZIP2 encoding, `HDBTTCBS' specifies that each record is compressed with TCBS encoding.
|
191
|
+
If successful, the return value is true, else, it is false.
|
192
|
+
Note that the tuning parameters should be set before the database is opened. */
|
193
|
+
bool tchdbtune(TCHDB *hdb, int64_t bnum, int8_t apow, int8_t fpow, uint8_t opts);
|
194
|
+
|
195
|
+
|
196
|
+
/* Set the caching parameters of a hash database object.
|
197
|
+
`hdb' specifies the hash database object which is not opened.
|
198
|
+
`rcnum' specifies the maximum number of records to be cached. If it is not more than 0, the
|
199
|
+
record cache is disabled. It is disabled by default.
|
200
|
+
If successful, the return value is true, else, it is false.
|
201
|
+
Note that the caching parameters should be set before the database is opened. */
|
202
|
+
bool tchdbsetcache(TCHDB *hdb, int32_t rcnum);
|
203
|
+
|
204
|
+
|
205
|
+
/* Set the size of the extra mapped memory of a hash database object.
|
206
|
+
`hdb' specifies the hash database object which is not opened.
|
207
|
+
`xmsiz' specifies the size of the extra mapped memory. If it is not more than 0, the extra
|
208
|
+
mapped memory is disabled. The default size is 67108864.
|
209
|
+
If successful, the return value is true, else, it is false.
|
210
|
+
Note that the mapping parameters should be set before the database is opened. */
|
211
|
+
bool tchdbsetxmsiz(TCHDB *hdb, int64_t xmsiz);
|
212
|
+
|
213
|
+
|
214
|
+
/* Set the unit step number of auto defragmentation of a hash database object.
|
215
|
+
`hdb' specifies the hash database object which is not opened.
|
216
|
+
`dfunit' specifie the unit step number. If it is not more than 0, the auto defragmentation
|
217
|
+
is disabled. It is disabled by default.
|
218
|
+
If successful, the return value is true, else, it is false.
|
219
|
+
Note that the defragmentation parameters should be set before the database is opened. */
|
220
|
+
bool tchdbsetdfunit(TCHDB *hdb, int32_t dfunit);
|
221
|
+
|
222
|
+
|
223
|
+
/* Open a database file and connect a hash database object.
|
224
|
+
`hdb' specifies the hash database object which is not opened.
|
225
|
+
`path' specifies the path of the database file.
|
226
|
+
`omode' specifies the connection mode: `HDBOWRITER' as a writer, `HDBOREADER' as a reader.
|
227
|
+
If the mode is `HDBOWRITER', the following may be added by bitwise-or: `HDBOCREAT', which
|
228
|
+
means it creates a new database if not exist, `HDBOTRUNC', which means it creates a new
|
229
|
+
database regardless if one exists, `HDBOTSYNC', which means every transaction synchronizes
|
230
|
+
updated contents with the device. Both of `HDBOREADER' and `HDBOWRITER' can be added to by
|
231
|
+
bitwise-or: `HDBONOLCK', which means it opens the database file without file locking, or
|
232
|
+
`HDBOLCKNB', which means locking is performed without blocking.
|
233
|
+
If successful, the return value is true, else, it is false. */
|
234
|
+
bool tchdbopen(TCHDB *hdb, const char *path, int omode);
|
235
|
+
|
236
|
+
|
237
|
+
/* Close a hash database object.
|
238
|
+
`hdb' specifies the hash database object.
|
239
|
+
If successful, the return value is true, else, it is false.
|
240
|
+
Update of a database is assured to be written when the database is closed. If a writer opens
|
241
|
+
a database but does not close it appropriately, the database will be broken. */
|
242
|
+
bool tchdbclose(TCHDB *hdb);
|
243
|
+
|
244
|
+
|
245
|
+
/* Store a record into a hash database object.
|
246
|
+
`hdb' specifies the hash database object connected as a writer.
|
247
|
+
`kbuf' specifies the pointer to the region of the key.
|
248
|
+
`ksiz' specifies the size of the region of the key.
|
249
|
+
`vbuf' specifies the pointer to the region of the value.
|
250
|
+
`vsiz' specifies the size of the region of the value.
|
251
|
+
If successful, the return value is true, else, it is false.
|
252
|
+
If a record with the same key exists in the database, it is overwritten. */
|
253
|
+
bool tchdbput(TCHDB *hdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);
|
254
|
+
|
255
|
+
|
256
|
+
/* Store a string record into a hash database object.
|
257
|
+
`hdb' specifies the hash database object connected as a writer.
|
258
|
+
`kstr' specifies the string of the key.
|
259
|
+
`vstr' specifies the string of the value.
|
260
|
+
If successful, the return value is true, else, it is false.
|
261
|
+
If a record with the same key exists in the database, it is overwritten. */
|
262
|
+
bool tchdbput2(TCHDB *hdb, const char *kstr, const char *vstr);
|
263
|
+
|
264
|
+
|
265
|
+
/* Store a new record into a hash database object.
|
266
|
+
`hdb' specifies the hash database object connected as a writer.
|
267
|
+
`kbuf' specifies the pointer to the region of the key.
|
268
|
+
`ksiz' specifies the size of the region of the key.
|
269
|
+
`vbuf' specifies the pointer to the region of the value.
|
270
|
+
`vsiz' specifies the size of the region of the value.
|
271
|
+
If successful, the return value is true, else, it is false.
|
272
|
+
If a record with the same key exists in the database, this function has no effect. */
|
273
|
+
bool tchdbputkeep(TCHDB *hdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);
|
274
|
+
|
275
|
+
|
276
|
+
/* Store a new string record into a hash database object.
|
277
|
+
`hdb' specifies the hash database object connected as a writer.
|
278
|
+
`kstr' specifies the string of the key.
|
279
|
+
`vstr' specifies the string of the value.
|
280
|
+
If successful, the return value is true, else, it is false.
|
281
|
+
If a record with the same key exists in the database, this function has no effect. */
|
282
|
+
bool tchdbputkeep2(TCHDB *hdb, const char *kstr, const char *vstr);
|
283
|
+
|
284
|
+
|
285
|
+
/* Concatenate a value at the end of the existing record in a hash database object.
|
286
|
+
`hdb' specifies the hash database object connected as a writer.
|
287
|
+
`kbuf' specifies the pointer to the region of the key.
|
288
|
+
`ksiz' specifies the size of the region of the key.
|
289
|
+
`vbuf' specifies the pointer to the region of the value.
|
290
|
+
`vsiz' specifies the size of the region of the value.
|
291
|
+
If successful, the return value is true, else, it is false.
|
292
|
+
If there is no corresponding record, a new record is created. */
|
293
|
+
bool tchdbputcat(TCHDB *hdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);
|
294
|
+
|
295
|
+
|
296
|
+
/* Concatenate a string value at the end of the existing record in a hash database object.
|
297
|
+
`hdb' specifies the hash database object connected as a writer.
|
298
|
+
`kstr' specifies the string of the key.
|
299
|
+
`vstr' specifies the string of the value.
|
300
|
+
If successful, the return value is true, else, it is false.
|
301
|
+
If there is no corresponding record, a new record is created. */
|
302
|
+
bool tchdbputcat2(TCHDB *hdb, const char *kstr, const char *vstr);
|
303
|
+
|
304
|
+
|
305
|
+
/* Store a record into a hash database object in asynchronous fashion.
|
306
|
+
`hdb' specifies the hash database object connected as a writer.
|
307
|
+
`kbuf' specifies the pointer to the region of the key.
|
308
|
+
`ksiz' specifies the size of the region of the key.
|
309
|
+
`vbuf' specifies the pointer to the region of the value.
|
310
|
+
`vsiz' specifies the size of the region of the value.
|
311
|
+
If successful, the return value is true, else, it is false.
|
312
|
+
If a record with the same key exists in the database, it is overwritten. Records passed to
|
313
|
+
this function are accumulated into the inner buffer and wrote into the file at a blast. */
|
314
|
+
bool tchdbputasync(TCHDB *hdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz);
|
315
|
+
|
316
|
+
|
317
|
+
/* Store a string record into a hash database object in asynchronous fashion.
|
318
|
+
`hdb' specifies the hash database object connected as a writer.
|
319
|
+
`kstr' specifies the string of the key.
|
320
|
+
`vstr' specifies the string of the value.
|
321
|
+
If successful, the return value is true, else, it is false.
|
322
|
+
If a record with the same key exists in the database, it is overwritten. Records passed to
|
323
|
+
this function are accumulated into the inner buffer and wrote into the file at a blast. */
|
324
|
+
bool tchdbputasync2(TCHDB *hdb, const char *kstr, const char *vstr);
|
325
|
+
|
326
|
+
|
327
|
+
/* Remove a record of a hash database object.
|
328
|
+
`hdb' specifies the hash database object connected as a writer.
|
329
|
+
`kbuf' specifies the pointer to the region of the key.
|
330
|
+
`ksiz' specifies the size of the region of the key.
|
331
|
+
If successful, the return value is true, else, it is false. */
|
332
|
+
bool tchdbout(TCHDB *hdb, const void *kbuf, int ksiz);
|
333
|
+
|
334
|
+
|
335
|
+
/* Remove a string record of a hash database object.
|
336
|
+
`hdb' specifies the hash database object connected as a writer.
|
337
|
+
`kstr' specifies the string of the key.
|
338
|
+
If successful, the return value is true, else, it is false. */
|
339
|
+
bool tchdbout2(TCHDB *hdb, const char *kstr);
|
340
|
+
|
341
|
+
|
342
|
+
/* Retrieve a record in a hash database object.
|
343
|
+
`hdb' specifies the hash database object.
|
344
|
+
`kbuf' specifies the pointer to the region of the key.
|
345
|
+
`ksiz' specifies the size of the region of the key.
|
346
|
+
`sp' specifies the pointer to the variable into which the size of the region of the return
|
347
|
+
value is assigned.
|
348
|
+
If successful, the return value is the pointer to the region of the value of the corresponding
|
349
|
+
record. `NULL' is returned if no record corresponds.
|
350
|
+
Because an additional zero code is appended at the end of the region of the return value,
|
351
|
+
the return value can be treated as a character string. Because the region of the return
|
352
|
+
value is allocated with the `malloc' call, it should be released with the `free' call when
|
353
|
+
it is no longer in use. */
|
354
|
+
void *tchdbget(TCHDB *hdb, const void *kbuf, int ksiz, int *sp);
|
355
|
+
|
356
|
+
|
357
|
+
/* Retrieve a string record in a hash database object.
|
358
|
+
`hdb' specifies the hash database object.
|
359
|
+
`kstr' specifies the string of the key.
|
360
|
+
If successful, the return value is the string of the value of the corresponding record.
|
361
|
+
`NULL' is returned if no record corresponds.
|
362
|
+
Because the region of the return value is allocated with the `malloc' call, it should be
|
363
|
+
released with the `free' call when it is no longer in use. */
|
364
|
+
char *tchdbget2(TCHDB *hdb, const char *kstr);
|
365
|
+
|
366
|
+
|
367
|
+
/* Retrieve a record in a hash database object and write the value into a buffer.
|
368
|
+
`hdb' specifies the hash database object.
|
369
|
+
`kbuf' specifies the pointer to the region of the key.
|
370
|
+
`ksiz' specifies the size of the region of the key.
|
371
|
+
`vbuf' specifies the pointer to the buffer into which the value of the corresponding record is
|
372
|
+
written.
|
373
|
+
`max' specifies the size of the buffer.
|
374
|
+
If successful, the return value is the size of the written data, else, it is -1. -1 is
|
375
|
+
returned if no record corresponds to the specified key.
|
376
|
+
Note that an additional zero code is not appended at the end of the region of the writing
|
377
|
+
buffer. */
|
378
|
+
int tchdbget3(TCHDB *hdb, const void *kbuf, int ksiz, void *vbuf, int max);
|
379
|
+
|
380
|
+
|
381
|
+
/* Get the size of the value of a record in a hash database object.
|
382
|
+
`hdb' specifies the hash database object.
|
383
|
+
`kbuf' specifies the pointer to the region of the key.
|
384
|
+
`ksiz' specifies the size of the region of the key.
|
385
|
+
If successful, the return value is the size of the value of the corresponding record, else,
|
386
|
+
it is -1. */
|
387
|
+
int tchdbvsiz(TCHDB *hdb, const void *kbuf, int ksiz);
|
388
|
+
|
389
|
+
|
390
|
+
/* Get the size of the value of a string record in a hash database object.
|
391
|
+
`hdb' specifies the hash database object.
|
392
|
+
`kstr' specifies the string of the key.
|
393
|
+
If successful, the return value is the size of the value of the corresponding record, else,
|
394
|
+
it is -1. */
|
395
|
+
int tchdbvsiz2(TCHDB *hdb, const char *kstr);
|
396
|
+
|
397
|
+
|
398
|
+
/* Initialize the iterator of a hash database object.
|
399
|
+
`hdb' specifies the hash database object.
|
400
|
+
If successful, the return value is true, else, it is false.
|
401
|
+
The iterator is used in order to access the key of every record stored in a database. */
|
402
|
+
bool tchdbiterinit(TCHDB *hdb);
|
403
|
+
|
404
|
+
|
405
|
+
/* Get the next key of the iterator of a hash database object.
|
406
|
+
`hdb' specifies the hash database object.
|
407
|
+
`sp' specifies the pointer to the variable into which the size of the region of the return
|
408
|
+
value is assigned.
|
409
|
+
If successful, the return value is the pointer to the region of the next key, else, it is
|
410
|
+
`NULL'. `NULL' is returned when no record is to be get out of the iterator.
|
411
|
+
Because an additional zero code is appended at the end of the region of the return value, the
|
412
|
+
return value can be treated as a character string. Because the region of the return value is
|
413
|
+
allocated with the `malloc' call, it should be released with the `free' call when it is no
|
414
|
+
longer in use. It is possible to access every record by iteration of calling this function.
|
415
|
+
It is allowed to update or remove records whose keys are fetched while the iteration.
|
416
|
+
However, it is not assured if updating the database is occurred while the iteration. Besides,
|
417
|
+
the order of this traversal access method is arbitrary, so it is not assured that the order of
|
418
|
+
storing matches the one of the traversal access. */
|
419
|
+
void *tchdbiternext(TCHDB *hdb, int *sp);
|
420
|
+
|
421
|
+
|
422
|
+
/* Get the next key string of the iterator of a hash database object.
|
423
|
+
`hdb' specifies the hash database object.
|
424
|
+
If successful, the return value is the string of the next key, else, it is `NULL'. `NULL' is
|
425
|
+
returned when no record is to be get out of the iterator.
|
426
|
+
Because the region of the return value is allocated with the `malloc' call, it should be
|
427
|
+
released with the `free' call when it is no longer in use. It is possible to access every
|
428
|
+
record by iteration of calling this function. However, it is not assured if updating the
|
429
|
+
database is occurred while the iteration. Besides, the order of this traversal access method
|
430
|
+
is arbitrary, so it is not assured that the order of storing matches the one of the traversal
|
431
|
+
access. */
|
432
|
+
char *tchdbiternext2(TCHDB *hdb);
|
433
|
+
|
434
|
+
|
435
|
+
/* Get the next extensible objects of the iterator of a hash database object.
|
436
|
+
`hdb' specifies the hash database object.
|
437
|
+
`kxstr' specifies the object into which the next key is wrote down.
|
438
|
+
`vxstr' specifies the object into which the next value is wrote down.
|
439
|
+
If successful, the return value is true, else, it is false. False is returned when no record
|
440
|
+
is to be get out of the iterator. */
|
441
|
+
bool tchdbiternext3(TCHDB *hdb, TCXSTR *kxstr, TCXSTR *vxstr);
|
442
|
+
|
443
|
+
|
444
|
+
/* Get forward matching keys in a hash database object.
|
445
|
+
`hdb' specifies the hash database object.
|
446
|
+
`pbuf' specifies the pointer to the region of the prefix.
|
447
|
+
`psiz' specifies the size of the region of the prefix.
|
448
|
+
`max' specifies the maximum number of keys to be fetched. If it is negative, no limit is
|
449
|
+
specified.
|
450
|
+
The return value is a list object of the corresponding keys. This function does never fail.
|
451
|
+
It returns an empty list even if no key corresponds.
|
452
|
+
Because the object of the return value is created with the function `tclistnew', it should be
|
453
|
+
deleted with the function `tclistdel' when it is no longer in use. Note that this function
|
454
|
+
may be very slow because every key in the database is scanned. */
|
455
|
+
TCLIST *tchdbfwmkeys(TCHDB *hdb, const void *pbuf, int psiz, int max);
|
456
|
+
|
457
|
+
|
458
|
+
/* Get forward matching string keys in a hash database object.
|
459
|
+
`hdb' specifies the hash database object.
|
460
|
+
`pstr' specifies the string of the prefix.
|
461
|
+
`max' specifies the maximum number of keys to be fetched. If it is negative, no limit is
|
462
|
+
specified.
|
463
|
+
The return value is a list object of the corresponding keys. This function does never fail.
|
464
|
+
It returns an empty list even if no key corresponds.
|
465
|
+
Because the object of the return value is created with the function `tclistnew', it should be
|
466
|
+
deleted with the function `tclistdel' when it is no longer in use. Note that this function
|
467
|
+
may be very slow because every key in the database is scanned. */
|
468
|
+
TCLIST *tchdbfwmkeys2(TCHDB *hdb, const char *pstr, int max);
|
469
|
+
|
470
|
+
|
471
|
+
/* Add an integer to a record in a hash database object.
|
472
|
+
`hdb' specifies the hash database object connected as a writer.
|
473
|
+
`kbuf' specifies the pointer to the region of the key.
|
474
|
+
`ksiz' specifies the size of the region of the key.
|
475
|
+
`num' specifies the additional value.
|
476
|
+
If successful, the return value is the summation value, else, it is `INT_MIN'.
|
477
|
+
If the corresponding record exists, the value is treated as an integer and is added to. If no
|
478
|
+
record corresponds, a new record of the additional value is stored. */
|
479
|
+
int tchdbaddint(TCHDB *hdb, const void *kbuf, int ksiz, int num);
|
480
|
+
|
481
|
+
|
482
|
+
/* Add a real number to a record in a hash database object.
|
483
|
+
`hdb' specifies the hash database object connected as a writer.
|
484
|
+
`kbuf' specifies the pointer to the region of the key.
|
485
|
+
`ksiz' specifies the size of the region of the key.
|
486
|
+
`num' specifies the additional value.
|
487
|
+
If successful, the return value is the summation value, else, it is Not-a-Number.
|
488
|
+
If the corresponding record exists, the value is treated as a real number and is added to. If
|
489
|
+
no record corresponds, a new record of the additional value is stored. */
|
490
|
+
double tchdbadddouble(TCHDB *hdb, const void *kbuf, int ksiz, double num);
|
491
|
+
|
492
|
+
|
493
|
+
/* Synchronize updated contents of a hash database object with the file and the device.
|
494
|
+
`hdb' specifies the hash database object connected as a writer.
|
495
|
+
If successful, the return value is true, else, it is false.
|
496
|
+
This function is useful when another process connects to the same database file. */
|
497
|
+
bool tchdbsync(TCHDB *hdb);
|
498
|
+
|
499
|
+
|
500
|
+
/* Optimize the file of a hash database object.
|
501
|
+
`hdb' specifies the hash database object connected as a writer.
|
502
|
+
`bnum' specifies the number of elements of the bucket array. If it is not more than 0, the
|
503
|
+
default value is specified. The default value is two times of the number of records.
|
504
|
+
`apow' specifies the size of record alignment by power of 2. If it is negative, the current
|
505
|
+
setting is not changed.
|
506
|
+
`fpow' specifies the maximum number of elements of the free block pool by power of 2. If it
|
507
|
+
is negative, the current setting is not changed.
|
508
|
+
`opts' specifies options by bitwise-or: `HDBTLARGE' specifies that the size of the database
|
509
|
+
can be larger than 2GB by using 64-bit bucket array, `HDBTDEFLATE' specifies that each record
|
510
|
+
is compressed with Deflate encoding, `HDBTBZIP' specifies that each record is compressed with
|
511
|
+
BZIP2 encoding, `HDBTTCBS' specifies that each record is compressed with TCBS encoding. If it
|
512
|
+
is `UINT8_MAX', the current setting is not changed.
|
513
|
+
If successful, the return value is true, else, it is false.
|
514
|
+
This function is useful to reduce the size of the database file with data fragmentation by
|
515
|
+
successive updating. */
|
516
|
+
bool tchdboptimize(TCHDB *hdb, int64_t bnum, int8_t apow, int8_t fpow, uint8_t opts);
|
517
|
+
|
518
|
+
|
519
|
+
/* Remove all records of a hash database object.
|
520
|
+
`hdb' specifies the hash database object connected as a writer.
|
521
|
+
If successful, the return value is true, else, it is false. */
|
522
|
+
bool tchdbvanish(TCHDB *hdb);
|
523
|
+
|
524
|
+
|
525
|
+
/* Copy the database file of a hash database object.
|
526
|
+
`hdb' specifies the hash database object.
|
527
|
+
`path' specifies the path of the destination file. If it begins with `@', the trailing
|
528
|
+
substring is executed as a command line.
|
529
|
+
If successful, the return value is true, else, it is false. False is returned if the executed
|
530
|
+
command returns non-zero code.
|
531
|
+
The database file is assured to be kept synchronized and not modified while the copying or
|
532
|
+
executing operation is in progress. So, this function is useful to create a backup file of
|
533
|
+
the database file. */
|
534
|
+
bool tchdbcopy(TCHDB *hdb, const char *path);
|
535
|
+
|
536
|
+
|
537
|
+
/* Begin the transaction of a hash database object.
|
538
|
+
`hdb' specifies the hash database object connected as a writer.
|
539
|
+
If successful, the return value is true, else, it is false.
|
540
|
+
The database is locked by the thread while the transaction so that only one transaction can be
|
541
|
+
activated with a database object at the same time. Thus, the serializable isolation level is
|
542
|
+
assumed if every database operation is performed in the transaction. All updated regions are
|
543
|
+
kept track of by write ahead logging while the transaction. If the database is closed during
|
544
|
+
transaction, the transaction is aborted implicitly. */
|
545
|
+
bool tchdbtranbegin(TCHDB *hdb);
|
546
|
+
|
547
|
+
|
548
|
+
/* Commit the transaction of a hash database object.
|
549
|
+
`hdb' specifies the hash database object connected as a writer.
|
550
|
+
If successful, the return value is true, else, it is false.
|
551
|
+
Update in the transaction is fixed when it is committed successfully. */
|
552
|
+
bool tchdbtrancommit(TCHDB *hdb);
|
553
|
+
|
554
|
+
|
555
|
+
/* Abort the transaction of a hash database object.
|
556
|
+
`hdb' specifies the hash database object connected as a writer.
|
557
|
+
If successful, the return value is true, else, it is false.
|
558
|
+
Update in the transaction is discarded when it is aborted. The state of the database is
|
559
|
+
rollbacked to before transaction. */
|
560
|
+
bool tchdbtranabort(TCHDB *hdb);
|
561
|
+
|
562
|
+
|
563
|
+
/* Get the file path of a hash database object.
|
564
|
+
`hdb' specifies the hash database object.
|
565
|
+
The return value is the path of the database file or `NULL' if the object does not connect to
|
566
|
+
any database file. */
|
567
|
+
const char *tchdbpath(TCHDB *hdb);
|
568
|
+
|
569
|
+
|
570
|
+
/* Get the number of records of a hash database object.
|
571
|
+
`hdb' specifies the hash database object.
|
572
|
+
The return value is the number of records or 0 if the object does not connect to any database
|
573
|
+
file. */
|
574
|
+
uint64_t tchdbrnum(TCHDB *hdb);
|
575
|
+
|
576
|
+
|
577
|
+
/* Get the size of the database file of a hash database object.
|
578
|
+
`hdb' specifies the hash database object.
|
579
|
+
The return value is the size of the database file or 0 if the object does not connect to any
|
580
|
+
database file. */
|
581
|
+
uint64_t tchdbfsiz(TCHDB *hdb);
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
/*************************************************************************************************
|
586
|
+
* features for experts
|
587
|
+
*************************************************************************************************/
|
588
|
+
|
589
|
+
|
590
|
+
/* Set the error code of a hash database object.
|
591
|
+
`hdb' specifies the hash database object.
|
592
|
+
`ecode' specifies the error code.
|
593
|
+
`file' specifies the file name of the code.
|
594
|
+
`line' specifies the line number of the code.
|
595
|
+
`func' specifies the function name of the code. */
|
596
|
+
void tchdbsetecode(TCHDB *hdb, int ecode, const char *filename, int line, const char *func);
|
597
|
+
|
598
|
+
|
599
|
+
/* Set the type of a hash database object.
|
600
|
+
`hdb' specifies the hash database object.
|
601
|
+
`type' specifies the database type. */
|
602
|
+
void tchdbsettype(TCHDB *hdb, uint8_t type);
|
603
|
+
|
604
|
+
|
605
|
+
/* Set the file descriptor for debugging output.
|
606
|
+
`hdb' specifies the hash database object.
|
607
|
+
`fd' specifies the file descriptor for debugging output. */
|
608
|
+
void tchdbsetdbgfd(TCHDB *hdb, int fd);
|
609
|
+
|
610
|
+
|
611
|
+
/* Get the file descriptor for debugging output.
|
612
|
+
`hdb' specifies the hash database object.
|
613
|
+
The return value is the file descriptor for debugging output. */
|
614
|
+
int tchdbdbgfd(TCHDB *hdb);
|
615
|
+
|
616
|
+
|
617
|
+
/* Check whether mutual exclusion control is set to a hash database object.
|
618
|
+
`hdb' specifies the hash database object.
|
619
|
+
If mutual exclusion control is set, it is true, else it is false. */
|
620
|
+
bool tchdbhasmutex(TCHDB *hdb);
|
621
|
+
|
622
|
+
|
623
|
+
/* Synchronize updating contents on memory of a hash database object.
|
624
|
+
`hdb' specifies the hash database object connected as a writer.
|
625
|
+
`phys' specifies whether to synchronize physically.
|
626
|
+
If successful, the return value is true, else, it is false. */
|
627
|
+
bool tchdbmemsync(TCHDB *hdb, bool phys);
|
628
|
+
|
629
|
+
|
630
|
+
/* Get the number of elements of the bucket array of a hash database object.
|
631
|
+
`hdb' specifies the hash database object.
|
632
|
+
The return value is the number of elements of the bucket array or 0 if the object does not
|
633
|
+
connect to any database file. */
|
634
|
+
uint64_t tchdbbnum(TCHDB *hdb);
|
635
|
+
|
636
|
+
|
637
|
+
/* Get the record alignment of a hash database object.
|
638
|
+
`hdb' specifies the hash database object.
|
639
|
+
The return value is the record alignment or 0 if the object does not connect to any database
|
640
|
+
file. */
|
641
|
+
uint32_t tchdbalign(TCHDB *hdb);
|
642
|
+
|
643
|
+
|
644
|
+
/* Get the maximum number of the free block pool of a a hash database object.
|
645
|
+
`hdb' specifies the hash database object.
|
646
|
+
The return value is the maximum number of the free block pool or 0 if the object does not
|
647
|
+
connect to any database file. */
|
648
|
+
uint32_t tchdbfbpmax(TCHDB *hdb);
|
649
|
+
|
650
|
+
|
651
|
+
/* Get the size of the extra mapped memory of a hash database object.
|
652
|
+
`hdb' specifies the hash database object.
|
653
|
+
The return value is the size of the extra mapped memory or 0 if the object does not connect to
|
654
|
+
any database file. */
|
655
|
+
uint64_t tchdbxmsiz(TCHDB *hdb);
|
656
|
+
|
657
|
+
|
658
|
+
/* Get the inode number of the database file of a hash database object.
|
659
|
+
`hdb' specifies the hash database object.
|
660
|
+
The return value is the inode number of the database file or 0 if the object does not connect
|
661
|
+
to any database file. */
|
662
|
+
uint64_t tchdbinode(TCHDB *hdb);
|
663
|
+
|
664
|
+
|
665
|
+
/* Get the modification time of the database file of a hash database object.
|
666
|
+
`hdb' specifies the hash database object.
|
667
|
+
The return value is the inode number of the database file or 0 if the object does not connect
|
668
|
+
to any database file. */
|
669
|
+
time_t tchdbmtime(TCHDB *hdb);
|
670
|
+
|
671
|
+
|
672
|
+
/* Get the connection mode of a hash database object.
|
673
|
+
`hdb' specifies the hash database object.
|
674
|
+
The return value is the connection mode. */
|
675
|
+
int tchdbomode(TCHDB *hdb);
|
676
|
+
|
677
|
+
|
678
|
+
/* Get the database type of a hash database object.
|
679
|
+
`hdb' specifies the hash database object.
|
680
|
+
The return value is the database type. */
|
681
|
+
uint8_t tchdbtype(TCHDB *hdb);
|
682
|
+
|
683
|
+
|
684
|
+
/* Get the additional flags of a hash database object.
|
685
|
+
`hdb' specifies the hash database object.
|
686
|
+
The return value is the additional flags. */
|
687
|
+
uint8_t tchdbflags(TCHDB *hdb);
|
688
|
+
|
689
|
+
|
690
|
+
/* Get the options of a hash database object.
|
691
|
+
`hdb' specifies the hash database object.
|
692
|
+
The return value is the options. */
|
693
|
+
uint8_t tchdbopts(TCHDB *hdb);
|
694
|
+
|
695
|
+
|
696
|
+
/* Get the pointer to the opaque field of a hash database object.
|
697
|
+
`hdb' specifies the hash database object.
|
698
|
+
The return value is the pointer to the opaque field whose size is 128 bytes. */
|
699
|
+
char *tchdbopaque(TCHDB *hdb);
|
700
|
+
|
701
|
+
|
702
|
+
/* Get the number of used elements of the bucket array of a hash database object.
|
703
|
+
`hdb' specifies the hash database object.
|
704
|
+
The return value is the number of used elements of the bucket array or 0 if the object does
|
705
|
+
not connect to any database file. */
|
706
|
+
uint64_t tchdbbnumused(TCHDB *hdb);
|
707
|
+
|
708
|
+
|
709
|
+
/* Set the custom codec functions of a hash database object.
|
710
|
+
`hdb' specifies the hash database object.
|
711
|
+
`enc' specifies the pointer to the custom encoding function. It receives four parameters.
|
712
|
+
The first parameter is the pointer to the region. The second parameter is the size of the
|
713
|
+
region. The third parameter is the pointer to the variable into which the size of the region
|
714
|
+
of the return value is assigned. The fourth parameter is the pointer to the optional opaque
|
715
|
+
object. It returns the pointer to the result object allocated with `malloc' call if
|
716
|
+
successful, else, it returns `NULL'.
|
717
|
+
`encop' specifies an arbitrary pointer to be given as a parameter of the encoding function.
|
718
|
+
If it is not needed, `NULL' can be specified.
|
719
|
+
`dec' specifies the pointer to the custom decoding function.
|
720
|
+
`decop' specifies an arbitrary pointer to be given as a parameter of the decoding function.
|
721
|
+
If it is not needed, `NULL' can be specified.
|
722
|
+
If successful, the return value is true, else, it is false.
|
723
|
+
Note that the custom codec functions should be set before the database is opened and should be
|
724
|
+
set every time the database is being opened. */
|
725
|
+
bool tchdbsetcodecfunc(TCHDB *hdb, TCCODEC enc, void *encop, TCCODEC dec, void *decop);
|
726
|
+
|
727
|
+
|
728
|
+
/* Get the custom codec functions of a hash database object.
|
729
|
+
`hdb' specifies the hash database object.
|
730
|
+
`ep' specifies the pointer to a variable into which the pointer to the custom encoding
|
731
|
+
function is assigned
|
732
|
+
`eop' specifies the pointer to a variable into which the arbitrary pointer to be given to the
|
733
|
+
encoding function is assigned.
|
734
|
+
`dp' specifies the pointer to a variable into which the pointer to the custom decoding
|
735
|
+
function is assigned
|
736
|
+
`dop' specifies the pointer to a variable into which the arbitrary pointer to be given to the
|
737
|
+
decoding function is assigned. */
|
738
|
+
void tchdbcodecfunc(TCHDB *hdb, TCCODEC *ep, void **eop, TCCODEC *dp, void **dop);
|
739
|
+
|
740
|
+
|
741
|
+
/* Get the unit step number of auto defragmentation of a hash database object.
|
742
|
+
`hdb' specifies the hash database object.
|
743
|
+
The return value is the unit step number of auto defragmentation. */
|
744
|
+
uint32_t tchdbdfunit(TCHDB *hdb);
|
745
|
+
|
746
|
+
|
747
|
+
/* Perform dynamic defragmentation of a hash database object.
|
748
|
+
`hdb' specifies the hash database object connected as a writer.
|
749
|
+
`step' specifie the number of steps. If it is not more than 0, the whole file is defragmented
|
750
|
+
gradually without keeping a continuous lock.
|
751
|
+
If successful, the return value is true, else, it is false. */
|
752
|
+
bool tchdbdefrag(TCHDB *hdb, int64_t step);
|
753
|
+
|
754
|
+
|
755
|
+
/* Clear the cache of a hash tree database object.
|
756
|
+
`hdb' specifies the hash tree database object.
|
757
|
+
If successful, the return value is true, else, it is false. */
|
758
|
+
bool tchdbcacheclear(TCHDB *hdb);
|
759
|
+
|
760
|
+
|
761
|
+
/* Store a record into a hash database object with a duplication handler.
|
762
|
+
`hdb' specifies the hash database object connected as a writer.
|
763
|
+
`kbuf' specifies the pointer to the region of the key.
|
764
|
+
`ksiz' specifies the size of the region of the key.
|
765
|
+
`vbuf' specifies the pointer to the region of the value. `NULL' means that record addition is
|
766
|
+
ommited if there is no corresponding record.
|
767
|
+
`vsiz' specifies the size of the region of the value.
|
768
|
+
`proc' specifies the pointer to the callback function to process duplication. It receives
|
769
|
+
four parameters. The first parameter is the pointer to the region of the value. The second
|
770
|
+
parameter is the size of the region of the value. The third parameter is the pointer to the
|
771
|
+
variable into which the size of the region of the return value is assigned. The fourth
|
772
|
+
parameter is the pointer to the optional opaque object. It returns the pointer to the result
|
773
|
+
object allocated with `malloc'. It is released by the caller. If it is `NULL', the record is
|
774
|
+
not modified. If it is `(void *)-1', the record is removed.
|
775
|
+
`op' specifies an arbitrary pointer to be given as a parameter of the callback function. If
|
776
|
+
it is not needed, `NULL' can be specified.
|
777
|
+
If successful, the return value is true, else, it is false.
|
778
|
+
Note that the callback function can not perform any database operation because the function
|
779
|
+
is called in the critical section guarded by the same locks of database operations. */
|
780
|
+
bool tchdbputproc(TCHDB *hdb, const void *kbuf, int ksiz, const void *vbuf, int vsiz,
|
781
|
+
TCPDPROC proc, void *op);
|
782
|
+
|
783
|
+
|
784
|
+
/* Retrieve the next record of a record in a hash database object.
|
785
|
+
`hdb' specifies the hash database object.
|
786
|
+
`kbuf' specifies the pointer to the region of the key. If it is `NULL', the first record is
|
787
|
+
retrieved.
|
788
|
+
`ksiz' specifies the size of the region of the key.
|
789
|
+
`sp' specifies the pointer to the variable into which the size of the region of the return
|
790
|
+
value is assigned.
|
791
|
+
If successful, the return value is the pointer to the region of the key of the next record.
|
792
|
+
`NULL' is returned if no record corresponds.
|
793
|
+
Because an additional zero code is appended at the end of the region of the return value,
|
794
|
+
the return value can be treated as a character string. Because the region of the return
|
795
|
+
value is allocated with the `malloc' call, it should be released with the `free' call when
|
796
|
+
it is no longer in use. */
|
797
|
+
void *tchdbgetnext(TCHDB *hdb, const void *kbuf, int ksiz, int *sp);
|
798
|
+
|
799
|
+
|
800
|
+
/* Retrieve the next string record in a hash database object.
|
801
|
+
`hdb' specifies the hash database object.
|
802
|
+
`kstr' specifies the string of the key. If it is `NULL', the first record is retrieved.
|
803
|
+
If successful, the return value is the string of the key of the next record. `NULL' is
|
804
|
+
returned if no record corresponds.
|
805
|
+
Because the region of the return value is allocated with the `malloc' call, it should be
|
806
|
+
released with the `free' call when it is no longer in use. */
|
807
|
+
char *tchdbgetnext2(TCHDB *hdb, const char *kstr);
|
808
|
+
|
809
|
+
|
810
|
+
/* Retrieve the key and the value of the next record of a record in a hash database object.
|
811
|
+
`hdb' specifies the hash database object.
|
812
|
+
`kbuf' specifies the pointer to the region of the key.
|
813
|
+
`ksiz' specifies the size of the region of the key.
|
814
|
+
`sp' specifies the pointer to the variable into which the size of the region of the return
|
815
|
+
value is assigned.
|
816
|
+
`vbp' specifies the pointer to the variable into which the pointer to the value is assigned.
|
817
|
+
`vsp' specifies the pointer to the variable into which the size of the value is assigned.
|
818
|
+
If successful, the return value is the pointer to the region of the key of the next
|
819
|
+
record.
|
820
|
+
Because the region of the return value is allocated with the `malloc' call, it should be
|
821
|
+
released with the `free' call when it is no longer in use. The retion pointed to by `vbp'
|
822
|
+
should not be released. */
|
823
|
+
char *tchdbgetnext3(TCHDB *hdb, const char *kbuf, int ksiz, int *sp, const char **vbp, int *vsp);
|
824
|
+
|
825
|
+
|
826
|
+
/* Move the iterator to the record corresponding a key of a hash database object.
|
827
|
+
`hdb' specifies the hash database object.
|
828
|
+
`kbuf' specifies the pointer to the region of the key.
|
829
|
+
`ksiz' specifies the size of the region of the key.
|
830
|
+
If successful, the return value is true, else, it is false. False is returned if there is
|
831
|
+
no record corresponding the condition. */
|
832
|
+
bool tchdbiterinit2(TCHDB *hdb, const void *kbuf, int ksiz);
|
833
|
+
|
834
|
+
|
835
|
+
/* Move the iterator to the record corresponding a key string of a hash database object.
|
836
|
+
`hdb' specifies the hash database object.
|
837
|
+
`kstr' specifies the string of the key.
|
838
|
+
If successful, the return value is true, else, it is false. False is returned if there is
|
839
|
+
no record corresponding the condition. */
|
840
|
+
bool tchdbiterinit3(TCHDB *hdb, const char *kstr);
|
841
|
+
|
842
|
+
|
843
|
+
/* Process each record atomically of a hash database object.
|
844
|
+
`hdb' specifies the hash database object.
|
845
|
+
`iter' specifies the pointer to the iterator function called for each record. It receives
|
846
|
+
five parameters. The first parameter is the pointer to the region of the key. The second
|
847
|
+
parameter is the size of the region of the key. The third parameter is the pointer to the
|
848
|
+
region of the value. The fourth parameter is the size of the region of the value. The fifth
|
849
|
+
parameter is the pointer to the optional opaque object. It returns true to continue iteration
|
850
|
+
or false to stop iteration.
|
851
|
+
`op' specifies an arbitrary pointer to be given as a parameter of the iterator function. If
|
852
|
+
it is not needed, `NULL' can be specified.
|
853
|
+
If successful, the return value is true, else, it is false.
|
854
|
+
Note that the callback function can not perform any database operation because the function
|
855
|
+
is called in the critical section guarded by the same locks of database operations. */
|
856
|
+
bool tchdbforeach(TCHDB *hdb, TCITER iter, void *op);
|
857
|
+
|
858
|
+
|
859
|
+
/* Void the transaction of a hash database object.
|
860
|
+
`hdb' specifies the hash database object connected as a writer.
|
861
|
+
If successful, the return value is true, else, it is false.
|
862
|
+
This function should be called only when no update in the transaction. */
|
863
|
+
bool tchdbtranvoid(TCHDB *hdb);
|
864
|
+
|
865
|
+
|
866
|
+
|
867
|
+
__TCHDB_CLINKAGEEND
|
868
|
+
#endif /* duplication check */
|
869
|
+
|
870
|
+
|
871
|
+
/* END OF FILE */
|