Tokyo Cabinet is an embedded key-value store written in C
, with native support for C
and C++
and wrapper APIs for other languages. Keys and values are NULL
-terminated strings or arbitrary sequences of bytes, and generally have variable size. Tokyo Cabinet is not a relational database management system; It is a dedicated key-value store similar to LevelDB, RocksDB etc. An application uses a custom non-SQL API to invoke insert, delete, update operations on data and other management functions. In addition, it supports repeatedly appending to a value, characterized as a "concatenate" operation.
Tokyo Cabinet supports concurrent access. It also implements a thin "table" abstraction which simulates columns over a key-value store and transactions with ACID
properties and write-ahead logging.
The key-value storage layer is built on top of three fundamental data structures: (1) a static hash table with separate chaining (every bucket is a binary search tree), (2) a non-concurrent B+ tree, and, (3) a fixed-size array. Basic data retrieval and management functions — get, put, delete, update, range queries — are supported by all three data structures, albeit with certain special properties.
Tokyo Cabinet was developed in the late 2000s and improves upon older and simpler data storage libraries such as the Unix dbm
("database manager") and the GNU GDBM
by providing a greater variety of backing data structures and additional API functions.
Tokyo Cabinet is succeeded by a similar key-value store called Kyoto Cabinet.
Tokyo Cabinet does not support SQL. Applications need to use a custom non-SQL API to invoke insert, delete, update operations on data and other management functions. In addition, Tokyo Cabinet supports repeatedly appending to a value, characterized as a "concatenate" operation.
Tokyo Cabinet has native support for C
and C++
and wrapper APIs for other languages.
Tokyo Cabinet is not a relational database management system; It is a dedicated key-value store. Applications need to use a custom non-SQL API to invoke insert, delete, update operations on data and other management functions.
Tokyo Cabinet also implements a thin "table" abstraction which simulates columns over a key-value store. Schemas and data types are not supported, and therefore, the a Tokyo Cabinet table can contain tuples with a different kind and number of columns. In the table abstraction, a key and a column index (a non-negative integer) together serve as a pointer to a value, unlike a standard key-value record, where only the key serves as such a pointer.
Tokyo Cabinet implements transactions with ACID
properties. It supports serializable isolation for transactions using a global latch (only one transaction is active at a time). Therefore, Tokyo Cabinet does not support concurrent concurrent transactions.
Further, Tokyo Cabinet supports multiple threads or processes using the database file at a time using latching at different levels. At the highest level, processes or threads open the database file for reading or writing. There can be multiple concurrent readers. However, concurrent readers and writers are not allowed: whenever the database file is opened for writing, other writers and readers are blocked.
Data structures, including the fixed-size array and the hash table, in the storage layer are protected using fine-grained latching. The B+ tree implementation, however, does not support fine-grained latching: each process or thread acquires a global latch over the entire tree for operations on it.
Naïve (Page-Level) Naïve (Record-Level) Prefix Compression
A Tokyo Cabinet database file is not globally compressed. Compression is done at the record (key and value) level or the page level (for a B+ Tree-based store) using the Burrows–Wheeler transform or the Lempel–Ziv compression algorithm.
N-ary Storage Model (Row/Record)
Tokyo Cabinet implements a thin "table" abstraction which simulates columns over a key-value store. In this table abstraction, a key and a column index (a non-negative integer) together serve as a pointer to a value, unlike a standard key-value record, where only the key serves as such a pointer. All parts of a record (key and value, or key and column values) are stored together in a row-oriented manner.
http://fallabs.com/tokyocabinet/
https://fallabs.com/tokyocabinet/
https://fallabs.com/tokyocabinet/spex-en.html
FAL Labs
2006
2012
Sugamo Cabinet
https://en.wikipedia.org/wiki/Tokyo_Cabinet_and_Kyoto_Cabinet