Add compression type to options

main
Ankit Gupta 11 years ago
parent bc708e0012
commit 54d7a2c0c5
  1. 4
      java/RocksDBSample.java
  2. 11
      java/org/rocksdb/Options.java
  3. 21
      java/rocksjni/options.cc

@ -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(

@ -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).

@ -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

Loading…
Cancel
Save