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).
10 * IngestExternalFileOptions is used by {@link RocksDB#ingestExternalFile(ColumnFamilyHandle, List, IngestExternalFileOptions)}
12 public class IngestExternalFileOptions
extends RocksObject
{
14 public IngestExternalFileOptions() {
15 super(newIngestExternalFileOptions());
19 * @param moveFiles {@link #setMoveFiles(boolean)}
20 * @param snapshotConsistency {@link #setSnapshotConsistency(boolean)}
21 * @param allowGlobalSeqNo {@link #setAllowGlobalSeqNo(boolean)}
22 * @param allowBlockingFlush {@link #setAllowBlockingFlush(boolean)}
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
));
32 * Can be set to true to move the files instead of copying them.
34 * @return true if files will be moved
36 public boolean moveFiles() {
37 return moveFiles(nativeHandle_
);
41 * Can be set to true to move the files instead of copying them.
43 * @param moveFiles true if files should be moved instead of copied
45 public void setMoveFiles(final boolean moveFiles
) {
46 setMoveFiles(nativeHandle_
, moveFiles
);
50 * If set to false, an ingested file keys could appear in existing snapshots
51 * that where created before the file was ingested.
53 * @return true if snapshot consistency is assured
55 public boolean snapshotConsistency() {
56 return snapshotConsistency(nativeHandle_
);
60 * If set to false, an ingested file keys could appear in existing snapshots
61 * that where created before the file was ingested.
63 * @param snapshotConsistency true if snapshot consistency is required
65 public void setSnapshotConsistency(final boolean snapshotConsistency
) {
66 setSnapshotConsistency(nativeHandle_
, snapshotConsistency
);
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.
73 * @return true if global seq numbers are assured
75 public boolean allowGlobalSeqNo() {
76 return allowGlobalSeqNo(nativeHandle_
);
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.
83 * @param allowGlobalSeqNo true if global seq numbers are required
85 public void setAllowGlobalSeqNo(final boolean allowGlobalSeqNo
) {
86 setAllowGlobalSeqNo(nativeHandle_
, allowGlobalSeqNo
);
90 * If set to false and the file key range overlaps with the memtable key range
91 * (memtable flush required), IngestExternalFile will fail.
93 * @return true if blocking flushes may occur
95 public boolean allowBlockingFlush() {
96 return allowBlockingFlush(nativeHandle_
);
100 * If set to false and the file key range overlaps with the memtable key range
101 * (memtable flush required), IngestExternalFile will fail.
103 * @param allowBlockingFlush true if blocking flushes are allowed
105 public void setAllowBlockingFlush(final boolean allowBlockingFlush
) {
106 setAllowBlockingFlush(nativeHandle_
, allowBlockingFlush
);
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
);