Fast and reliable key-value store, under the Mozilla Public License (link as you like, share modifications).
Features
-
ACID semantics, using a separable transactions module, reusable for other structure.
-
B-trees with copy-on-write.
-
Support for referential transparency (interface still missing).
-
No read locks. The only three cases of locks are (1) on the first transaction of a thread, (2) when starting concurrent writers, or (3) when starting a writer in parallel with a reader started before the last commit on the file.
This version is only capable of inserting and retrieving keys in the database, allowing several bindings for the same key (get will retrieve the first one).
Implementation details, in particular the file format, are documented in the file.
Todo-list
-
check that all dereferences are converted to/from little-endian. (easy)
-
improve error handling
-
dynamic loading of pages not in the map, especially on 32-bits platforms ('transaction.rs', half-easy)
For future versions
-
implement advertised lock model (right now, committing a writer excludes readers, there's no other lock).
-
merging pages to rebalance more (delete).
-
combined "CoW + delete".
Example
extern crate rand;
extern crate tempdir;
extern crate sanakirja;
use Transaction;