Crates.io | sstb |
lib.rs | sstb |
version | 0.3.0-alpha |
source | src |
created_at | 2020-02-04 14:06:17.540689 |
updated_at | 2020-02-19 16:00:56.901133 |
description | A thread-safe sstables library |
homepage | https://docs.rs/sstb |
repository | https://github.com/ikatson/rust-sstb |
max_upload_size | |
id | 204871 |
size | 93,268 |
An experimental an educational attempt to write a Rust thread-safe sstables library.
See the documentation for more details and background.
For writing SSTables, refer to writer documentation
For reading SSTables, refer to reader documentation
This example will write then read the sstable with all default options with a single-threaded.
For more efficient, concurrent reading code, refer to reader documentation.
use sstb::*;
use std::collections::BTreeMap;
let filename = "/tmp/example-sstable";
let mut map = BTreeMap::new();
map.insert(b"foo", b"some foo");
map.insert(b"bar", b"some bar");
write_btree_map(&map, filename, None).unwrap();
// This example does not use multiple threads, so it's ok to use
// SSTableReader instead of ConcurrentSSTableReader.
let mut reader =
SSTableReader::new_with_options(filename, &ReadOptions::default())
.unwrap();
assert_eq!(reader.get(b"foo").unwrap(), Some(b"some foo" as &[u8]));
assert_eq!(reader.get(b"bar").unwrap(), Some(b"some bar" as &[u8]));
assert_eq!(reader.get(b"foobar").unwrap(), None);