]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/IngestExternalFileOptions.java
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / IngestExternalFileOptions.java
1 package org.rocksdb;
2 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
3 // This source code is licensed under both the GPLv2 (found in the
4 // COPYING file in the root directory) and Apache 2.0 License
5 // (found in the LICENSE.Apache file in the root directory).
6
7 import java.util.List;
8
9 /**
10 * IngestExternalFileOptions is used by {@link RocksDB#ingestExternalFile(ColumnFamilyHandle, List, IngestExternalFileOptions)}
11 */
12 public class IngestExternalFileOptions extends RocksObject {
13
14 public IngestExternalFileOptions() {
15 super(newIngestExternalFileOptions());
16 }
17
18 /**
19 * @param moveFiles {@link #setMoveFiles(boolean)}
20 * @param snapshotConsistency {@link #setSnapshotConsistency(boolean)}
21 * @param allowGlobalSeqNo {@link #setAllowGlobalSeqNo(boolean)}
22 * @param allowBlockingFlush {@link #setAllowBlockingFlush(boolean)}
23 */
24 public IngestExternalFileOptions(final boolean moveFiles,
25 final boolean snapshotConsistency, final boolean allowGlobalSeqNo,
26 final boolean allowBlockingFlush) {
27 super(newIngestExternalFileOptions(moveFiles, snapshotConsistency,
28 allowGlobalSeqNo, allowBlockingFlush));
29 }
30
31 /**
32 * Can be set to true to move the files instead of copying them.
33 *
34 * @return true if files will be moved
35 */
36 public boolean moveFiles() {
37 return moveFiles(nativeHandle_);
38 }
39
40 /**
41 * Can be set to true to move the files instead of copying them.
42 *
43 * @param moveFiles true if files should be moved instead of copied
44 */
45 public void setMoveFiles(final boolean moveFiles) {
46 setMoveFiles(nativeHandle_, moveFiles);
47 }
48
49 /**
50 * If set to false, an ingested file keys could appear in existing snapshots
51 * that where created before the file was ingested.
52 *
53 * @return true if snapshot consistency is assured
54 */
55 public boolean snapshotConsistency() {
56 return snapshotConsistency(nativeHandle_);
57 }
58
59 /**
60 * If set to false, an ingested file keys could appear in existing snapshots
61 * that where created before the file was ingested.
62 *
63 * @param snapshotConsistency true if snapshot consistency is required
64 */
65 public void setSnapshotConsistency(final boolean snapshotConsistency) {
66 setSnapshotConsistency(nativeHandle_, snapshotConsistency);
67 }
68
69 /**
70 * If set to false, {@link RocksDB#ingestExternalFile(ColumnFamilyHandle, List, IngestExternalFileOptions)}
71 * will fail if the file key range overlaps with existing keys or tombstones in the DB.
72 *
73 * @return true if global seq numbers are assured
74 */
75 public boolean allowGlobalSeqNo() {
76 return allowGlobalSeqNo(nativeHandle_);
77 }
78
79 /**
80 * If set to false, {@link RocksDB#ingestExternalFile(ColumnFamilyHandle, List, IngestExternalFileOptions)}
81 * will fail if the file key range overlaps with existing keys or tombstones in the DB.
82 *
83 * @param allowGlobalSeqNo true if global seq numbers are required
84 */
85 public void setAllowGlobalSeqNo(final boolean allowGlobalSeqNo) {
86 setAllowGlobalSeqNo(nativeHandle_, allowGlobalSeqNo);
87 }
88
89 /**
90 * If set to false and the file key range overlaps with the memtable key range
91 * (memtable flush required), IngestExternalFile will fail.
92 *
93 * @return true if blocking flushes may occur
94 */
95 public boolean allowBlockingFlush() {
96 return allowBlockingFlush(nativeHandle_);
97 }
98
99 /**
100 * If set to false and the file key range overlaps with the memtable key range
101 * (memtable flush required), IngestExternalFile will fail.
102 *
103 * @param allowBlockingFlush true if blocking flushes are allowed
104 */
105 public void setAllowBlockingFlush(final boolean allowBlockingFlush) {
106 setAllowBlockingFlush(nativeHandle_, allowBlockingFlush);
107 }
108
109 private native static long newIngestExternalFileOptions();
110 private native static long newIngestExternalFileOptions(
111 final boolean moveFiles, final boolean snapshotConsistency,
112 final boolean allowGlobalSeqNo, final boolean allowBlockingFlush);
113 private native boolean moveFiles(final long handle);
114 private native void setMoveFiles(final long handle, final boolean move_files);
115 private native boolean snapshotConsistency(final long handle);
116 private native void setSnapshotConsistency(final long handle,
117 final boolean snapshotConsistency);
118 private native boolean allowGlobalSeqNo(final long handle);
119 private native void setAllowGlobalSeqNo(final long handle,
120 final boolean allowGloablSeqNo);
121 private native boolean allowBlockingFlush(final long handle);
122 private native void setAllowBlockingFlush(final long handle,
123 final boolean allowBlockingFlush);
124 @Override protected final native void disposeInternal(final long handle);
125 }