sstb

Crates.iosstb
lib.rssstb
version0.3.0-alpha
sourcesrc
created_at2020-02-04 14:06:17.540689
updated_at2020-02-19 16:00:56.901133
descriptionA thread-safe sstables library
homepagehttps://docs.rs/sstb
repositoryhttps://github.com/ikatson/rust-sstb
max_upload_size
id204871
size93,268
Igor Katson (ikatson)

documentation

https://docs.rs/sstb

README

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);
Commit count: 132

cargo fmt