Allow specifying checksum type (#756)

master
Roman Zeyde 2 years ago committed by GitHub
parent a6103ef311
commit 6e19f1da84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      src/db_options.rs
  2. 10
      src/lib.rs

@ -657,6 +657,15 @@ impl BlockBasedOptions {
ffi::rocksdb_block_based_options_set_whole_key_filtering(self.inner, c_uchar::from(v));
}
}
/// Use the specified checksum type.
/// Newly created table files will be protected with this checksum type.
/// Old table files will still be readable, even though they have different checksum type.
pub fn set_checksum_type(&mut self, checksum_type: ChecksumType) {
unsafe {
ffi::rocksdb_block_based_options_set_checksum(self.inner, checksum_type as c_char);
}
}
}
impl Default for BlockBasedOptions {
@ -3581,6 +3590,15 @@ pub enum MemtableFactory {
},
}
/// Used by BlockBasedOptions::set_checksum_type.
pub enum ChecksumType {
NoChecksum = 0,
CRC32c = 1,
XXHash = 2,
XXHash64 = 3,
XXH3 = 4, // Supported since RocksDB 6.27
}
/// Used with DBOptions::set_plain_table_factory.
/// See official [wiki](https://github.com/facebook/rocksdb/wiki/PlainTable-Format) for more
/// information.

@ -111,11 +111,11 @@ pub use crate::{
DBWALIterator, Direction, IteratorMode,
},
db_options::{
BlockBasedIndexType, BlockBasedOptions, BottommostLevelCompaction, Cache, CompactOptions,
CuckooTableOptions, DBCompactionStyle, DBCompressionType, DBPath, DBRecoveryMode,
DataBlockIndexType, FifoCompactOptions, FlushOptions, IngestExternalFileOptions, LogLevel,
MemtableFactory, Options, PlainTableFactoryOptions, ReadOptions, UniversalCompactOptions,
UniversalCompactionStopStyle, WriteOptions,
BlockBasedIndexType, BlockBasedOptions, BottommostLevelCompaction, Cache, ChecksumType,
CompactOptions, CuckooTableOptions, DBCompactionStyle, DBCompressionType, DBPath,
DBRecoveryMode, DataBlockIndexType, FifoCompactOptions, FlushOptions,
IngestExternalFileOptions, LogLevel, MemtableFactory, Options, PlainTableFactoryOptions,
ReadOptions, UniversalCompactOptions, UniversalCompactionStopStyle, WriteOptions,
},
db_pinnable_slice::DBPinnableSlice,
env::Env,

Loading…
Cancel
Save