Updates RocksDB and makes it do some compression

pull/10/head
Tpt 6 years ago
parent 7a16be53d5
commit 33c5534c84
  1. 2
      lib/Cargo.toml
  2. 5
      lib/src/store/rocksdb.rs

@ -17,7 +17,7 @@ travis-ci = { repository = "Tpt/rudf" }
[dependencies]
lazy_static = "1"
rocksdb = { version = "0.10", optional = true }
rocksdb = { version = "0.11", optional = true }
url = "1"
uuid = { version = "0.7", features = ["v4"] }
bzip2 = "0.3"

@ -7,6 +7,8 @@ use byteorder::ByteOrder;
use byteorder::LittleEndian;
use failure::format_err;
use rocksdb::ColumnFamily;
use rocksdb::DBCompactionStyle;
use rocksdb::DBCompressionType;
use rocksdb::DBRawIterator;
use rocksdb::Options;
use rocksdb::WriteBatch;
@ -63,6 +65,8 @@ impl RocksDbStore {
let mut options = Options::default();
options.create_if_missing(true);
options.create_missing_column_families(true);
options.set_compaction_style(DBCompactionStyle::Universal);
options.set_compression_type(DBCompressionType::Lz4hc);
let db = DB::open_cf(&options, path, &COLUMN_FAMILIES)?;
let id2str_cf = SendColumnFamily(get_cf(&db, STR2ID_CF)?);
@ -552,7 +556,6 @@ fn to_bytes(int: u64) -> [u8; 8] {
// TODO: very bad but I believe it is fine
#[derive(Clone, Copy)]
struct SendColumnFamily(ColumnFamily);
unsafe impl Send for SendColumnFamily {}
unsafe impl Sync for SendColumnFamily {}
impl Deref for SendColumnFamily {

Loading…
Cancel
Save