Crate sanakirja [−] [src]
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 locks, writers exclude each other, and only exclude readers during calls to
commit()
(readers still read the database as it was before the start of the writers/mutable transaction).
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
iterate (easy)
check that all dereferences are converted to/from little-endian. (easy)
delete (half-easy)
glues (not easy)
several databases (hard)
reference counting (half-easy)
dynamic loading of pages not in the map (in file 'transaction.rs', half-easy)
error handling (easy)
Example
use sanakirja::Env; let env=Env::new("/tmp/test").unwrap(); let mut txn=env.mut_txn_begin(); txn.put(b"test key", b"test value"); txn.commit().unwrap(); let txn=env.txn_begin(); assert!(txn.get(b"test key",None) == Some(b"test value"))
Structs
Env |
Environment, containing in particular a pointer to the memory-mapped file. |
MutTxn |
Mutable transaction |
Statistics | |
Txn |
Immutable transaction |
Type Definitions
Error |