[−][src]Crate sled
sled
is a flash-sympathetic persistent lock-free B+ tree.
Examples
use sled::{Db, IVec}; let t = Db::open("my_db").unwrap(); t.insert(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 scan_key: &[u8] = b"a non-present key before yo!"; let mut iter = t.range(scan_key..); assert_eq!(iter.next().unwrap(), Ok((IVec::from(b"yo!"), IVec::from(b"v2")))); assert_eq!(iter.next(), None); t.remove(b"yo!"); assert_eq!(t.get(b"yo!"), Ok(None));
Structs
Batch | A batch of updates that will be applied atomically to the Tree. |
Config | A finalized |
ConfigBuilder | Top-level configuration for the system. |
Db | The |
IVec | A buffer that may either be inline or remote and protected by an Arc |
Iter | An iterator over keys and values in a |
Subscriber | A subscriber listening on a specified prefix |
Tree | A flash-sympathetic persistent lock-free B+ tree |
Enums
Error | An Error type encapsulating various issues that may come up in both the expected and unexpected operation of a PageCache. |
Event | An event that happened to a key that a subscriber is interested in. |
Type Definitions
MergeOperator | Allows arbitrary logic to be injected into mere operations of the |
Result | The top-level result type for dealing with the PageCache. |