Derive `serde::{Serialize, Deserialize}` for configuration enums (#556)

master
Thibault Martinez 3 years ago committed by GitHub
parent 97ceb8466f
commit 0548acfd4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Cargo.toml
  2. 7
      src/db_options.rs

@ -27,10 +27,12 @@ zlib = ["librocksdb-sys/zlib"]
bzip2 = ["librocksdb-sys/bzip2"]
rtti = ["librocksdb-sys/rtti"]
multi-threaded-cf = []
serde1 = ["serde"]
[dependencies]
libc = "0.2"
librocksdb-sys = { path = "librocksdb-sys", version = "6.20.3" }
serde = { version = "1", features = [ "derive" ], optional = true }
[dev-dependencies]
trybuild = "1.0"

@ -3085,6 +3085,7 @@ impl Default for WriteOptions {
}
#[derive(Debug, Copy, Clone, PartialEq)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
#[repr(i32)]
pub enum ReadTier {
/// Reads data in memtable, block cache, OS cache or storage.
@ -3409,6 +3410,7 @@ pub struct PlainTableFactoryOptions {
}
#[derive(Debug, Copy, Clone, PartialEq)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
pub enum DBCompressionType {
None = ffi::rocksdb_no_compression as isize,
Snappy = ffi::rocksdb_snappy_compression as isize,
@ -3420,6 +3422,7 @@ pub enum DBCompressionType {
}
#[derive(Debug, Copy, Clone, PartialEq)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
pub enum DBCompactionStyle {
Level = ffi::rocksdb_level_compaction as isize,
Universal = ffi::rocksdb_universal_compaction as isize,
@ -3427,6 +3430,7 @@ pub enum DBCompactionStyle {
}
#[derive(Debug, Copy, Clone, PartialEq)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
pub enum DBRecoveryMode {
TolerateCorruptedTailRecords = ffi::rocksdb_tolerate_corrupted_tail_records_recovery as isize,
AbsoluteConsistency = ffi::rocksdb_absolute_consistency_recovery as isize,
@ -3436,6 +3440,7 @@ pub enum DBRecoveryMode {
/// File access pattern once a compaction has started
#[derive(Debug, Copy, Clone, PartialEq)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
#[repr(i32)]
pub enum AccessHint {
None = 0,
@ -3481,6 +3486,7 @@ impl FifoCompactOptions {
}
#[derive(Debug, Copy, Clone, PartialEq)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
pub enum UniversalCompactionStopStyle {
Similar = ffi::rocksdb_similar_size_compaction_stop_style as isize,
Total = ffi::rocksdb_total_size_compaction_stop_style as isize,
@ -3594,6 +3600,7 @@ impl UniversalCompactOptions {
}
#[derive(Debug, Copy, Clone, PartialEq)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
#[repr(u8)]
pub enum BottommostLevelCompaction {
/// Skip bottommost level compaction

Loading…
Cancel
Save