From 8cb22e5f1bd5924d0e9464e90b6909661ce551eb Mon Sep 17 00:00:00 2001 From: Alexander Regueiro Date: Mon, 21 Nov 2016 16:55:54 +0000 Subject: [PATCH] Related enum type definitions to FFI. --- librocksdb-sys/src/lib.rs | 5 +++++ src/rocksdb.rs | 26 +++++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/librocksdb-sys/src/lib.rs b/librocksdb-sys/src/lib.rs index c5d7e77..fb1ce6c 100644 --- a/librocksdb-sys/src/lib.rs +++ b/librocksdb-sys/src/lib.rs @@ -958,6 +958,11 @@ pub const rocksdb_fifo_compaction: c_int = 2; pub const rocksdb_similar_size_compaction_stop_style: c_int = 0; pub const rocksdb_total_size_compaction_stop_style: c_int = 1; +pub const rocksdb_recovery_mode_tolerate_corrupted_tail_records: c_int = 0; +pub const rocksdb_recovery_mode_absolute_consistency: c_int = 1; +pub const rocksdb_recovery_mode_point_in_time: c_int = 2; +pub const rocksdb_recovery_mode_skip_any_corrupted_record: c_int = 3; + pub enum rocksdb_t { } pub enum rocksdb_backup_engine_t { } diff --git a/src/rocksdb.rs b/src/rocksdb.rs index 2a970a0..320716d 100644 --- a/src/rocksdb.rs +++ b/src/rocksdb.rs @@ -49,27 +49,27 @@ unsafe impl Sync for DB {} #[derive(Debug, Copy, Clone, PartialEq)] pub enum DBCompressionType { - None = 0, - Snappy = 1, - Zlib = 2, - Bz2 = 3, - Lz4 = 4, - Lz4hc = 5, + None = ffi::rocksdb_no_compression as isize, + Snappy = ffi::rocksdb_snappy_compression as isize, + Zlib = ffi::rocksdb_zlib_compression as isize, + Bz2 = ffi::rocksdb_bz2_compression as isize, + Lz4 = ffi::rocksdb_lz4_compression as isize, + Lz4hc = ffi::rocksdb_lz4hc_compression as isize, } #[derive(Debug, Copy, Clone, PartialEq)] pub enum DBCompactionStyle { - Level = 0, - Universal = 1, - Fifo = 2, + Level = ffi::rocksdb_level_compaction as isize, + Universal = ffi::rocksdb_universal_compaction as isize, + Fifo = ffi::rocksdb_fifo_compaction as isize, } #[derive(Debug, Copy, Clone, PartialEq)] pub enum DBRecoveryMode { - TolerateCorruptedTailRecords = 0, - AbsoluteConsistency = 1, - PointInTime = 2, - SkipAnyCorruptedRecords = 3, + TolerateCorruptedTailRecords = ffi::rocksdb_recovery_mode_tolerate_corrupted_tail_records as isize, + AbsoluteConsistency = ffi::rocksdb_recovery_mode_absolute_consistency as isize, + PointInTime = ffi::rocksdb_recovery_mode_point_in_time as isize, + SkipAnyCorruptedRecord = ffi::rocksdb_recovery_mode_skip_any_corrupted_record as isize, } /// An atomic batch of write operations.