53 releases (11 breaking)

✓ Uses Rust 2018 edition

new 0.23.0 Apr 20, 2019
0.21.4 Apr 8, 2019
0.20.1 Mar 31, 2019
0.16.11 Dec 14, 2018
0.14.1 Sep 9, 2017

#11 in Database implementations

Download history 138/week @ 2019-01-05 197/week @ 2019-01-12 76/week @ 2019-01-19 38/week @ 2019-01-26 64/week @ 2019-02-02 53/week @ 2019-02-09 47/week @ 2019-02-16 104/week @ 2019-02-23 192/week @ 2019-03-02 112/week @ 2019-03-09 107/week @ 2019-03-16 561/week @ 2019-03-23 316/week @ 2019-03-30 344/week @ 2019-04-06 221/week @ 2019-04-13

741 downloads per month
Used in 8 crates (7 directly)

MIT/Apache

432KB
10K SLoC


lib.rs:

sled is a flash-sympathetic persistent lock-free B+ tree.

Examples

use sled::{Db, IVec};

let t = Db::start_default("my_db").unwrap();
t.set(b"yo!", b"v1".to_vec());
assert_eq!(t.get(b"yo!"), Ok(Some(IVec::from(b"v1"))));

// Atomic compare-and-swap.
t.cas(
    b"yo!",       // key
    Some(b"v1"),  // old value, None for not present
    Some(b"v2"),  // new value, None for delete
).unwrap();

// Iterates over key-value pairs, starting at the given key.
let mut iter = t.scan(b"a non-present key before yo!");
assert_eq!(iter.next().unwrap(), Ok((b"yo!".to_vec(), IVec::from(b"v2"))));
assert_eq!(iter.next(), None);

t.del(b"yo!");
assert_eq!(t.get(b"yo!"), Ok(None));

Dependencies

~4.5MB
~85K SLoC