Tokyo Cabinet は key-value 型のデータファイルを扱うためのソフトウエア.こ の Web ページでは,Linux (CentOS バージョン 5) 上で Tokyo Cabinet のビルドとインストールを行う.(かきかけ)
bzip2 のインストール
tar -xvzof bzip2-1.0.5.tar.gz cd bzip2-1.0.5 make
※ スーパーユーザになって実行すること
make install PREFIX=/usr/local
「Latest Source Package」をクリック
tar -xvzof tokyocabinet-1.4.24.tar.gz cd tokyocabinet-1.4.24 ./configure --prefix=/usr/local make
make check
◇ B+木データベースを扱う際には、`TCBDB' 型へのポインタをオブジェクトとして用いる
B+木データベースオブジェクトは、関数 `tcbdbnew' で作成し、関数 `tcbdbdel' で破棄
TCBDB *tcbdbnew(void); The return value is the new B+ tree database object. The function `tcbdbdel' is used in order to delete a B+ tree database object. void tcbdbdel(TCBDB *bdb); `bdb' specifies the B+ tree database object. If the database is not closed, it is closed implicitly. Note that the deleted object and its derivatives can not be used anymore. The function `tcbdbecode' is used in order to get the last happened error code of a B+ tree database object. B+木ーデータベースオブジェクトをデータベースファイルと接続 関数 `tcbdbopen' 接続の解除してファイルを閉じるには関数 `tcbdbclose' bool tcbdbopen(TCBDB *bdb, const char *path, int omode); `bdb' specifies the B+ tree database object which is not opened. `path' specifies the path of the database file. `omode' specifies the connection mode: `BDBOWRITER' as a writer, `BDBOREADER' as a reader. If the mode is `BDBOWRITER', the following may be added by bitwise-or: `BDBOCREAT', which means it creates a new database if not exist, `BDBOTRUNC', which means it creates a new database regardless if one exists, `BDBOTSYNC', which means every transaction synchronizes updated contents with the device. Both of `BDBOREADER' and `BDBOWRITER' can be added to by bitwise-or: `BDBONOLCK', which means it opens the database file without file locking, or `BDBOLCKNB', which means locking is performed without blocking. If successful, the return value is true, else, it is false. The function `tcbdbclose' is used in order to close a B+ tree database object. bool tcbdbclose(TCBDB *bdb); `bdb' specifies the B+ tree database object. If successful, the return value is true, else, it is false. 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 broke.n