42 releases

✓ Uses Rust 2018 edition

0.18.1 Feb 4, 2019
0.17.9 Jan 17, 2019
0.16.11 Dec 14, 2018
0.16.6 Nov 24, 2018
0.14.1 Sep 9, 2017

#3 in Database implementations

Download history 28/week @ 2018-10-24 195/week @ 2018-10-31 85/week @ 2018-11-07 88/week @ 2018-11-14 163/week @ 2018-11-21 382/week @ 2018-11-28 121/week @ 2018-12-05 216/week @ 2018-12-12 408/week @ 2018-12-19 28/week @ 2018-12-26 103/week @ 2019-01-02 189/week @ 2019-01-09 112/week @ 2019-01-16 56/week @ 2019-01-23 53/week @ 2019-01-30

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

MIT/Apache

423KB
10K SLoC


lib.rs:

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

Examples

let t = sled::Db::start_default("my_db").unwrap();

t.set(b"yo!", b"v1".to_vec());
assert!(t.get(b"yo!").unwrap().unwrap() == &*b"v1".to_vec());

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

let mut iter = t.scan(b"a non-present key before yo!");
// assert_eq!(iter.next(), Some(Ok((b"yo!".to_vec(), b"v2".to_vec()))));
// assert_eq!(iter.next(), None);

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

Dependencies

~4.5MB
~84K SLoC