[][src]Crate sstb

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

This was created as a learning excercise, to learn Rust, get some fair share of low-level programming, optimization, to learn how sstables work and how to make them faster.

By no means this is is complete or has any real-world usage.

However inside are some working implementations that pass the tests, are thread-safe, and even run smooth in benchmarks.

The API is not stabilized, the disk format is not stabilized, there are no compatibility guarantees or any other guarantees about this library.

Use at your own risk.

How to use

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.

For more efficient 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();

let mut reader =
  SSTableReader::new_with_options(filename, &ReadOptions::default())
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);


pub use sstable::*;



Implementations of sstables stored as files on disk.


Various utilities.