55 releases (12 breaking)

✓ Uses Rust 2018 edition

0.24.1 May 12, 2019
0.23.0 Apr 20, 2019
0.20.1 Mar 31, 2019
0.16.11 Dec 14, 2018
0.14.1 Sep 9, 2017

#12 in Database implementations

Download history 51/week @ 2019-01-27 56/week @ 2019-02-03 51/week @ 2019-02-10 50/week @ 2019-02-17 105/week @ 2019-02-24 195/week @ 2019-03-03 109/week @ 2019-03-10 105/week @ 2019-03-17 565/week @ 2019-03-24 322/week @ 2019-03-31 340/week @ 2019-04-07 230/week @ 2019-04-14 258/week @ 2019-04-21 265/week @ 2019-04-28 352/week @ 2019-05-05

1,716 downloads per month
Used in 14 crates (12 directly)

MIT/Apache

443KB
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

~5MB
~88K SLoC