5 unstable releases

✓ Uses Rust 2018 edition

new 0.14.0 Jul 9, 2020
0.13.2 Jul 1, 2020
0.13.1 Jun 29, 2020
0.13.0 May 13, 2020
0.12.3 Mar 4, 2020

#79 in Database interfaces

Download history 293/week @ 2020-03-23 299/week @ 2020-03-30 158/week @ 2020-04-06 439/week @ 2020-04-13 739/week @ 2020-04-20 604/week @ 2020-04-27 210/week @ 2020-05-04 523/week @ 2020-05-11 336/week @ 2020-05-18 182/week @ 2020-05-25 349/week @ 2020-06-01 440/week @ 2020-06-08 703/week @ 2020-06-15 426/week @ 2020-06-22 379/week @ 2020-06-29 426/week @ 2020-07-06

1,884 downloads per month

Apache-2.0

20MB
425K SLoC

C++ 243K SLoC // 0.1% comments C 95K SLoC // 0.2% comments Java 31K SLoC // 0.4% comments Visual Studio Project 23K SLoC Rust 9K SLoC // 0.2% comments Python 9K SLoC // 0.1% comments Shell 5K SLoC // 0.2% comments GNU Style Assembly 2K SLoC // 0.3% comments Ada 1.5K SLoC // 0.2% comments Assembly 1.5K SLoC // 0.2% comments Visual Studio Solution 1K SLoC Pascal 1K SLoC // 0.2% comments C# 878 SLoC // 0.4% comments INI 432 SLoC // 0.1% comments PowerShell 306 SLoC // 0.2% comments JavaScript 94 SLoC // 0.1% comments Batch 86 SLoC Automake 33 SLoC

lib.rs:

Rust wrapper for RocksDB.

Examples

use ckb_rocksdb::prelude::*;
# use ckb_rocksdb::TemporaryDBPath;
// NB: db is automatically closed at end of lifetime

let path = "_path_for_rocksdb_storage";
# let path = TemporaryDBPath::new();
# {

let db = DB::open_default(&path).unwrap();
db.put(b"my key", b"my value").unwrap();
match db.get(b"my key") {
    Ok(Some(value)) => println!("retrieved value {}", value.to_utf8().unwrap()),
    Ok(None) => println!("value not found"),
    Err(e) => println!("operational problem encountered: {}", e),
}
db.delete(b"my key").unwrap();
# }

Opening a database and a single column family with custom options:

use ckb_rocksdb::{prelude::*, ColumnFamilyDescriptor};
# use ckb_rocksdb::TemporaryDBPath;

let path = "_path_for_rocksdb_storage_with_cfs";
# let path = TemporaryDBPath::new();

let mut cf_opts = Options::default();
cf_opts.set_max_write_buffer_number(16);
let cf = ColumnFamilyDescriptor::new("cf1", cf_opts);

let mut db_opts = Options::default();
db_opts.create_missing_column_families(true);
db_opts.create_if_missing(true);
# {
let db = DB::open_cf_descriptors(&db_opts, &path, vec![cf]).unwrap();
# }

Dependencies