kv
An embedded key/value store for Rust built on LMDB
- Easy configuration
- Integer keys
- Serde integration (see the Encoding trait)
Example
// Create the default configuration
let mut cfg = default;
// Load configuration from a TOML file
let mut cfg = load;
// Add a bucket named `test`
cfg.bucket;
// Create a manager
// Managers are used to ensure that each process only has access to one LMDB environment
// reference at a time
let mut mgr = new;
// Get a Store handle
let handle = mgr.open.unwrap;
// Get acess to the underlying store
let store = handle.write.unwrap;
// Load a bucket
//
// A reference to a bucket will be the first argument to all functions that
// read or write to the database
let bucket = store..unwrap;
/// Write a value to the store
let mut txn = store.write_txn.unwrap;
txn.set.unwrap;
// Don't forget to commit the transaction
txn.commit.unwrap;
/// Read a value
let txn = store.read_txn.unwrap;
let val = txn.get.unwrap;
println!;
// You can also abort a transaction
txn.abort;
See https://docs.rs/kv for more information
Optional
cbor-value
- CBOR value encoding using
serde
- CBOR value encoding using
json-value
- JSON value encoding using
serde
- JSON value encoding using