]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/Options.java
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / Options.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 import java.nio.file.Paths;
9 import java.util.ArrayList;
10 import java.util.Collection;
11 import java.util.Collections;
12 import java.util.List;
13
14 /**
15 * Options to control the behavior of a database. It will be used
16 * during the creation of a {@link org.rocksdb.RocksDB} (i.e., RocksDB.open()).
17 *
18 * If {@link #dispose()} function is not called, then it will be GC'd
19 * automaticallyand native resources will be released as part of the process.
20 */
21 public class Options extends RocksObject
22 implements DBOptionsInterface<Options>, ColumnFamilyOptionsInterface<Options>,
23 MutableColumnFamilyOptionsInterface<Options> {
24 static {
25 RocksDB.loadLibrary();
26 }
27
28 /**
29 * Construct options for opening a RocksDB.
30 *
31 * This constructor will create (by allocating a block of memory)
32 * an {@code rocksdb::Options} in the c++ side.
33 */
34 public Options() {
35 super(newOptions());
36 env_ = Env.getDefault();
37 }
38
39 /**
40 * Construct options for opening a RocksDB. Reusing database options
41 * and column family options.
42 *
43 * @param dbOptions {@link org.rocksdb.DBOptions} instance
44 * @param columnFamilyOptions {@link org.rocksdb.ColumnFamilyOptions}
45 * instance
46 */
47 public Options(final DBOptions dbOptions,
48 final ColumnFamilyOptions columnFamilyOptions) {
49 super(newOptions(dbOptions.nativeHandle_,
50 columnFamilyOptions.nativeHandle_));
51 env_ = Env.getDefault();
52 }
53
54 /**
55 * Copy constructor for ColumnFamilyOptions.
56 *
57 * NOTE: This does a shallow copy, which means comparator, merge_operator
58 * and other pointers will be cloned!
59 *
60 * @param other The Options to copy.
61 */
62 public Options(Options other) {
63 super(copyOptions(other.nativeHandle_));
64 this.env_ = other.env_;
65 this.memTableConfig_ = other.memTableConfig_;
66 this.tableFormatConfig_ = other.tableFormatConfig_;
67 this.rateLimiter_ = other.rateLimiter_;
68 this.comparator_ = other.comparator_;
69 this.compactionOptionsUniversal_ = other.compactionOptionsUniversal_;
70 this.compactionOptionsFIFO_ = other.compactionOptionsFIFO_;
71 this.compressionOptions_ = other.compressionOptions_;
72 this.rowCache_ = other.rowCache_;
73 }
74
75 @Override
76 public Options setIncreaseParallelism(final int totalThreads) {
77 assert(isOwningHandle());
78 setIncreaseParallelism(nativeHandle_, totalThreads);
79 return this;
80 }
81
82 @Override
83 public Options setCreateIfMissing(final boolean flag) {
84 assert(isOwningHandle());
85 setCreateIfMissing(nativeHandle_, flag);
86 return this;
87 }
88
89 @Override
90 public Options setCreateMissingColumnFamilies(final boolean flag) {
91 assert(isOwningHandle());
92 setCreateMissingColumnFamilies(nativeHandle_, flag);
93 return this;
94 }
95
96 @Override
97 public Options setEnv(final Env env) {
98 assert(isOwningHandle());
99 setEnv(nativeHandle_, env.nativeHandle_);
100 env_ = env;
101 return this;
102 }
103
104 @Override
105 public Env getEnv() {
106 return env_;
107 }
108
109 /**
110 * <p>Set appropriate parameters for bulk loading.
111 * The reason that this is a function that returns "this" instead of a
112 * constructor is to enable chaining of multiple similar calls in the future.
113 * </p>
114 *
115 * <p>All data will be in level 0 without any automatic compaction.
116 * It's recommended to manually call CompactRange(NULL, NULL) before reading
117 * from the database, because otherwise the read can be very slow.</p>
118 *
119 * @return the instance of the current Options.
120 */
121 public Options prepareForBulkLoad() {
122 prepareForBulkLoad(nativeHandle_);
123 return this;
124 }
125
126 @Override
127 public boolean createIfMissing() {
128 assert(isOwningHandle());
129 return createIfMissing(nativeHandle_);
130 }
131
132 @Override
133 public boolean createMissingColumnFamilies() {
134 assert(isOwningHandle());
135 return createMissingColumnFamilies(nativeHandle_);
136 }
137
138 @Override
139 public Options optimizeForSmallDb() {
140 optimizeForSmallDb(nativeHandle_);
141 return this;
142 }
143
144 @Override
145 public Options optimizeForPointLookup(
146 long blockCacheSizeMb) {
147 optimizeForPointLookup(nativeHandle_,
148 blockCacheSizeMb);
149 return this;
150 }
151
152 @Override
153 public Options optimizeLevelStyleCompaction() {
154 optimizeLevelStyleCompaction(nativeHandle_,
155 DEFAULT_COMPACTION_MEMTABLE_MEMORY_BUDGET);
156 return this;
157 }
158
159 @Override
160 public Options optimizeLevelStyleCompaction(
161 long memtableMemoryBudget) {
162 optimizeLevelStyleCompaction(nativeHandle_,
163 memtableMemoryBudget);
164 return this;
165 }
166
167 @Override
168 public Options optimizeUniversalStyleCompaction() {
169 optimizeUniversalStyleCompaction(nativeHandle_,
170 DEFAULT_COMPACTION_MEMTABLE_MEMORY_BUDGET);
171 return this;
172 }
173
174 @Override
175 public Options optimizeUniversalStyleCompaction(
176 final long memtableMemoryBudget) {
177 optimizeUniversalStyleCompaction(nativeHandle_,
178 memtableMemoryBudget);
179 return this;
180 }
181
182 @Override
183 public Options setComparator(final BuiltinComparator builtinComparator) {
184 assert(isOwningHandle());
185 setComparatorHandle(nativeHandle_, builtinComparator.ordinal());
186 return this;
187 }
188
189 @Override
190 public Options setComparator(
191 final AbstractComparator<? extends AbstractSlice<?>> comparator) {
192 assert(isOwningHandle());
193 setComparatorHandle(nativeHandle_, comparator.nativeHandle_,
194 comparator.getComparatorType().getValue());
195 comparator_ = comparator;
196 return this;
197 }
198
199 @Override
200 public Options setMergeOperatorName(final String name) {
201 assert(isOwningHandle());
202 if (name == null) {
203 throw new IllegalArgumentException(
204 "Merge operator name must not be null.");
205 }
206 setMergeOperatorName(nativeHandle_, name);
207 return this;
208 }
209
210 @Override
211 public Options setMergeOperator(final MergeOperator mergeOperator) {
212 setMergeOperator(nativeHandle_, mergeOperator.nativeHandle_);
213 return this;
214 }
215
216 @Override
217 public Options setWriteBufferSize(final long writeBufferSize) {
218 assert(isOwningHandle());
219 setWriteBufferSize(nativeHandle_, writeBufferSize);
220 return this;
221 }
222
223 @Override
224 public long writeBufferSize() {
225 assert(isOwningHandle());
226 return writeBufferSize(nativeHandle_);
227 }
228
229 @Override
230 public Options setMaxWriteBufferNumber(final int maxWriteBufferNumber) {
231 assert(isOwningHandle());
232 setMaxWriteBufferNumber(nativeHandle_, maxWriteBufferNumber);
233 return this;
234 }
235
236 @Override
237 public int maxWriteBufferNumber() {
238 assert(isOwningHandle());
239 return maxWriteBufferNumber(nativeHandle_);
240 }
241
242 @Override
243 public boolean errorIfExists() {
244 assert(isOwningHandle());
245 return errorIfExists(nativeHandle_);
246 }
247
248 @Override
249 public Options setErrorIfExists(final boolean errorIfExists) {
250 assert(isOwningHandle());
251 setErrorIfExists(nativeHandle_, errorIfExists);
252 return this;
253 }
254
255 @Override
256 public boolean paranoidChecks() {
257 assert(isOwningHandle());
258 return paranoidChecks(nativeHandle_);
259 }
260
261 @Override
262 public Options setParanoidChecks(final boolean paranoidChecks) {
263 assert(isOwningHandle());
264 setParanoidChecks(nativeHandle_, paranoidChecks);
265 return this;
266 }
267
268 @Override
269 public int maxOpenFiles() {
270 assert(isOwningHandle());
271 return maxOpenFiles(nativeHandle_);
272 }
273
274 @Override
275 public Options setMaxFileOpeningThreads(final int maxFileOpeningThreads) {
276 assert(isOwningHandle());
277 setMaxFileOpeningThreads(nativeHandle_, maxFileOpeningThreads);
278 return this;
279 }
280
281 @Override
282 public int maxFileOpeningThreads() {
283 assert(isOwningHandle());
284 return maxFileOpeningThreads(nativeHandle_);
285 }
286
287 @Override
288 public Options setMaxTotalWalSize(final long maxTotalWalSize) {
289 assert(isOwningHandle());
290 setMaxTotalWalSize(nativeHandle_, maxTotalWalSize);
291 return this;
292 }
293
294 @Override
295 public long maxTotalWalSize() {
296 assert(isOwningHandle());
297 return maxTotalWalSize(nativeHandle_);
298 }
299
300 @Override
301 public Options setMaxOpenFiles(final int maxOpenFiles) {
302 assert(isOwningHandle());
303 setMaxOpenFiles(nativeHandle_, maxOpenFiles);
304 return this;
305 }
306
307 @Override
308 public boolean useFsync() {
309 assert(isOwningHandle());
310 return useFsync(nativeHandle_);
311 }
312
313 @Override
314 public Options setUseFsync(final boolean useFsync) {
315 assert(isOwningHandle());
316 setUseFsync(nativeHandle_, useFsync);
317 return this;
318 }
319
320 @Override
321 public Options setDbPaths(final Collection<DbPath> dbPaths) {
322 assert(isOwningHandle());
323
324 final int len = dbPaths.size();
325 final String paths[] = new String[len];
326 final long targetSizes[] = new long[len];
327
328 int i = 0;
329 for(final DbPath dbPath : dbPaths) {
330 paths[i] = dbPath.path.toString();
331 targetSizes[i] = dbPath.targetSize;
332 i++;
333 }
334 setDbPaths(nativeHandle_, paths, targetSizes);
335 return this;
336 }
337
338 @Override
339 public List<DbPath> dbPaths() {
340 final int len = (int)dbPathsLen(nativeHandle_);
341 if(len == 0) {
342 return Collections.emptyList();
343 } else {
344 final String paths[] = new String[len];
345 final long targetSizes[] = new long[len];
346
347 dbPaths(nativeHandle_, paths, targetSizes);
348
349 final List<DbPath> dbPaths = new ArrayList<>();
350 for(int i = 0; i < len; i++) {
351 dbPaths.add(new DbPath(Paths.get(paths[i]), targetSizes[i]));
352 }
353 return dbPaths;
354 }
355 }
356
357 @Override
358 public String dbLogDir() {
359 assert(isOwningHandle());
360 return dbLogDir(nativeHandle_);
361 }
362
363 @Override
364 public Options setDbLogDir(final String dbLogDir) {
365 assert(isOwningHandle());
366 setDbLogDir(nativeHandle_, dbLogDir);
367 return this;
368 }
369
370 @Override
371 public String walDir() {
372 assert(isOwningHandle());
373 return walDir(nativeHandle_);
374 }
375
376 @Override
377 public Options setWalDir(final String walDir) {
378 assert(isOwningHandle());
379 setWalDir(nativeHandle_, walDir);
380 return this;
381 }
382
383 @Override
384 public long deleteObsoleteFilesPeriodMicros() {
385 assert(isOwningHandle());
386 return deleteObsoleteFilesPeriodMicros(nativeHandle_);
387 }
388
389 @Override
390 public Options setDeleteObsoleteFilesPeriodMicros(
391 final long micros) {
392 assert(isOwningHandle());
393 setDeleteObsoleteFilesPeriodMicros(nativeHandle_, micros);
394 return this;
395 }
396
397 @Override
398 public int maxBackgroundCompactions() {
399 assert(isOwningHandle());
400 return maxBackgroundCompactions(nativeHandle_);
401 }
402
403 @Override
404 public Options setStatistics(final Statistics statistics) {
405 assert(isOwningHandle());
406 setStatistics(nativeHandle_, statistics.nativeHandle_);
407 return this;
408 }
409
410 @Override
411 public Statistics statistics() {
412 assert(isOwningHandle());
413 final long statisticsNativeHandle = statistics(nativeHandle_);
414 if(statisticsNativeHandle == 0) {
415 return null;
416 } else {
417 return new Statistics(statisticsNativeHandle);
418 }
419 }
420
421 @Override
422 public void setBaseBackgroundCompactions(
423 final int baseBackgroundCompactions) {
424 assert(isOwningHandle());
425 setBaseBackgroundCompactions(nativeHandle_, baseBackgroundCompactions);
426 }
427
428 @Override
429 public int baseBackgroundCompactions() {
430 assert(isOwningHandle());
431 return baseBackgroundCompactions(nativeHandle_);
432 }
433
434 @Override
435 public Options setMaxBackgroundCompactions(
436 final int maxBackgroundCompactions) {
437 assert(isOwningHandle());
438 setMaxBackgroundCompactions(nativeHandle_, maxBackgroundCompactions);
439 return this;
440 }
441
442 @Override
443 public void setMaxSubcompactions(final int maxSubcompactions) {
444 assert(isOwningHandle());
445 setMaxSubcompactions(nativeHandle_, maxSubcompactions);
446 }
447
448 @Override
449 public int maxSubcompactions() {
450 assert(isOwningHandle());
451 return maxSubcompactions(nativeHandle_);
452 }
453
454 @Override
455 public int maxBackgroundFlushes() {
456 assert(isOwningHandle());
457 return maxBackgroundFlushes(nativeHandle_);
458 }
459
460 @Override
461 public Options setMaxBackgroundFlushes(
462 final int maxBackgroundFlushes) {
463 assert(isOwningHandle());
464 setMaxBackgroundFlushes(nativeHandle_, maxBackgroundFlushes);
465 return this;
466 }
467
468 @Override
469 public int maxBackgroundJobs() {
470 assert(isOwningHandle());
471 return maxBackgroundJobs(nativeHandle_);
472 }
473
474 @Override
475 public Options setMaxBackgroundJobs(final int maxBackgroundJobs) {
476 assert(isOwningHandle());
477 setMaxBackgroundJobs(nativeHandle_, maxBackgroundJobs);
478 return this;
479 }
480
481 @Override
482 public long maxLogFileSize() {
483 assert(isOwningHandle());
484 return maxLogFileSize(nativeHandle_);
485 }
486
487 @Override
488 public Options setMaxLogFileSize(final long maxLogFileSize) {
489 assert(isOwningHandle());
490 setMaxLogFileSize(nativeHandle_, maxLogFileSize);
491 return this;
492 }
493
494 @Override
495 public long logFileTimeToRoll() {
496 assert(isOwningHandle());
497 return logFileTimeToRoll(nativeHandle_);
498 }
499
500 @Override
501 public Options setLogFileTimeToRoll(final long logFileTimeToRoll) {
502 assert(isOwningHandle());
503 setLogFileTimeToRoll(nativeHandle_, logFileTimeToRoll);
504 return this;
505 }
506
507 @Override
508 public long keepLogFileNum() {
509 assert(isOwningHandle());
510 return keepLogFileNum(nativeHandle_);
511 }
512
513 @Override
514 public Options setKeepLogFileNum(final long keepLogFileNum) {
515 assert(isOwningHandle());
516 setKeepLogFileNum(nativeHandle_, keepLogFileNum);
517 return this;
518 }
519
520
521 @Override
522 public Options setRecycleLogFileNum(final long recycleLogFileNum) {
523 assert(isOwningHandle());
524 setRecycleLogFileNum(nativeHandle_, recycleLogFileNum);
525 return this;
526 }
527
528 @Override
529 public long recycleLogFileNum() {
530 assert(isOwningHandle());
531 return recycleLogFileNum(nativeHandle_);
532 }
533
534 @Override
535 public long maxManifestFileSize() {
536 assert(isOwningHandle());
537 return maxManifestFileSize(nativeHandle_);
538 }
539
540 @Override
541 public Options setMaxManifestFileSize(
542 final long maxManifestFileSize) {
543 assert(isOwningHandle());
544 setMaxManifestFileSize(nativeHandle_, maxManifestFileSize);
545 return this;
546 }
547
548 @Override
549 public Options setMaxTableFilesSizeFIFO(
550 final long maxTableFilesSize) {
551 assert(maxTableFilesSize > 0); // unsigned native type
552 assert(isOwningHandle());
553 setMaxTableFilesSizeFIFO(nativeHandle_, maxTableFilesSize);
554 return this;
555 }
556
557 @Override
558 public long maxTableFilesSizeFIFO() {
559 return maxTableFilesSizeFIFO(nativeHandle_);
560 }
561
562 @Override
563 public int tableCacheNumshardbits() {
564 assert(isOwningHandle());
565 return tableCacheNumshardbits(nativeHandle_);
566 }
567
568 @Override
569 public Options setTableCacheNumshardbits(
570 final int tableCacheNumshardbits) {
571 assert(isOwningHandle());
572 setTableCacheNumshardbits(nativeHandle_, tableCacheNumshardbits);
573 return this;
574 }
575
576 @Override
577 public long walTtlSeconds() {
578 assert(isOwningHandle());
579 return walTtlSeconds(nativeHandle_);
580 }
581
582 @Override
583 public Options setWalTtlSeconds(final long walTtlSeconds) {
584 assert(isOwningHandle());
585 setWalTtlSeconds(nativeHandle_, walTtlSeconds);
586 return this;
587 }
588
589 @Override
590 public long walSizeLimitMB() {
591 assert(isOwningHandle());
592 return walSizeLimitMB(nativeHandle_);
593 }
594
595 @Override
596 public Options setWalSizeLimitMB(final long sizeLimitMB) {
597 assert(isOwningHandle());
598 setWalSizeLimitMB(nativeHandle_, sizeLimitMB);
599 return this;
600 }
601
602 @Override
603 public long manifestPreallocationSize() {
604 assert(isOwningHandle());
605 return manifestPreallocationSize(nativeHandle_);
606 }
607
608 @Override
609 public Options setManifestPreallocationSize(final long size) {
610 assert(isOwningHandle());
611 setManifestPreallocationSize(nativeHandle_, size);
612 return this;
613 }
614
615 @Override
616 public Options setUseDirectReads(final boolean useDirectReads) {
617 assert(isOwningHandle());
618 setUseDirectReads(nativeHandle_, useDirectReads);
619 return this;
620 }
621
622 @Override
623 public boolean useDirectReads() {
624 assert(isOwningHandle());
625 return useDirectReads(nativeHandle_);
626 }
627
628 @Override
629 public Options setUseDirectIoForFlushAndCompaction(
630 final boolean useDirectIoForFlushAndCompaction) {
631 assert(isOwningHandle());
632 setUseDirectIoForFlushAndCompaction(nativeHandle_, useDirectIoForFlushAndCompaction);
633 return this;
634 }
635
636 @Override
637 public boolean useDirectIoForFlushAndCompaction() {
638 assert(isOwningHandle());
639 return useDirectIoForFlushAndCompaction(nativeHandle_);
640 }
641
642 @Override
643 public Options setAllowFAllocate(final boolean allowFAllocate) {
644 assert(isOwningHandle());
645 setAllowFAllocate(nativeHandle_, allowFAllocate);
646 return this;
647 }
648
649 @Override
650 public boolean allowFAllocate() {
651 assert(isOwningHandle());
652 return allowFAllocate(nativeHandle_);
653 }
654
655 @Override
656 public boolean allowMmapReads() {
657 assert(isOwningHandle());
658 return allowMmapReads(nativeHandle_);
659 }
660
661 @Override
662 public Options setAllowMmapReads(final boolean allowMmapReads) {
663 assert(isOwningHandle());
664 setAllowMmapReads(nativeHandle_, allowMmapReads);
665 return this;
666 }
667
668 @Override
669 public boolean allowMmapWrites() {
670 assert(isOwningHandle());
671 return allowMmapWrites(nativeHandle_);
672 }
673
674 @Override
675 public Options setAllowMmapWrites(final boolean allowMmapWrites) {
676 assert(isOwningHandle());
677 setAllowMmapWrites(nativeHandle_, allowMmapWrites);
678 return this;
679 }
680
681 @Override
682 public boolean isFdCloseOnExec() {
683 assert(isOwningHandle());
684 return isFdCloseOnExec(nativeHandle_);
685 }
686
687 @Override
688 public Options setIsFdCloseOnExec(final boolean isFdCloseOnExec) {
689 assert(isOwningHandle());
690 setIsFdCloseOnExec(nativeHandle_, isFdCloseOnExec);
691 return this;
692 }
693
694 @Override
695 public int statsDumpPeriodSec() {
696 assert(isOwningHandle());
697 return statsDumpPeriodSec(nativeHandle_);
698 }
699
700 @Override
701 public Options setStatsDumpPeriodSec(final int statsDumpPeriodSec) {
702 assert(isOwningHandle());
703 setStatsDumpPeriodSec(nativeHandle_, statsDumpPeriodSec);
704 return this;
705 }
706
707 @Override
708 public boolean adviseRandomOnOpen() {
709 return adviseRandomOnOpen(nativeHandle_);
710 }
711
712 @Override
713 public Options setAdviseRandomOnOpen(final boolean adviseRandomOnOpen) {
714 assert(isOwningHandle());
715 setAdviseRandomOnOpen(nativeHandle_, adviseRandomOnOpen);
716 return this;
717 }
718
719 @Override
720 public Options setDbWriteBufferSize(final long dbWriteBufferSize) {
721 assert(isOwningHandle());
722 setDbWriteBufferSize(nativeHandle_, dbWriteBufferSize);
723 return this;
724 }
725
726 @Override
727 public long dbWriteBufferSize() {
728 assert(isOwningHandle());
729 return dbWriteBufferSize(nativeHandle_);
730 }
731
732 @Override
733 public Options setAccessHintOnCompactionStart(final AccessHint accessHint) {
734 assert(isOwningHandle());
735 setAccessHintOnCompactionStart(nativeHandle_, accessHint.getValue());
736 return this;
737 }
738
739 @Override
740 public AccessHint accessHintOnCompactionStart() {
741 assert(isOwningHandle());
742 return AccessHint.getAccessHint(accessHintOnCompactionStart(nativeHandle_));
743 }
744
745 @Override
746 public Options setNewTableReaderForCompactionInputs(
747 final boolean newTableReaderForCompactionInputs) {
748 assert(isOwningHandle());
749 setNewTableReaderForCompactionInputs(nativeHandle_,
750 newTableReaderForCompactionInputs);
751 return this;
752 }
753
754 @Override
755 public boolean newTableReaderForCompactionInputs() {
756 assert(isOwningHandle());
757 return newTableReaderForCompactionInputs(nativeHandle_);
758 }
759
760 @Override
761 public Options setCompactionReadaheadSize(final long compactionReadaheadSize) {
762 assert(isOwningHandle());
763 setCompactionReadaheadSize(nativeHandle_, compactionReadaheadSize);
764 return this;
765 }
766
767 @Override
768 public long compactionReadaheadSize() {
769 assert(isOwningHandle());
770 return compactionReadaheadSize(nativeHandle_);
771 }
772
773 @Override
774 public Options setRandomAccessMaxBufferSize(final long randomAccessMaxBufferSize) {
775 assert(isOwningHandle());
776 setRandomAccessMaxBufferSize(nativeHandle_, randomAccessMaxBufferSize);
777 return this;
778 }
779
780 @Override
781 public long randomAccessMaxBufferSize() {
782 assert(isOwningHandle());
783 return randomAccessMaxBufferSize(nativeHandle_);
784 }
785
786 @Override
787 public Options setWritableFileMaxBufferSize(final long writableFileMaxBufferSize) {
788 assert(isOwningHandle());
789 setWritableFileMaxBufferSize(nativeHandle_, writableFileMaxBufferSize);
790 return this;
791 }
792
793 @Override
794 public long writableFileMaxBufferSize() {
795 assert(isOwningHandle());
796 return writableFileMaxBufferSize(nativeHandle_);
797 }
798
799 @Override
800 public boolean useAdaptiveMutex() {
801 assert(isOwningHandle());
802 return useAdaptiveMutex(nativeHandle_);
803 }
804
805 @Override
806 public Options setUseAdaptiveMutex(final boolean useAdaptiveMutex) {
807 assert(isOwningHandle());
808 setUseAdaptiveMutex(nativeHandle_, useAdaptiveMutex);
809 return this;
810 }
811
812 @Override
813 public long bytesPerSync() {
814 return bytesPerSync(nativeHandle_);
815 }
816
817 @Override
818 public Options setBytesPerSync(final long bytesPerSync) {
819 assert(isOwningHandle());
820 setBytesPerSync(nativeHandle_, bytesPerSync);
821 return this;
822 }
823
824 @Override
825 public Options setWalBytesPerSync(final long walBytesPerSync) {
826 assert(isOwningHandle());
827 setWalBytesPerSync(nativeHandle_, walBytesPerSync);
828 return this;
829 }
830
831 @Override
832 public long walBytesPerSync() {
833 assert(isOwningHandle());
834 return walBytesPerSync(nativeHandle_);
835 }
836
837 @Override
838 public Options setEnableThreadTracking(final boolean enableThreadTracking) {
839 assert(isOwningHandle());
840 setEnableThreadTracking(nativeHandle_, enableThreadTracking);
841 return this;
842 }
843
844 @Override
845 public boolean enableThreadTracking() {
846 assert(isOwningHandle());
847 return enableThreadTracking(nativeHandle_);
848 }
849
850 @Override
851 public Options setDelayedWriteRate(final long delayedWriteRate) {
852 assert(isOwningHandle());
853 setDelayedWriteRate(nativeHandle_, delayedWriteRate);
854 return this;
855 }
856
857 @Override
858 public long delayedWriteRate(){
859 return delayedWriteRate(nativeHandle_);
860 }
861
862 @Override
863 public Options setAllowConcurrentMemtableWrite(
864 final boolean allowConcurrentMemtableWrite) {
865 setAllowConcurrentMemtableWrite(nativeHandle_,
866 allowConcurrentMemtableWrite);
867 return this;
868 }
869
870 @Override
871 public boolean allowConcurrentMemtableWrite() {
872 return allowConcurrentMemtableWrite(nativeHandle_);
873 }
874
875 @Override
876 public Options setEnableWriteThreadAdaptiveYield(
877 final boolean enableWriteThreadAdaptiveYield) {
878 setEnableWriteThreadAdaptiveYield(nativeHandle_,
879 enableWriteThreadAdaptiveYield);
880 return this;
881 }
882
883 @Override
884 public boolean enableWriteThreadAdaptiveYield() {
885 return enableWriteThreadAdaptiveYield(nativeHandle_);
886 }
887
888 @Override
889 public Options setWriteThreadMaxYieldUsec(final long writeThreadMaxYieldUsec) {
890 setWriteThreadMaxYieldUsec(nativeHandle_, writeThreadMaxYieldUsec);
891 return this;
892 }
893
894 @Override
895 public long writeThreadMaxYieldUsec() {
896 return writeThreadMaxYieldUsec(nativeHandle_);
897 }
898
899 @Override
900 public Options setWriteThreadSlowYieldUsec(final long writeThreadSlowYieldUsec) {
901 setWriteThreadSlowYieldUsec(nativeHandle_, writeThreadSlowYieldUsec);
902 return this;
903 }
904
905 @Override
906 public long writeThreadSlowYieldUsec() {
907 return writeThreadSlowYieldUsec(nativeHandle_);
908 }
909
910 @Override
911 public Options setSkipStatsUpdateOnDbOpen(final boolean skipStatsUpdateOnDbOpen) {
912 assert(isOwningHandle());
913 setSkipStatsUpdateOnDbOpen(nativeHandle_, skipStatsUpdateOnDbOpen);
914 return this;
915 }
916
917 @Override
918 public boolean skipStatsUpdateOnDbOpen() {
919 assert(isOwningHandle());
920 return skipStatsUpdateOnDbOpen(nativeHandle_);
921 }
922
923 @Override
924 public Options setWalRecoveryMode(final WALRecoveryMode walRecoveryMode) {
925 assert(isOwningHandle());
926 setWalRecoveryMode(nativeHandle_, walRecoveryMode.getValue());
927 return this;
928 }
929
930 @Override
931 public WALRecoveryMode walRecoveryMode() {
932 assert(isOwningHandle());
933 return WALRecoveryMode.getWALRecoveryMode(walRecoveryMode(nativeHandle_));
934 }
935
936 @Override
937 public Options setAllow2pc(final boolean allow2pc) {
938 assert(isOwningHandle());
939 setAllow2pc(nativeHandle_, allow2pc);
940 return this;
941 }
942
943 @Override
944 public boolean allow2pc() {
945 assert(isOwningHandle());
946 return allow2pc(nativeHandle_);
947 }
948
949 @Override
950 public Options setRowCache(final Cache rowCache) {
951 assert(isOwningHandle());
952 setRowCache(nativeHandle_, rowCache.nativeHandle_);
953 this.rowCache_ = rowCache;
954 return this;
955 }
956
957 @Override
958 public Cache rowCache() {
959 assert(isOwningHandle());
960 return this.rowCache_;
961 }
962
963 @Override
964 public Options setFailIfOptionsFileError(final boolean failIfOptionsFileError) {
965 assert(isOwningHandle());
966 setFailIfOptionsFileError(nativeHandle_, failIfOptionsFileError);
967 return this;
968 }
969
970 @Override
971 public boolean failIfOptionsFileError() {
972 assert(isOwningHandle());
973 return failIfOptionsFileError(nativeHandle_);
974 }
975
976 @Override
977 public Options setDumpMallocStats(final boolean dumpMallocStats) {
978 assert(isOwningHandle());
979 setDumpMallocStats(nativeHandle_, dumpMallocStats);
980 return this;
981 }
982
983 @Override
984 public boolean dumpMallocStats() {
985 assert(isOwningHandle());
986 return dumpMallocStats(nativeHandle_);
987 }
988
989 @Override
990 public Options setAvoidFlushDuringRecovery(final boolean avoidFlushDuringRecovery) {
991 assert(isOwningHandle());
992 setAvoidFlushDuringRecovery(nativeHandle_, avoidFlushDuringRecovery);
993 return this;
994 }
995
996 @Override
997 public boolean avoidFlushDuringRecovery() {
998 assert(isOwningHandle());
999 return avoidFlushDuringRecovery(nativeHandle_);
1000 }
1001
1002 @Override
1003 public Options setAvoidFlushDuringShutdown(final boolean avoidFlushDuringShutdown) {
1004 assert(isOwningHandle());
1005 setAvoidFlushDuringShutdown(nativeHandle_, avoidFlushDuringShutdown);
1006 return this;
1007 }
1008
1009 @Override
1010 public boolean avoidFlushDuringShutdown() {
1011 assert(isOwningHandle());
1012 return avoidFlushDuringShutdown(nativeHandle_);
1013 }
1014
1015 @Override
1016 public MemTableConfig memTableConfig() {
1017 return this.memTableConfig_;
1018 }
1019
1020 @Override
1021 public Options setMemTableConfig(final MemTableConfig config) {
1022 memTableConfig_ = config;
1023 setMemTableFactory(nativeHandle_, config.newMemTableFactoryHandle());
1024 return this;
1025 }
1026
1027 @Override
1028 public Options setRateLimiter(final RateLimiter rateLimiter) {
1029 assert(isOwningHandle());
1030 rateLimiter_ = rateLimiter;
1031 setRateLimiter(nativeHandle_, rateLimiter.nativeHandle_);
1032 return this;
1033 }
1034
1035 @Override
1036 public Options setSstFileManager(final SstFileManager sstFileManager) {
1037 assert(isOwningHandle());
1038 setSstFileManager(nativeHandle_, sstFileManager.nativeHandle_);
1039 return this;
1040 }
1041
1042 @Override
1043 public Options setLogger(final Logger logger) {
1044 assert(isOwningHandle());
1045 setLogger(nativeHandle_, logger.nativeHandle_);
1046 return this;
1047 }
1048
1049 @Override
1050 public Options setInfoLogLevel(final InfoLogLevel infoLogLevel) {
1051 assert(isOwningHandle());
1052 setInfoLogLevel(nativeHandle_, infoLogLevel.getValue());
1053 return this;
1054 }
1055
1056 @Override
1057 public InfoLogLevel infoLogLevel() {
1058 assert(isOwningHandle());
1059 return InfoLogLevel.getInfoLogLevel(
1060 infoLogLevel(nativeHandle_));
1061 }
1062
1063 @Override
1064 public String memTableFactoryName() {
1065 assert(isOwningHandle());
1066 return memTableFactoryName(nativeHandle_);
1067 }
1068
1069 @Override
1070 public TableFormatConfig tableFormatConfig() {
1071 return this.tableFormatConfig_;
1072 }
1073
1074 @Override
1075 public Options setTableFormatConfig(final TableFormatConfig config) {
1076 tableFormatConfig_ = config;
1077 setTableFactory(nativeHandle_, config.newTableFactoryHandle());
1078 return this;
1079 }
1080
1081 @Override
1082 public String tableFactoryName() {
1083 assert(isOwningHandle());
1084 return tableFactoryName(nativeHandle_);
1085 }
1086
1087 @Override
1088 public Options useFixedLengthPrefixExtractor(final int n) {
1089 assert(isOwningHandle());
1090 useFixedLengthPrefixExtractor(nativeHandle_, n);
1091 return this;
1092 }
1093
1094 @Override
1095 public Options useCappedPrefixExtractor(final int n) {
1096 assert(isOwningHandle());
1097 useCappedPrefixExtractor(nativeHandle_, n);
1098 return this;
1099 }
1100
1101 @Override
1102 public CompressionType compressionType() {
1103 return CompressionType.getCompressionType(compressionType(nativeHandle_));
1104 }
1105
1106 @Override
1107 public Options setCompressionPerLevel(
1108 final List<CompressionType> compressionLevels) {
1109 final byte[] byteCompressionTypes = new byte[
1110 compressionLevels.size()];
1111 for (int i = 0; i < compressionLevels.size(); i++) {
1112 byteCompressionTypes[i] = compressionLevels.get(i).getValue();
1113 }
1114 setCompressionPerLevel(nativeHandle_, byteCompressionTypes);
1115 return this;
1116 }
1117
1118 @Override
1119 public List<CompressionType> compressionPerLevel() {
1120 final byte[] byteCompressionTypes =
1121 compressionPerLevel(nativeHandle_);
1122 final List<CompressionType> compressionLevels = new ArrayList<>();
1123 for (final Byte byteCompressionType : byteCompressionTypes) {
1124 compressionLevels.add(CompressionType.getCompressionType(
1125 byteCompressionType));
1126 }
1127 return compressionLevels;
1128 }
1129
1130 @Override
1131 public Options setCompressionType(CompressionType compressionType) {
1132 setCompressionType(nativeHandle_, compressionType.getValue());
1133 return this;
1134 }
1135
1136
1137 @Override
1138 public Options setBottommostCompressionType(
1139 final CompressionType bottommostCompressionType) {
1140 setBottommostCompressionType(nativeHandle_,
1141 bottommostCompressionType.getValue());
1142 return this;
1143 }
1144
1145 @Override
1146 public CompressionType bottommostCompressionType() {
1147 return CompressionType.getCompressionType(
1148 bottommostCompressionType(nativeHandle_));
1149 }
1150
1151 @Override
1152 public Options setCompressionOptions(
1153 final CompressionOptions compressionOptions) {
1154 setCompressionOptions(nativeHandle_, compressionOptions.nativeHandle_);
1155 this.compressionOptions_ = compressionOptions;
1156 return this;
1157 }
1158
1159 @Override
1160 public CompressionOptions compressionOptions() {
1161 return this.compressionOptions_;
1162 }
1163
1164 @Override
1165 public CompactionStyle compactionStyle() {
1166 return CompactionStyle.values()[compactionStyle(nativeHandle_)];
1167 }
1168
1169 @Override
1170 public Options setCompactionStyle(
1171 final CompactionStyle compactionStyle) {
1172 setCompactionStyle(nativeHandle_, compactionStyle.getValue());
1173 return this;
1174 }
1175
1176 @Override
1177 public int numLevels() {
1178 return numLevels(nativeHandle_);
1179 }
1180
1181 @Override
1182 public Options setNumLevels(int numLevels) {
1183 setNumLevels(nativeHandle_, numLevels);
1184 return this;
1185 }
1186
1187 @Override
1188 public int levelZeroFileNumCompactionTrigger() {
1189 return levelZeroFileNumCompactionTrigger(nativeHandle_);
1190 }
1191
1192 @Override
1193 public Options setLevelZeroFileNumCompactionTrigger(
1194 final int numFiles) {
1195 setLevelZeroFileNumCompactionTrigger(
1196 nativeHandle_, numFiles);
1197 return this;
1198 }
1199
1200 @Override
1201 public int levelZeroSlowdownWritesTrigger() {
1202 return levelZeroSlowdownWritesTrigger(nativeHandle_);
1203 }
1204
1205 @Override
1206 public Options setLevelZeroSlowdownWritesTrigger(
1207 final int numFiles) {
1208 setLevelZeroSlowdownWritesTrigger(nativeHandle_, numFiles);
1209 return this;
1210 }
1211
1212 @Override
1213 public int levelZeroStopWritesTrigger() {
1214 return levelZeroStopWritesTrigger(nativeHandle_);
1215 }
1216
1217 @Override
1218 public Options setLevelZeroStopWritesTrigger(
1219 final int numFiles) {
1220 setLevelZeroStopWritesTrigger(nativeHandle_, numFiles);
1221 return this;
1222 }
1223
1224 @Override
1225 public long targetFileSizeBase() {
1226 return targetFileSizeBase(nativeHandle_);
1227 }
1228
1229 @Override
1230 public Options setTargetFileSizeBase(long targetFileSizeBase) {
1231 setTargetFileSizeBase(nativeHandle_, targetFileSizeBase);
1232 return this;
1233 }
1234
1235 @Override
1236 public int targetFileSizeMultiplier() {
1237 return targetFileSizeMultiplier(nativeHandle_);
1238 }
1239
1240 @Override
1241 public Options setTargetFileSizeMultiplier(int multiplier) {
1242 setTargetFileSizeMultiplier(nativeHandle_, multiplier);
1243 return this;
1244 }
1245
1246 @Override
1247 public Options setMaxBytesForLevelBase(final long maxBytesForLevelBase) {
1248 setMaxBytesForLevelBase(nativeHandle_, maxBytesForLevelBase);
1249 return this;
1250 }
1251
1252 @Override
1253 public long maxBytesForLevelBase() {
1254 return maxBytesForLevelBase(nativeHandle_);
1255 }
1256
1257 @Override
1258 public Options setLevelCompactionDynamicLevelBytes(
1259 final boolean enableLevelCompactionDynamicLevelBytes) {
1260 setLevelCompactionDynamicLevelBytes(nativeHandle_,
1261 enableLevelCompactionDynamicLevelBytes);
1262 return this;
1263 }
1264
1265 @Override
1266 public boolean levelCompactionDynamicLevelBytes() {
1267 return levelCompactionDynamicLevelBytes(nativeHandle_);
1268 }
1269
1270 @Override
1271 public double maxBytesForLevelMultiplier() {
1272 return maxBytesForLevelMultiplier(nativeHandle_);
1273 }
1274
1275 @Override
1276 public Options setMaxBytesForLevelMultiplier(final double multiplier) {
1277 setMaxBytesForLevelMultiplier(nativeHandle_, multiplier);
1278 return this;
1279 }
1280
1281 @Override
1282 public long maxCompactionBytes() {
1283 return maxCompactionBytes(nativeHandle_);
1284 }
1285
1286 @Override
1287 public Options setMaxCompactionBytes(final long maxCompactionBytes) {
1288 setMaxCompactionBytes(nativeHandle_, maxCompactionBytes);
1289 return this;
1290 }
1291
1292 @Override
1293 public long arenaBlockSize() {
1294 return arenaBlockSize(nativeHandle_);
1295 }
1296
1297 @Override
1298 public Options setArenaBlockSize(final long arenaBlockSize) {
1299 setArenaBlockSize(nativeHandle_, arenaBlockSize);
1300 return this;
1301 }
1302
1303 @Override
1304 public boolean disableAutoCompactions() {
1305 return disableAutoCompactions(nativeHandle_);
1306 }
1307
1308 @Override
1309 public Options setDisableAutoCompactions(
1310 final boolean disableAutoCompactions) {
1311 setDisableAutoCompactions(nativeHandle_, disableAutoCompactions);
1312 return this;
1313 }
1314
1315 @Override
1316 public long maxSequentialSkipInIterations() {
1317 return maxSequentialSkipInIterations(nativeHandle_);
1318 }
1319
1320 @Override
1321 public Options setMaxSequentialSkipInIterations(
1322 final long maxSequentialSkipInIterations) {
1323 setMaxSequentialSkipInIterations(nativeHandle_,
1324 maxSequentialSkipInIterations);
1325 return this;
1326 }
1327
1328 @Override
1329 public boolean inplaceUpdateSupport() {
1330 return inplaceUpdateSupport(nativeHandle_);
1331 }
1332
1333 @Override
1334 public Options setInplaceUpdateSupport(
1335 final boolean inplaceUpdateSupport) {
1336 setInplaceUpdateSupport(nativeHandle_, inplaceUpdateSupport);
1337 return this;
1338 }
1339
1340 @Override
1341 public long inplaceUpdateNumLocks() {
1342 return inplaceUpdateNumLocks(nativeHandle_);
1343 }
1344
1345 @Override
1346 public Options setInplaceUpdateNumLocks(
1347 final long inplaceUpdateNumLocks) {
1348 setInplaceUpdateNumLocks(nativeHandle_, inplaceUpdateNumLocks);
1349 return this;
1350 }
1351
1352 @Override
1353 public double memtablePrefixBloomSizeRatio() {
1354 return memtablePrefixBloomSizeRatio(nativeHandle_);
1355 }
1356
1357 @Override
1358 public Options setMemtablePrefixBloomSizeRatio(final double memtablePrefixBloomSizeRatio) {
1359 setMemtablePrefixBloomSizeRatio(nativeHandle_, memtablePrefixBloomSizeRatio);
1360 return this;
1361 }
1362
1363 @Override
1364 public int bloomLocality() {
1365 return bloomLocality(nativeHandle_);
1366 }
1367
1368 @Override
1369 public Options setBloomLocality(final int bloomLocality) {
1370 setBloomLocality(nativeHandle_, bloomLocality);
1371 return this;
1372 }
1373
1374 @Override
1375 public long maxSuccessiveMerges() {
1376 return maxSuccessiveMerges(nativeHandle_);
1377 }
1378
1379 @Override
1380 public Options setMaxSuccessiveMerges(long maxSuccessiveMerges) {
1381 setMaxSuccessiveMerges(nativeHandle_, maxSuccessiveMerges);
1382 return this;
1383 }
1384
1385 @Override
1386 public int minWriteBufferNumberToMerge() {
1387 return minWriteBufferNumberToMerge(nativeHandle_);
1388 }
1389
1390 @Override
1391 public Options setMinWriteBufferNumberToMerge(
1392 final int minWriteBufferNumberToMerge) {
1393 setMinWriteBufferNumberToMerge(nativeHandle_, minWriteBufferNumberToMerge);
1394 return this;
1395 }
1396
1397 @Override
1398 public Options setOptimizeFiltersForHits(
1399 final boolean optimizeFiltersForHits) {
1400 setOptimizeFiltersForHits(nativeHandle_, optimizeFiltersForHits);
1401 return this;
1402 }
1403
1404 @Override
1405 public boolean optimizeFiltersForHits() {
1406 return optimizeFiltersForHits(nativeHandle_);
1407 }
1408
1409 @Override
1410 public Options
1411 setMemtableHugePageSize(
1412 long memtableHugePageSize) {
1413 setMemtableHugePageSize(nativeHandle_,
1414 memtableHugePageSize);
1415 return this;
1416 }
1417
1418 @Override
1419 public long memtableHugePageSize() {
1420 return memtableHugePageSize(nativeHandle_);
1421 }
1422
1423 @Override
1424 public Options setSoftPendingCompactionBytesLimit(long softPendingCompactionBytesLimit) {
1425 setSoftPendingCompactionBytesLimit(nativeHandle_,
1426 softPendingCompactionBytesLimit);
1427 return this;
1428 }
1429
1430 @Override
1431 public long softPendingCompactionBytesLimit() {
1432 return softPendingCompactionBytesLimit(nativeHandle_);
1433 }
1434
1435 @Override
1436 public Options setHardPendingCompactionBytesLimit(long hardPendingCompactionBytesLimit) {
1437 setHardPendingCompactionBytesLimit(nativeHandle_, hardPendingCompactionBytesLimit);
1438 return this;
1439 }
1440
1441 @Override
1442 public long hardPendingCompactionBytesLimit() {
1443 return hardPendingCompactionBytesLimit(nativeHandle_);
1444 }
1445
1446 @Override
1447 public Options setLevel0FileNumCompactionTrigger(int level0FileNumCompactionTrigger) {
1448 setLevel0FileNumCompactionTrigger(nativeHandle_, level0FileNumCompactionTrigger);
1449 return this;
1450 }
1451
1452 @Override
1453 public int level0FileNumCompactionTrigger() {
1454 return level0FileNumCompactionTrigger(nativeHandle_);
1455 }
1456
1457 @Override
1458 public Options setLevel0SlowdownWritesTrigger(int level0SlowdownWritesTrigger) {
1459 setLevel0SlowdownWritesTrigger(nativeHandle_, level0SlowdownWritesTrigger);
1460 return this;
1461 }
1462
1463 @Override
1464 public int level0SlowdownWritesTrigger() {
1465 return level0SlowdownWritesTrigger(nativeHandle_);
1466 }
1467
1468 @Override
1469 public Options setLevel0StopWritesTrigger(int level0StopWritesTrigger) {
1470 setLevel0StopWritesTrigger(nativeHandle_, level0StopWritesTrigger);
1471 return this;
1472 }
1473
1474 @Override
1475 public int level0StopWritesTrigger() {
1476 return level0StopWritesTrigger(nativeHandle_);
1477 }
1478
1479 @Override
1480 public Options setMaxBytesForLevelMultiplierAdditional(int[] maxBytesForLevelMultiplierAdditional) {
1481 setMaxBytesForLevelMultiplierAdditional(nativeHandle_, maxBytesForLevelMultiplierAdditional);
1482 return this;
1483 }
1484
1485 @Override
1486 public int[] maxBytesForLevelMultiplierAdditional() {
1487 return maxBytesForLevelMultiplierAdditional(nativeHandle_);
1488 }
1489
1490 @Override
1491 public Options setParanoidFileChecks(boolean paranoidFileChecks) {
1492 setParanoidFileChecks(nativeHandle_, paranoidFileChecks);
1493 return this;
1494 }
1495
1496 @Override
1497 public boolean paranoidFileChecks() {
1498 return paranoidFileChecks(nativeHandle_);
1499 }
1500
1501 @Override
1502 public Options setMaxWriteBufferNumberToMaintain(
1503 final int maxWriteBufferNumberToMaintain) {
1504 setMaxWriteBufferNumberToMaintain(
1505 nativeHandle_, maxWriteBufferNumberToMaintain);
1506 return this;
1507 }
1508
1509 @Override
1510 public int maxWriteBufferNumberToMaintain() {
1511 return maxWriteBufferNumberToMaintain(nativeHandle_);
1512 }
1513
1514 @Override
1515 public Options setCompactionPriority(
1516 final CompactionPriority compactionPriority) {
1517 setCompactionPriority(nativeHandle_, compactionPriority.getValue());
1518 return this;
1519 }
1520
1521 @Override
1522 public CompactionPriority compactionPriority() {
1523 return CompactionPriority.getCompactionPriority(
1524 compactionPriority(nativeHandle_));
1525 }
1526
1527 @Override
1528 public Options setReportBgIoStats(final boolean reportBgIoStats) {
1529 setReportBgIoStats(nativeHandle_, reportBgIoStats);
1530 return this;
1531 }
1532
1533 @Override
1534 public boolean reportBgIoStats() {
1535 return reportBgIoStats(nativeHandle_);
1536 }
1537
1538 @Override
1539 public Options setCompactionOptionsUniversal(
1540 final CompactionOptionsUniversal compactionOptionsUniversal) {
1541 setCompactionOptionsUniversal(nativeHandle_,
1542 compactionOptionsUniversal.nativeHandle_);
1543 this.compactionOptionsUniversal_ = compactionOptionsUniversal;
1544 return this;
1545 }
1546
1547 @Override
1548 public CompactionOptionsUniversal compactionOptionsUniversal() {
1549 return this.compactionOptionsUniversal_;
1550 }
1551
1552 @Override
1553 public Options setCompactionOptionsFIFO(final CompactionOptionsFIFO compactionOptionsFIFO) {
1554 setCompactionOptionsFIFO(nativeHandle_,
1555 compactionOptionsFIFO.nativeHandle_);
1556 this.compactionOptionsFIFO_ = compactionOptionsFIFO;
1557 return this;
1558 }
1559
1560 @Override
1561 public CompactionOptionsFIFO compactionOptionsFIFO() {
1562 return this.compactionOptionsFIFO_;
1563 }
1564
1565 @Override
1566 public Options setForceConsistencyChecks(final boolean forceConsistencyChecks) {
1567 setForceConsistencyChecks(nativeHandle_, forceConsistencyChecks);
1568 return this;
1569 }
1570
1571 @Override
1572 public boolean forceConsistencyChecks() {
1573 return forceConsistencyChecks(nativeHandle_);
1574 }
1575
1576 private native static long newOptions();
1577 private native static long newOptions(long dbOptHandle,
1578 long cfOptHandle);
1579 private native static long copyOptions(long handle);
1580 @Override protected final native void disposeInternal(final long handle);
1581 private native void setEnv(long optHandle, long envHandle);
1582 private native void prepareForBulkLoad(long handle);
1583
1584 // DB native handles
1585 private native void setIncreaseParallelism(long handle, int totalThreads);
1586 private native void setCreateIfMissing(long handle, boolean flag);
1587 private native boolean createIfMissing(long handle);
1588 private native void setCreateMissingColumnFamilies(
1589 long handle, boolean flag);
1590 private native boolean createMissingColumnFamilies(long handle);
1591 private native void setErrorIfExists(long handle, boolean errorIfExists);
1592 private native boolean errorIfExists(long handle);
1593 private native void setParanoidChecks(
1594 long handle, boolean paranoidChecks);
1595 private native boolean paranoidChecks(long handle);
1596 private native void setRateLimiter(long handle,
1597 long rateLimiterHandle);
1598 private native void setSstFileManager(final long handle,
1599 final long sstFileManagerHandle);
1600 private native void setLogger(long handle,
1601 long loggerHandle);
1602 private native void setInfoLogLevel(long handle, byte logLevel);
1603 private native byte infoLogLevel(long handle);
1604 private native void setMaxOpenFiles(long handle, int maxOpenFiles);
1605 private native int maxOpenFiles(long handle);
1606 private native void setMaxTotalWalSize(long handle,
1607 long maxTotalWalSize);
1608 private native void setMaxFileOpeningThreads(final long handle,
1609 final int maxFileOpeningThreads);
1610 private native int maxFileOpeningThreads(final long handle);
1611 private native long maxTotalWalSize(long handle);
1612 private native void setStatistics(final long handle, final long statisticsHandle);
1613 private native long statistics(final long handle);
1614 private native boolean useFsync(long handle);
1615 private native void setUseFsync(long handle, boolean useFsync);
1616 private native void setDbPaths(final long handle, final String[] paths,
1617 final long[] targetSizes);
1618 private native long dbPathsLen(final long handle);
1619 private native void dbPaths(final long handle, final String[] paths,
1620 final long[] targetSizes);
1621 private native void setDbLogDir(long handle, String dbLogDir);
1622 private native String dbLogDir(long handle);
1623 private native void setWalDir(long handle, String walDir);
1624 private native String walDir(long handle);
1625 private native void setDeleteObsoleteFilesPeriodMicros(
1626 long handle, long micros);
1627 private native long deleteObsoleteFilesPeriodMicros(long handle);
1628 private native void setBaseBackgroundCompactions(long handle,
1629 int baseBackgroundCompactions);
1630 private native int baseBackgroundCompactions(long handle);
1631 private native void setMaxBackgroundCompactions(
1632 long handle, int maxBackgroundCompactions);
1633 private native int maxBackgroundCompactions(long handle);
1634 private native void setMaxSubcompactions(long handle, int maxSubcompactions);
1635 private native int maxSubcompactions(long handle);
1636 private native void setMaxBackgroundFlushes(
1637 long handle, int maxBackgroundFlushes);
1638 private native int maxBackgroundFlushes(long handle);
1639 private native void setMaxBackgroundJobs(long handle, int maxMaxBackgroundJobs);
1640 private native int maxBackgroundJobs(long handle);
1641 private native void setMaxLogFileSize(long handle, long maxLogFileSize)
1642 throws IllegalArgumentException;
1643 private native long maxLogFileSize(long handle);
1644 private native void setLogFileTimeToRoll(
1645 long handle, long logFileTimeToRoll) throws IllegalArgumentException;
1646 private native long logFileTimeToRoll(long handle);
1647 private native void setKeepLogFileNum(long handle, long keepLogFileNum)
1648 throws IllegalArgumentException;
1649 private native long keepLogFileNum(long handle);
1650 private native void setRecycleLogFileNum(long handle, long recycleLogFileNum);
1651 private native long recycleLogFileNum(long handle);
1652 private native void setMaxManifestFileSize(
1653 long handle, long maxManifestFileSize);
1654 private native long maxManifestFileSize(long handle);
1655 private native void setMaxTableFilesSizeFIFO(
1656 long handle, long maxTableFilesSize);
1657 private native long maxTableFilesSizeFIFO(long handle);
1658 private native void setTableCacheNumshardbits(
1659 long handle, int tableCacheNumshardbits);
1660 private native int tableCacheNumshardbits(long handle);
1661 private native void setWalTtlSeconds(long handle, long walTtlSeconds);
1662 private native long walTtlSeconds(long handle);
1663 private native void setWalSizeLimitMB(long handle, long sizeLimitMB);
1664 private native long walSizeLimitMB(long handle);
1665 private native void setManifestPreallocationSize(
1666 long handle, long size) throws IllegalArgumentException;
1667 private native long manifestPreallocationSize(long handle);
1668 private native void setUseDirectReads(long handle, boolean useDirectReads);
1669 private native boolean useDirectReads(long handle);
1670 private native void setUseDirectIoForFlushAndCompaction(
1671 long handle, boolean useDirectIoForFlushAndCompaction);
1672 private native boolean useDirectIoForFlushAndCompaction(long handle);
1673 private native void setAllowFAllocate(final long handle,
1674 final boolean allowFAllocate);
1675 private native boolean allowFAllocate(final long handle);
1676 private native void setAllowMmapReads(
1677 long handle, boolean allowMmapReads);
1678 private native boolean allowMmapReads(long handle);
1679 private native void setAllowMmapWrites(
1680 long handle, boolean allowMmapWrites);
1681 private native boolean allowMmapWrites(long handle);
1682 private native void setIsFdCloseOnExec(
1683 long handle, boolean isFdCloseOnExec);
1684 private native boolean isFdCloseOnExec(long handle);
1685 private native void setStatsDumpPeriodSec(
1686 long handle, int statsDumpPeriodSec);
1687 private native int statsDumpPeriodSec(long handle);
1688 private native void setAdviseRandomOnOpen(
1689 long handle, boolean adviseRandomOnOpen);
1690 private native boolean adviseRandomOnOpen(long handle);
1691 private native void setDbWriteBufferSize(final long handle,
1692 final long dbWriteBufferSize);
1693 private native long dbWriteBufferSize(final long handle);
1694 private native void setAccessHintOnCompactionStart(final long handle,
1695 final byte accessHintOnCompactionStart);
1696 private native byte accessHintOnCompactionStart(final long handle);
1697 private native void setNewTableReaderForCompactionInputs(final long handle,
1698 final boolean newTableReaderForCompactionInputs);
1699 private native boolean newTableReaderForCompactionInputs(final long handle);
1700 private native void setCompactionReadaheadSize(final long handle,
1701 final long compactionReadaheadSize);
1702 private native long compactionReadaheadSize(final long handle);
1703 private native void setRandomAccessMaxBufferSize(final long handle,
1704 final long randomAccessMaxBufferSize);
1705 private native long randomAccessMaxBufferSize(final long handle);
1706 private native void setWritableFileMaxBufferSize(final long handle,
1707 final long writableFileMaxBufferSize);
1708 private native long writableFileMaxBufferSize(final long handle);
1709 private native void setUseAdaptiveMutex(
1710 long handle, boolean useAdaptiveMutex);
1711 private native boolean useAdaptiveMutex(long handle);
1712 private native void setBytesPerSync(
1713 long handle, long bytesPerSync);
1714 private native long bytesPerSync(long handle);
1715 private native void setWalBytesPerSync(long handle, long walBytesPerSync);
1716 private native long walBytesPerSync(long handle);
1717 private native void setEnableThreadTracking(long handle,
1718 boolean enableThreadTracking);
1719 private native boolean enableThreadTracking(long handle);
1720 private native void setDelayedWriteRate(long handle, long delayedWriteRate);
1721 private native long delayedWriteRate(long handle);
1722 private native void setAllowConcurrentMemtableWrite(long handle,
1723 boolean allowConcurrentMemtableWrite);
1724 private native boolean allowConcurrentMemtableWrite(long handle);
1725 private native void setEnableWriteThreadAdaptiveYield(long handle,
1726 boolean enableWriteThreadAdaptiveYield);
1727 private native boolean enableWriteThreadAdaptiveYield(long handle);
1728 private native void setWriteThreadMaxYieldUsec(long handle,
1729 long writeThreadMaxYieldUsec);
1730 private native long writeThreadMaxYieldUsec(long handle);
1731 private native void setWriteThreadSlowYieldUsec(long handle,
1732 long writeThreadSlowYieldUsec);
1733 private native long writeThreadSlowYieldUsec(long handle);
1734 private native void setSkipStatsUpdateOnDbOpen(final long handle,
1735 final boolean skipStatsUpdateOnDbOpen);
1736 private native boolean skipStatsUpdateOnDbOpen(final long handle);
1737 private native void setWalRecoveryMode(final long handle,
1738 final byte walRecoveryMode);
1739 private native byte walRecoveryMode(final long handle);
1740 private native void setAllow2pc(final long handle,
1741 final boolean allow2pc);
1742 private native boolean allow2pc(final long handle);
1743 private native void setRowCache(final long handle,
1744 final long row_cache_handle);
1745 private native void setFailIfOptionsFileError(final long handle,
1746 final boolean failIfOptionsFileError);
1747 private native boolean failIfOptionsFileError(final long handle);
1748 private native void setDumpMallocStats(final long handle,
1749 final boolean dumpMallocStats);
1750 private native boolean dumpMallocStats(final long handle);
1751 private native void setAvoidFlushDuringRecovery(final long handle,
1752 final boolean avoidFlushDuringRecovery);
1753 private native boolean avoidFlushDuringRecovery(final long handle);
1754 private native void setAvoidFlushDuringShutdown(final long handle,
1755 final boolean avoidFlushDuringShutdown);
1756 private native boolean avoidFlushDuringShutdown(final long handle);
1757
1758 // CF native handles
1759 private native void optimizeForSmallDb(final long handle);
1760 private native void optimizeForPointLookup(long handle,
1761 long blockCacheSizeMb);
1762 private native void optimizeLevelStyleCompaction(long handle,
1763 long memtableMemoryBudget);
1764 private native void optimizeUniversalStyleCompaction(long handle,
1765 long memtableMemoryBudget);
1766 private native void setComparatorHandle(long handle, int builtinComparator);
1767 private native void setComparatorHandle(long optHandle,
1768 long comparatorHandle, byte comparatorType);
1769 private native void setMergeOperatorName(
1770 long handle, String name);
1771 private native void setMergeOperator(
1772 long handle, long mergeOperatorHandle);
1773 private native void setWriteBufferSize(long handle, long writeBufferSize)
1774 throws IllegalArgumentException;
1775 private native long writeBufferSize(long handle);
1776 private native void setMaxWriteBufferNumber(
1777 long handle, int maxWriteBufferNumber);
1778 private native int maxWriteBufferNumber(long handle);
1779 private native void setMinWriteBufferNumberToMerge(
1780 long handle, int minWriteBufferNumberToMerge);
1781 private native int minWriteBufferNumberToMerge(long handle);
1782 private native void setCompressionType(long handle, byte compressionType);
1783 private native byte compressionType(long handle);
1784 private native void setCompressionPerLevel(long handle,
1785 byte[] compressionLevels);
1786 private native byte[] compressionPerLevel(long handle);
1787 private native void setBottommostCompressionType(long handle,
1788 byte bottommostCompressionType);
1789 private native byte bottommostCompressionType(long handle);
1790 private native void setCompressionOptions(long handle,
1791 long compressionOptionsHandle);
1792 private native void useFixedLengthPrefixExtractor(
1793 long handle, int prefixLength);
1794 private native void useCappedPrefixExtractor(
1795 long handle, int prefixLength);
1796 private native void setNumLevels(
1797 long handle, int numLevels);
1798 private native int numLevels(long handle);
1799 private native void setLevelZeroFileNumCompactionTrigger(
1800 long handle, int numFiles);
1801 private native int levelZeroFileNumCompactionTrigger(long handle);
1802 private native void setLevelZeroSlowdownWritesTrigger(
1803 long handle, int numFiles);
1804 private native int levelZeroSlowdownWritesTrigger(long handle);
1805 private native void setLevelZeroStopWritesTrigger(
1806 long handle, int numFiles);
1807 private native int levelZeroStopWritesTrigger(long handle);
1808 private native void setTargetFileSizeBase(
1809 long handle, long targetFileSizeBase);
1810 private native long targetFileSizeBase(long handle);
1811 private native void setTargetFileSizeMultiplier(
1812 long handle, int multiplier);
1813 private native int targetFileSizeMultiplier(long handle);
1814 private native void setMaxBytesForLevelBase(
1815 long handle, long maxBytesForLevelBase);
1816 private native long maxBytesForLevelBase(long handle);
1817 private native void setLevelCompactionDynamicLevelBytes(
1818 long handle, boolean enableLevelCompactionDynamicLevelBytes);
1819 private native boolean levelCompactionDynamicLevelBytes(
1820 long handle);
1821 private native void setMaxBytesForLevelMultiplier(long handle, double multiplier);
1822 private native double maxBytesForLevelMultiplier(long handle);
1823 private native void setMaxCompactionBytes(long handle, long maxCompactionBytes);
1824 private native long maxCompactionBytes(long handle);
1825 private native void setArenaBlockSize(
1826 long handle, long arenaBlockSize) throws IllegalArgumentException;
1827 private native long arenaBlockSize(long handle);
1828 private native void setDisableAutoCompactions(
1829 long handle, boolean disableAutoCompactions);
1830 private native boolean disableAutoCompactions(long handle);
1831 private native void setCompactionStyle(long handle, byte compactionStyle);
1832 private native byte compactionStyle(long handle);
1833 private native void setMaxSequentialSkipInIterations(
1834 long handle, long maxSequentialSkipInIterations);
1835 private native long maxSequentialSkipInIterations(long handle);
1836 private native void setMemTableFactory(long handle, long factoryHandle);
1837 private native String memTableFactoryName(long handle);
1838 private native void setTableFactory(long handle, long factoryHandle);
1839 private native String tableFactoryName(long handle);
1840 private native void setInplaceUpdateSupport(
1841 long handle, boolean inplaceUpdateSupport);
1842 private native boolean inplaceUpdateSupport(long handle);
1843 private native void setInplaceUpdateNumLocks(
1844 long handle, long inplaceUpdateNumLocks)
1845 throws IllegalArgumentException;
1846 private native long inplaceUpdateNumLocks(long handle);
1847 private native void setMemtablePrefixBloomSizeRatio(
1848 long handle, double memtablePrefixBloomSizeRatio);
1849 private native double memtablePrefixBloomSizeRatio(long handle);
1850 private native void setBloomLocality(
1851 long handle, int bloomLocality);
1852 private native int bloomLocality(long handle);
1853 private native void setMaxSuccessiveMerges(
1854 long handle, long maxSuccessiveMerges)
1855 throws IllegalArgumentException;
1856 private native long maxSuccessiveMerges(long handle);
1857 private native void setOptimizeFiltersForHits(long handle,
1858 boolean optimizeFiltersForHits);
1859 private native boolean optimizeFiltersForHits(long handle);
1860 private native void setMemtableHugePageSize(long handle,
1861 long memtableHugePageSize);
1862 private native long memtableHugePageSize(long handle);
1863 private native void setSoftPendingCompactionBytesLimit(long handle,
1864 long softPendingCompactionBytesLimit);
1865 private native long softPendingCompactionBytesLimit(long handle);
1866 private native void setHardPendingCompactionBytesLimit(long handle,
1867 long hardPendingCompactionBytesLimit);
1868 private native long hardPendingCompactionBytesLimit(long handle);
1869 private native void setLevel0FileNumCompactionTrigger(long handle,
1870 int level0FileNumCompactionTrigger);
1871 private native int level0FileNumCompactionTrigger(long handle);
1872 private native void setLevel0SlowdownWritesTrigger(long handle,
1873 int level0SlowdownWritesTrigger);
1874 private native int level0SlowdownWritesTrigger(long handle);
1875 private native void setLevel0StopWritesTrigger(long handle,
1876 int level0StopWritesTrigger);
1877 private native int level0StopWritesTrigger(long handle);
1878 private native void setMaxBytesForLevelMultiplierAdditional(long handle,
1879 int[] maxBytesForLevelMultiplierAdditional);
1880 private native int[] maxBytesForLevelMultiplierAdditional(long handle);
1881 private native void setParanoidFileChecks(long handle,
1882 boolean paranoidFileChecks);
1883 private native boolean paranoidFileChecks(long handle);
1884 private native void setMaxWriteBufferNumberToMaintain(final long handle,
1885 final int maxWriteBufferNumberToMaintain);
1886 private native int maxWriteBufferNumberToMaintain(final long handle);
1887 private native void setCompactionPriority(final long handle,
1888 final byte compactionPriority);
1889 private native byte compactionPriority(final long handle);
1890 private native void setReportBgIoStats(final long handle,
1891 final boolean reportBgIoStats);
1892 private native boolean reportBgIoStats(final long handle);
1893 private native void setCompactionOptionsUniversal(final long handle,
1894 final long compactionOptionsUniversalHandle);
1895 private native void setCompactionOptionsFIFO(final long handle,
1896 final long compactionOptionsFIFOHandle);
1897 private native void setForceConsistencyChecks(final long handle,
1898 final boolean forceConsistencyChecks);
1899 private native boolean forceConsistencyChecks(final long handle);
1900
1901 // instance variables
1902 // NOTE: If you add new member variables, please update the copy constructor above!
1903 private Env env_;
1904 private MemTableConfig memTableConfig_;
1905 private TableFormatConfig tableFormatConfig_;
1906 private RateLimiter rateLimiter_;
1907 private AbstractComparator<? extends AbstractSlice<?>> comparator_;
1908 private CompactionOptionsUniversal compactionOptionsUniversal_;
1909 private CompactionOptionsFIFO compactionOptionsFIFO_;
1910 private CompressionOptions compressionOptions_;
1911 private Cache rowCache_;
1912 }