#ffi #RocksDB #facebook #database

rocks

RocksDB bindings for Rust

12 releases

0.1.4 Feb 14, 2020
0.1.3 Oct 26, 2017
0.1.2 Aug 24, 2017
0.0.8 Jun 27, 2017
0.0.4 May 31, 2017

#57 in Database interfaces

Download history 1/week @ 2019-11-10 11/week @ 2019-11-17 11/week @ 2019-11-24 33/week @ 2019-12-01 50/week @ 2019-12-08 4/week @ 2019-12-15 11/week @ 2019-12-22 28/week @ 2020-01-12 44/week @ 2020-01-19 2/week @ 2020-01-26 5/week @ 2020-02-02 45/week @ 2020-02-09 31/week @ 2020-02-16

74 downloads per month

Apache-2.0

15MB
329K SLoC

C++ 228K SLoC // 0.1% comments C 60K SLoC // 0.2% comments Rust 14K SLoC // 0.2% comments Shell 11K SLoC // 0.2% comments Python 7.5K SLoC // 0.1% comments Visual Studio Project 5K SLoC Assembly 618 SLoC INI 432 SLoC // 0.1% comments PowerShell 305 SLoC // 0.2% comments Visual Studio Solution 291 SLoC XSL 279 SLoC // 0.1% comments JavaScript 94 SLoC // 0.1% comments Batch 73 SLoC Perl 38 SLoC // 0.4% comments Automake 17 SLoC

RustRocks

Build Status crates.io badge

Another RocksDB binding for Rust. Documentation

Make RocksDB really rocks!

How to compile

Link against: RocksDB 6.6.4.

tests pass under:

  • macOS 10.12
  • Linux amd64
  • Linux aarch64(Odroid-C2)

For macOS(with rocksdb installed via brew):

LIBRARY_PATH=/usr/local/lib CXXFLAGS=-I/usr/local/include \
cargo test -- --nocapture

For Linux(with rocksdb installed into /usr/local):

LD_LIBRARY_PATH=/usr/local/lib \
LIBRARY_PATH=/usr/local/lib CXXFLAGS=-I/usr/local/include \
cargo test -- --nocapture

For static build:

git submodule update --init --recursive
cargo test --features "static-link rocks-sys/snappy rocks-sys/zlib rocks-sys/bzip2 rocks-sys/lz4 rocks-sys/zstd"

List all supported compression types:

cargo test -- --nocapture compression_types

Installation

[dependencies]
rocks = "0.1"

With all static features

[dependencies.rocks]
version = "0.1"
default-features = false
features = ["static-link", "rocks-sys/snappy", "rocks-sys/zlib", "rocks-sys/bzip2", "rocks-sys/lz4", "rocks-sys/zstd"]

FAQ

Feel free to Open a New Issue.

TODOs

Big picture:

  • git submodule, static-link, compression as feature gate
  • information hiding (DO NOT EXPORT raw pointers)
  • Rust style
    • wraps Status into a Rust style Result<T>
    • *Options via builder pattern
    • handle CFHandle lifetime, Ref safety
  • Lifetime safely guarantee
    • ReadOptions + snapshot
    • ReadOptions + iterate_upper_bound
    • DB + ColumnFamilyHandle
    • ColumnFamilyOptions + compaction_filter
    • ColumnFamilyOptions + customized comparator
  • Proof of usablility
  • bench across C++/Java/other-rust binding
  • CI
    • travis-ci integration
    • appveyor integration for windows
  • Zero-Copy between C++ part
    • pinnable slice support
    • exports String/Vec<u8> to C++ via assign-style API
  • Full documentation with code examples
    • good enough by copying C++ comments
    • rename C++ function names to rust name in doc comments
    • more examples in doc comment

Dependencies