main
Ankit Gupta 11 years ago
parent da12f9ec4e
commit 47f0cf6d38
  1. 25
      java/org/rocksdb/CompressionType.java
  2. 35
      java/org/rocksdb/Options.java

@ -0,0 +1,25 @@
// Copyright (c) 2014, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
package org.rocksdb;
public enum CompressionType {
NO_COMPRESSION(0),
SNAPPY_COMPRESSION(1),
ZLIB_COMPRESSION(2),
BZLIB2_COMPRESSION(3),
LZ4_COMPRESSION(4),
LZ4HC_COMPRESSION(5);
private final int value_;
private CompressionType(int value) {
value_ = value;
}
public int getValue() {
return value_;
}
}

@ -1308,11 +1308,46 @@ public class Options extends RocksObject {
private native void setBlockRestartInterval(
long handle, int blockRestartInterval);
/**
* Compress blocks using the specified compression algorithm. This
parameter can be changed dynamically.
*
* Typical speeds of kSnappyCompression on an Intel(R) Core(TM)2 2.4GHz:
* ~200-500MB/s compression and ~400-800MB/s decompression.
*
* Note that these speeds are significantly faster than most
* persistent storage speeds, and therefore it is typically never
* worth switching to kNoCompression. Even if the input data is
* incompressible, the kSnappyCompression implementation will
* efficiently detect that and will switch to uncompressed mode.
*
* Default: kSnappyCompression, which gives lightweight but fast compression.
*
* @return Compression type.
*/
public CompressionType compressionType() {
return CompressionType.values()[compressionType(nativeHandle_)];
}
private native int compressionType(long handle);
/**
* Compress blocks using the specified compression algorithm. This
parameter can be changed dynamically.
*
* Typical speeds of kSnappyCompression on an Intel(R) Core(TM)2 2.4GHz:
* ~200-500MB/s compression and ~400-800MB/s decompression.
*
* Note that these speeds are significantly faster than most
* persistent storage speeds, and therefore it is typically never
* worth switching to kNoCompression. Even if the input data is
* incompressible, the kSnappyCompression implementation will
* efficiently detect that and will switch to uncompressed mode.
*
* Default: kSnappyCompression, which gives lightweight but fast compression.
*
* @param compressionType Compression Type.
* @return the reference to the current option.
*/
public Options setCompressionType(CompressionType compressionType) {
setCompressionType(nativeHandle_, compressionType.getValue());
return this;

Loading…
Cancel
Save