]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/CompactionOptionsFIFO.java
import 14.2.4 nautilus point release
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / CompactionOptionsFIFO.java
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
5
6 package org.rocksdb;
7
8 /**
9 * Options for FIFO Compaction
10 */
11 public class CompactionOptionsFIFO extends RocksObject {
12
13 public CompactionOptionsFIFO() {
14 super(newCompactionOptionsFIFO());
15 }
16
17 /**
18 * Once the total sum of table files reaches this, we will delete the oldest
19 * table file
20 *
21 * Default: 1GB
22 *
23 * @param maxTableFilesSize The maximum size of the table files
24 *
25 * @return the reference to the current options.
26 */
27 public CompactionOptionsFIFO setMaxTableFilesSize(
28 final long maxTableFilesSize) {
29 setMaxTableFilesSize(nativeHandle_, maxTableFilesSize);
30 return this;
31 }
32
33 /**
34 * Once the total sum of table files reaches this, we will delete the oldest
35 * table file
36 *
37 * Default: 1GB
38 *
39 * @return max table file size in bytes
40 */
41 public long maxTableFilesSize() {
42 return maxTableFilesSize(nativeHandle_);
43 }
44
45 /**
46 * If true, try to do compaction to compact smaller files into larger ones.
47 * Minimum files to compact follows options.level0_file_num_compaction_trigger
48 * and compaction won't trigger if average compact bytes per del file is
49 * larger than options.write_buffer_size. This is to protect large files
50 * from being compacted again.
51 *
52 * Default: false
53 *
54 * @param allowCompaction true to allow intra-L0 compaction
55 *
56 * @return the reference to the current options.
57 */
58 public CompactionOptionsFIFO setAllowCompaction(
59 final boolean allowCompaction) {
60 setAllowCompaction(nativeHandle_, allowCompaction);
61 return this;
62 }
63
64
65 /**
66 * Check if intra-L0 compaction is enabled.
67 * When enabled, we try to compact smaller files into larger ones.
68 *
69 * See {@link #setAllowCompaction(boolean)}.
70 *
71 * Default: false
72 *
73 * @return true if intra-L0 compaction is enabled, false otherwise.
74 */
75 public boolean allowCompaction() {
76 return allowCompaction(nativeHandle_);
77 }
78
79
80 private native static long newCompactionOptionsFIFO();
81 @Override protected final native void disposeInternal(final long handle);
82
83 private native void setMaxTableFilesSize(final long handle,
84 final long maxTableFilesSize);
85 private native long maxTableFilesSize(final long handle);
86 private native void setAllowCompaction(final long handle,
87 final boolean allowCompaction);
88 private native boolean allowCompaction(final long handle);
89 }