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