Add compression type to options

This commit is contained in:
Ankit Gupta 2014-07-07 09:58:54 -07:00
parent bc708e0012
commit 54d7a2c0c5
3 changed files with 35 additions and 1 deletions

View File

@ -43,7 +43,8 @@ public class RocksDBSample {
.setDisableSeekCompaction(true)
.setBlockSize(64 * SizeUnit.KB)
.setMaxBackgroundCompactions(10)
.setFilter(filter);
.setFilter(filter)
.setCompressionType(CompressionType.SNAPPY_COMPRESSION);
Statistics stats = options.statisticsPtr();
assert(options.createIfMissing() == true);
@ -52,6 +53,7 @@ public class RocksDBSample {
assert(options.disableSeekCompaction() == true);
assert(options.blockSize() == 64 * SizeUnit.KB);
assert(options.maxBackgroundCompactions() == 10);
assert(options.compressionType() == CompressionType.SNAPPY_COMPRESSION);
assert(options.memTableFactoryName().equals("SkipListFactory"));
options.setMemTableConfig(

View File

@ -1307,6 +1307,17 @@ public class Options extends RocksObject {
}
private native void setBlockRestartInterval(
long handle, int blockRestartInterval);
public CompressionType compressionType() {
return CompressionType.values()[compressionType(nativeHandle_)];
}
private native int compressionType(long handle);
public Options setCompressionType(CompressionType compressionType) {
setCompressionType(nativeHandle_, compressionType.getValue());
return this;
}
private native void setCompressionType(long handle, int compressionType);
/**
* If true, place whole keys in the filter (not just prefixes).

View File

@ -935,6 +935,27 @@ void Java_org_rocksdb_Options_setBlockRestartInterval(
static_cast<int>(jblock_restart_interval);
}
/*
* Class: org_rocksdb_Options
* Method: setCompressionType
* Signature: (JI)V
*/
void Java_org_rocksdb_Options_setCompressionType(
JNIEnv* env, jobject jobj, jlong jhandle, jint compression) {
reinterpret_cast<rocksdb::Options*>(jhandle)->compression =
static_cast<rocksdb::CompressionType>(compression);
}
/*
* Class: org_rocksdb_Options
* Method: compressionType
* Signature: (J)I
*/
jint Java_org_rocksdb_Options_compressionType(
JNIEnv* env, jobject jobj, jlong jhandle) {
return reinterpret_cast<rocksdb::Options*>(jhandle)->compression;
}
/*
* Class: org_rocksdb_Options
* Method: wholeKeyFiltering