]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/CompressionOptions.java
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / CompressionOptions.java
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
5
6 package org.rocksdb;
7
8 /**
9 * Options for Compression
10 */
11 public class CompressionOptions extends RocksObject {
12
13 public CompressionOptions() {
14 super(newCompressionOptions());
15 }
16
17 public CompressionOptions setWindowBits(final int windowBits) {
18 setWindowBits(nativeHandle_, windowBits);
19 return this;
20 }
21
22 public int windowBits() {
23 return windowBits(nativeHandle_);
24 }
25
26 public CompressionOptions setLevel(final int level) {
27 setLevel(nativeHandle_, level);
28 return this;
29 }
30
31 public int level() {
32 return level(nativeHandle_);
33 }
34
35 public CompressionOptions setStrategy(final int strategy) {
36 setStrategy(nativeHandle_, strategy);
37 return this;
38 }
39
40 public int strategy() {
41 return strategy(nativeHandle_);
42 }
43
44 /**
45 * Maximum size of dictionary used to prime the compression library. Currently
46 * this dictionary will be constructed by sampling the first output file in a
47 * subcompaction when the target level is bottommost. This dictionary will be
48 * loaded into the compression library before compressing/uncompressing each
49 * data block of subsequent files in the subcompaction. Effectively, this
50 * improves compression ratios when there are repetitions across data blocks.
51 *
52 * A value of 0 indicates the feature is disabled.
53 *
54 * Default: 0.
55 *
56 * @param maxDictBytes Maximum bytes to use for the dictionary
57 *
58 * @return the reference to the current options
59 */
60 public CompressionOptions setMaxDictBytes(final int maxDictBytes) {
61 setMaxDictBytes(nativeHandle_, maxDictBytes);
62 return this;
63 }
64
65 /**
66 * Maximum size of dictionary used to prime the compression library.
67 *
68 * @return The maximum bytes to use for the dictionary
69 */
70 public int maxDictBytes() {
71 return maxDictBytes(nativeHandle_);
72 }
73
74 private native static long newCompressionOptions();
75 @Override protected final native void disposeInternal(final long handle);
76
77 private native void setWindowBits(final long handle, final int windowBits);
78 private native int windowBits(final long handle);
79 private native void setLevel(final long handle, final int level);
80 private native int level(final long handle);
81 private native void setStrategy(final long handle, final int strategy);
82 private native int strategy(final long handle);
83 private native void setMaxDictBytes(final long handle, final int maxDictBytes);
84 private native int maxDictBytes(final long handle);
85 }