KyotoSourceA key,value store database.
A cursor used to iterate over (key,value) pairs.
Exception raised when something gone wrong with the database.
Open a a database file.
The kind of the database is infered from the path, and tuning parameters can trail the path. These conventions are inherited from kyotocabinet::PolyDB::open() : http://fallabs.com/kyotocabinet/api/classkyotocabinet_1_1PolyDB.html#a09384a72e6a72a0be98c80a1856f34aa
If it is "-", the database will be a prototype hash database. If it is "+", the database will be a prototype tree database. If it is ":", the database will be a stash database. If it is "*", the database will be a cache hash database. If it is "%", the database will be a cache tree database. If its suffix is ".kch", the database will be a file hash database. If its suffix is ".kct", the database will be a file tree database. If its suffix is ".kcd", the database will be a directory hash database. If its suffix is ".kcf", the database will be a directory tree database. If its suffix is ".kcx", the database will be a plain text database.
Tuning parameters can trail the name, separated by "#". Each parameter is composed of the name and the value, separated by "=".
If the "type" parameter is specified, the database type is determined by the value in "-", "+", ":", "*", "%", "kch", "kct", "kcd", "kcf", and "kcx".
The tuning parameter "log" specifies the path of the log file, or "-" for the standard output, or "+" for the standard error.
The parameter "logkinds" specifies kinds of logged messages and the value can be "debug", "info", "warn", or "error".
"logpx" specifies the prefix of each log message.
with_db path flags f opens a database, calls f on this db and ensures the db is finally closed.
exists db key checks if any data is associated to the given key in the database db.
get db key returns the data associated with the given key in the database db, if any.
find db key returns the data associated with the given key, or raise Not_found if none is found.
set db key data inserts the pair (key, data) in the database db.
If the database already contains data associated with the key, that data is discarded and silently replaced by the new data.
add db key data inserts the pair (key, data) in the database db.
If the database already contains data associated with the key, it raises Invalid_Argument("Entry already exists").
replace db key data inserts the pair (key, data) in the database db.
If the database doesn't contain any data associated with the key, it raises Not_found.
remove db key removes the data associated to the key in the database db.
If key has no associated data, simply do nothing.
update db init plus key data updates the value associated to the given key.
If a previous value v is associated to the key, then the value to be inserted is computed after plus v data.
If there is no data associated to the key, then the value to be inserted is init data.
fold db combiner seed folds the whole content of the database db.
fold db prefix combiner seed folds the (key,value) pairs having a key with the given prefix.
This is meaningful only for sorted databases, i.e. tree databases.
fold db (Some min_key) (Some max_key) combiner seed folds the (key,value) pairs having a key in the range min_key (inclusive) .. max_key (exclusive).
This is meaningful only for sorted databases, i.e. tree databases.
Open a cursor and jump to the first key,value pair if any.
Jump to the first key,value pair having a key greater than the given key.
Jump to the first key,value pair having a key greater than the given key.
Read the next key,value pair if any.
Read the next key,value pair if any.
Close the cursor.
with_cursor db f opens a cursor, calls f on this cursor and ensures the cursor is finally closed.
begin a transaction with no file synchronization (safe on process crash, but not system crash).
begin a transaction with file synchronization (safe on process or system crash).