5 unstable releases

0.3.0-alpha Feb 19, 2020
0.2.2-alpha Feb 18, 2020
0.2.1-alpha Feb 18, 2020
0.2.0-alpha Feb 12, 2020
0.1.0-alpha Feb 4, 2020

#1115 in Concurrency

MIT license

75KB
1.5K SLoC

SSTB

License Cargo Documentation

An experimental an educational attempt to write a Rust thread-safe sstables library.

See the documentation for more details and background.

How to use

For writing SSTables, refer to writer documentation

For reading SSTables, refer to reader documentation

Quickstart

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);

Dependencies

~5.5MB
~108K SLoC