]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/ColumnFamilyOptions.java
import quincy beta 17.1.0
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / ColumnFamilyOptions.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.*;
10
11 /**
12 * ColumnFamilyOptions to control the behavior of a database. It will be used
13 * during the creation of a {@link org.rocksdb.RocksDB} (i.e., RocksDB.open()).
14 *
15 * If {@link #dispose()} function is not called, then it will be GC'd
16 * automatically and native resources will be released as part of the process.
17 */
18 public class ColumnFamilyOptions extends RocksObject
19 implements ColumnFamilyOptionsInterface<ColumnFamilyOptions>,
20 MutableColumnFamilyOptionsInterface<ColumnFamilyOptions> {
21 static {
22 RocksDB.loadLibrary();
23 }
24
25 /**
26 * Construct ColumnFamilyOptions.
27 *
28 * This constructor will create (by allocating a block of memory)
29 * an {@code rocksdb::ColumnFamilyOptions} in the c++ side.
30 */
31 public ColumnFamilyOptions() {
32 super(newColumnFamilyOptions());
33 }
34
35 /**
36 * Copy constructor for ColumnFamilyOptions.
37 *
38 * NOTE: This does a shallow copy, which means comparator, merge_operator, compaction_filter,
39 * compaction_filter_factory and other pointers will be cloned!
40 *
41 * @param other The ColumnFamilyOptions to copy.
42 */
43 public ColumnFamilyOptions(ColumnFamilyOptions other) {
44 super(copyColumnFamilyOptions(other.nativeHandle_));
45 this.memTableConfig_ = other.memTableConfig_;
46 this.tableFormatConfig_ = other.tableFormatConfig_;
47 this.comparator_ = other.comparator_;
48 this.compactionFilter_ = other.compactionFilter_;
49 this.compactionFilterFactory_ = other.compactionFilterFactory_;
50 this.compactionOptionsUniversal_ = other.compactionOptionsUniversal_;
51 this.compactionOptionsFIFO_ = other.compactionOptionsFIFO_;
52 this.bottommostCompressionOptions_ = other.bottommostCompressionOptions_;
53 this.compressionOptions_ = other.compressionOptions_;
54 this.compactionThreadLimiter_ = other.compactionThreadLimiter_;
55 }
56
57 /**
58 * Constructor from Options
59 *
60 * @param options The options.
61 */
62 public ColumnFamilyOptions(final Options options) {
63 super(newColumnFamilyOptionsFromOptions(options.nativeHandle_));
64 }
65
66 /**
67 * <p>Constructor to be used by
68 * {@link #getColumnFamilyOptionsFromProps(java.util.Properties)},
69 * {@link ColumnFamilyDescriptor#getOptions()}
70 * and also called via JNI.</p>
71 *
72 * @param handle native handle to ColumnFamilyOptions instance.
73 */
74 ColumnFamilyOptions(final long handle) {
75 super(handle);
76 }
77
78 /**
79 * <p>Method to get a options instance by using pre-configured
80 * property values. If one or many values are undefined in
81 * the context of RocksDB the method will return a null
82 * value.</p>
83 *
84 * <p><strong>Note</strong>: Property keys can be derived from
85 * getter methods within the options class. Example: the method
86 * {@code writeBufferSize()} has a property key:
87 * {@code write_buffer_size}.</p>
88 *
89 * @param properties {@link java.util.Properties} instance.
90 *
91 * @return {@link org.rocksdb.ColumnFamilyOptions instance}
92 * or null.
93 *
94 * @throws java.lang.IllegalArgumentException if null or empty
95 * {@link Properties} instance is passed to the method call.
96 */
97 public static ColumnFamilyOptions getColumnFamilyOptionsFromProps(
98 final Properties properties) {
99 ColumnFamilyOptions columnFamilyOptions = null;
100 final long handle =
101 getColumnFamilyOptionsFromProps(Options.getOptionStringFromProps(properties));
102 if (handle != 0) {
103 columnFamilyOptions = new ColumnFamilyOptions(handle);
104 }
105 return columnFamilyOptions;
106 }
107
108 /**
109 * <p>Method to get a options instance by using pre-configured
110 * property values. If one or many values are undefined in
111 * the context of RocksDB the method will return a null
112 * value.</p>
113 *
114 * <p><strong>Note</strong>: Property keys can be derived from
115 * getter methods within the options class. Example: the method
116 * {@code writeBufferSize()} has a property key:
117 * {@code write_buffer_size}.</p>
118 *
119 * @param cfgOpts ConfigOptions controlling how the properties are parsed.
120 * @param properties {@link java.util.Properties} instance.
121 *
122 * @return {@link org.rocksdb.ColumnFamilyOptions instance}
123 * or null.
124 *
125 * @throws java.lang.IllegalArgumentException if null or empty
126 * {@link Properties} instance is passed to the method call.
127 */
128 public static ColumnFamilyOptions getColumnFamilyOptionsFromProps(
129 final ConfigOptions cfgOpts, final Properties properties) {
130 ColumnFamilyOptions columnFamilyOptions = null;
131 final long handle = getColumnFamilyOptionsFromProps(
132 cfgOpts.nativeHandle_, Options.getOptionStringFromProps(properties));
133 if (handle != 0){
134 columnFamilyOptions = new ColumnFamilyOptions(handle);
135 }
136 return columnFamilyOptions;
137 }
138
139 @Override
140 public ColumnFamilyOptions oldDefaults(final int majorVersion, final int minorVersion) {
141 oldDefaults(nativeHandle_, majorVersion, minorVersion);
142 return this;
143 }
144
145 @Override
146 public ColumnFamilyOptions optimizeForSmallDb() {
147 optimizeForSmallDb(nativeHandle_);
148 return this;
149 }
150
151 @Override
152 public ColumnFamilyOptions optimizeForSmallDb(final Cache cache) {
153 optimizeForSmallDb(nativeHandle_, cache.getNativeHandle());
154 return this;
155 }
156
157 @Override
158 public ColumnFamilyOptions optimizeForPointLookup(
159 final long blockCacheSizeMb) {
160 optimizeForPointLookup(nativeHandle_,
161 blockCacheSizeMb);
162 return this;
163 }
164
165 @Override
166 public ColumnFamilyOptions optimizeLevelStyleCompaction() {
167 optimizeLevelStyleCompaction(nativeHandle_,
168 DEFAULT_COMPACTION_MEMTABLE_MEMORY_BUDGET);
169 return this;
170 }
171
172 @Override
173 public ColumnFamilyOptions optimizeLevelStyleCompaction(
174 final long memtableMemoryBudget) {
175 optimizeLevelStyleCompaction(nativeHandle_,
176 memtableMemoryBudget);
177 return this;
178 }
179
180 @Override
181 public ColumnFamilyOptions optimizeUniversalStyleCompaction() {
182 optimizeUniversalStyleCompaction(nativeHandle_,
183 DEFAULT_COMPACTION_MEMTABLE_MEMORY_BUDGET);
184 return this;
185 }
186
187 @Override
188 public ColumnFamilyOptions optimizeUniversalStyleCompaction(
189 final long memtableMemoryBudget) {
190 optimizeUniversalStyleCompaction(nativeHandle_,
191 memtableMemoryBudget);
192 return this;
193 }
194
195 @Override
196 public ColumnFamilyOptions setComparator(
197 final BuiltinComparator builtinComparator) {
198 assert(isOwningHandle());
199 setComparatorHandle(nativeHandle_, builtinComparator.ordinal());
200 return this;
201 }
202
203 @Override
204 public ColumnFamilyOptions setComparator(
205 final AbstractComparator comparator) {
206 assert (isOwningHandle());
207 setComparatorHandle(nativeHandle_, comparator.nativeHandle_,
208 comparator.getComparatorType().getValue());
209 comparator_ = comparator;
210 return this;
211 }
212
213 @Override
214 public ColumnFamilyOptions setMergeOperatorName(final String name) {
215 assert (isOwningHandle());
216 if (name == null) {
217 throw new IllegalArgumentException(
218 "Merge operator name must not be null.");
219 }
220 setMergeOperatorName(nativeHandle_, name);
221 return this;
222 }
223
224 @Override
225 public ColumnFamilyOptions setMergeOperator(
226 final MergeOperator mergeOperator) {
227 setMergeOperator(nativeHandle_, mergeOperator.nativeHandle_);
228 return this;
229 }
230
231 @Override
232 public ColumnFamilyOptions setCompactionFilter(
233 final AbstractCompactionFilter<? extends AbstractSlice<?>>
234 compactionFilter) {
235 setCompactionFilterHandle(nativeHandle_, compactionFilter.nativeHandle_);
236 compactionFilter_ = compactionFilter;
237 return this;
238 }
239
240 @Override
241 public AbstractCompactionFilter<? extends AbstractSlice<?>> compactionFilter() {
242 assert (isOwningHandle());
243 return compactionFilter_;
244 }
245
246 @Override
247 public ColumnFamilyOptions setCompactionFilterFactory(final AbstractCompactionFilterFactory<? extends AbstractCompactionFilter<?>> compactionFilterFactory) {
248 assert (isOwningHandle());
249 setCompactionFilterFactoryHandle(nativeHandle_, compactionFilterFactory.nativeHandle_);
250 compactionFilterFactory_ = compactionFilterFactory;
251 return this;
252 }
253
254 @Override
255 public AbstractCompactionFilterFactory<? extends AbstractCompactionFilter<?>> compactionFilterFactory() {
256 assert (isOwningHandle());
257 return compactionFilterFactory_;
258 }
259
260 @Override
261 public ColumnFamilyOptions setWriteBufferSize(final long writeBufferSize) {
262 assert(isOwningHandle());
263 setWriteBufferSize(nativeHandle_, writeBufferSize);
264 return this;
265 }
266
267 @Override
268 public long writeBufferSize() {
269 assert(isOwningHandle());
270 return writeBufferSize(nativeHandle_);
271 }
272
273 @Override
274 public ColumnFamilyOptions setMaxWriteBufferNumber(
275 final int maxWriteBufferNumber) {
276 assert(isOwningHandle());
277 setMaxWriteBufferNumber(nativeHandle_, maxWriteBufferNumber);
278 return this;
279 }
280
281 @Override
282 public int maxWriteBufferNumber() {
283 assert(isOwningHandle());
284 return maxWriteBufferNumber(nativeHandle_);
285 }
286
287 @Override
288 public ColumnFamilyOptions setMinWriteBufferNumberToMerge(
289 final int minWriteBufferNumberToMerge) {
290 setMinWriteBufferNumberToMerge(nativeHandle_, minWriteBufferNumberToMerge);
291 return this;
292 }
293
294 @Override
295 public int minWriteBufferNumberToMerge() {
296 return minWriteBufferNumberToMerge(nativeHandle_);
297 }
298
299 @Override
300 public ColumnFamilyOptions useFixedLengthPrefixExtractor(final int n) {
301 assert(isOwningHandle());
302 useFixedLengthPrefixExtractor(nativeHandle_, n);
303 return this;
304 }
305
306 @Override
307 public ColumnFamilyOptions useCappedPrefixExtractor(final int n) {
308 assert(isOwningHandle());
309 useCappedPrefixExtractor(nativeHandle_, n);
310 return this;
311 }
312
313 @Override
314 public ColumnFamilyOptions setCompressionType(
315 final CompressionType compressionType) {
316 setCompressionType(nativeHandle_, compressionType.getValue());
317 return this;
318 }
319
320 @Override
321 public CompressionType compressionType() {
322 return CompressionType.getCompressionType(compressionType(nativeHandle_));
323 }
324
325 @Override
326 public ColumnFamilyOptions setCompressionPerLevel(
327 final List<CompressionType> compressionLevels) {
328 final byte[] byteCompressionTypes = new byte[
329 compressionLevels.size()];
330 for (int i = 0; i < compressionLevels.size(); i++) {
331 byteCompressionTypes[i] = compressionLevels.get(i).getValue();
332 }
333 setCompressionPerLevel(nativeHandle_, byteCompressionTypes);
334 return this;
335 }
336
337 @Override
338 public List<CompressionType> compressionPerLevel() {
339 final byte[] byteCompressionTypes =
340 compressionPerLevel(nativeHandle_);
341 final List<CompressionType> compressionLevels = new ArrayList<>();
342 for (final Byte byteCompressionType : byteCompressionTypes) {
343 compressionLevels.add(CompressionType.getCompressionType(
344 byteCompressionType));
345 }
346 return compressionLevels;
347 }
348
349 @Override
350 public ColumnFamilyOptions setBottommostCompressionType(
351 final CompressionType bottommostCompressionType) {
352 setBottommostCompressionType(nativeHandle_,
353 bottommostCompressionType.getValue());
354 return this;
355 }
356
357 @Override
358 public CompressionType bottommostCompressionType() {
359 return CompressionType.getCompressionType(
360 bottommostCompressionType(nativeHandle_));
361 }
362
363 @Override
364 public ColumnFamilyOptions setBottommostCompressionOptions(
365 final CompressionOptions bottommostCompressionOptions) {
366 setBottommostCompressionOptions(nativeHandle_,
367 bottommostCompressionOptions.nativeHandle_);
368 this.bottommostCompressionOptions_ = bottommostCompressionOptions;
369 return this;
370 }
371
372 @Override
373 public CompressionOptions bottommostCompressionOptions() {
374 return this.bottommostCompressionOptions_;
375 }
376
377 @Override
378 public ColumnFamilyOptions setCompressionOptions(
379 final CompressionOptions compressionOptions) {
380 setCompressionOptions(nativeHandle_, compressionOptions.nativeHandle_);
381 this.compressionOptions_ = compressionOptions;
382 return this;
383 }
384
385 @Override
386 public CompressionOptions compressionOptions() {
387 return this.compressionOptions_;
388 }
389
390 @Override
391 public ColumnFamilyOptions setNumLevels(final int numLevels) {
392 setNumLevels(nativeHandle_, numLevels);
393 return this;
394 }
395
396 @Override
397 public int numLevels() {
398 return numLevels(nativeHandle_);
399 }
400
401 @Override
402 public ColumnFamilyOptions setLevelZeroFileNumCompactionTrigger(
403 final int numFiles) {
404 setLevelZeroFileNumCompactionTrigger(
405 nativeHandle_, numFiles);
406 return this;
407 }
408
409 @Override
410 public int levelZeroFileNumCompactionTrigger() {
411 return levelZeroFileNumCompactionTrigger(nativeHandle_);
412 }
413
414 @Override
415 public ColumnFamilyOptions setLevelZeroSlowdownWritesTrigger(
416 final int numFiles) {
417 setLevelZeroSlowdownWritesTrigger(nativeHandle_, numFiles);
418 return this;
419 }
420
421 @Override
422 public int levelZeroSlowdownWritesTrigger() {
423 return levelZeroSlowdownWritesTrigger(nativeHandle_);
424 }
425
426 @Override
427 public ColumnFamilyOptions setLevelZeroStopWritesTrigger(final int numFiles) {
428 setLevelZeroStopWritesTrigger(nativeHandle_, numFiles);
429 return this;
430 }
431
432 @Override
433 public int levelZeroStopWritesTrigger() {
434 return levelZeroStopWritesTrigger(nativeHandle_);
435 }
436
437 @Override
438 public ColumnFamilyOptions setTargetFileSizeBase(
439 final long targetFileSizeBase) {
440 setTargetFileSizeBase(nativeHandle_, targetFileSizeBase);
441 return this;
442 }
443
444 @Override
445 public long targetFileSizeBase() {
446 return targetFileSizeBase(nativeHandle_);
447 }
448
449 @Override
450 public ColumnFamilyOptions setTargetFileSizeMultiplier(
451 final int multiplier) {
452 setTargetFileSizeMultiplier(nativeHandle_, multiplier);
453 return this;
454 }
455
456 @Override
457 public int targetFileSizeMultiplier() {
458 return targetFileSizeMultiplier(nativeHandle_);
459 }
460
461 @Override
462 public ColumnFamilyOptions setMaxBytesForLevelBase(
463 final long maxBytesForLevelBase) {
464 setMaxBytesForLevelBase(nativeHandle_, maxBytesForLevelBase);
465 return this;
466 }
467
468 @Override
469 public long maxBytesForLevelBase() {
470 return maxBytesForLevelBase(nativeHandle_);
471 }
472
473 @Override
474 public ColumnFamilyOptions setLevelCompactionDynamicLevelBytes(
475 final boolean enableLevelCompactionDynamicLevelBytes) {
476 setLevelCompactionDynamicLevelBytes(nativeHandle_,
477 enableLevelCompactionDynamicLevelBytes);
478 return this;
479 }
480
481 @Override
482 public boolean levelCompactionDynamicLevelBytes() {
483 return levelCompactionDynamicLevelBytes(nativeHandle_);
484 }
485
486 @Override
487 public ColumnFamilyOptions setMaxBytesForLevelMultiplier(final double multiplier) {
488 setMaxBytesForLevelMultiplier(nativeHandle_, multiplier);
489 return this;
490 }
491
492 @Override
493 public double maxBytesForLevelMultiplier() {
494 return maxBytesForLevelMultiplier(nativeHandle_);
495 }
496
497 @Override
498 public ColumnFamilyOptions setMaxCompactionBytes(final long maxCompactionBytes) {
499 setMaxCompactionBytes(nativeHandle_, maxCompactionBytes);
500 return this;
501 }
502
503 @Override
504 public long maxCompactionBytes() {
505 return maxCompactionBytes(nativeHandle_);
506 }
507
508 @Override
509 public ColumnFamilyOptions setArenaBlockSize(
510 final long arenaBlockSize) {
511 setArenaBlockSize(nativeHandle_, arenaBlockSize);
512 return this;
513 }
514
515 @Override
516 public long arenaBlockSize() {
517 return arenaBlockSize(nativeHandle_);
518 }
519
520 @Override
521 public ColumnFamilyOptions setDisableAutoCompactions(
522 final boolean disableAutoCompactions) {
523 setDisableAutoCompactions(nativeHandle_, disableAutoCompactions);
524 return this;
525 }
526
527 @Override
528 public boolean disableAutoCompactions() {
529 return disableAutoCompactions(nativeHandle_);
530 }
531
532 @Override
533 public ColumnFamilyOptions setCompactionStyle(
534 final CompactionStyle compactionStyle) {
535 setCompactionStyle(nativeHandle_, compactionStyle.getValue());
536 return this;
537 }
538
539 @Override
540 public CompactionStyle compactionStyle() {
541 return CompactionStyle.fromValue(compactionStyle(nativeHandle_));
542 }
543
544 @Override
545 public ColumnFamilyOptions setMaxTableFilesSizeFIFO(
546 final long maxTableFilesSize) {
547 assert(maxTableFilesSize > 0); // unsigned native type
548 assert(isOwningHandle());
549 setMaxTableFilesSizeFIFO(nativeHandle_, maxTableFilesSize);
550 return this;
551 }
552
553 @Override
554 public long maxTableFilesSizeFIFO() {
555 return maxTableFilesSizeFIFO(nativeHandle_);
556 }
557
558 @Override
559 public ColumnFamilyOptions setMaxSequentialSkipInIterations(
560 final long maxSequentialSkipInIterations) {
561 setMaxSequentialSkipInIterations(nativeHandle_,
562 maxSequentialSkipInIterations);
563 return this;
564 }
565
566 @Override
567 public long maxSequentialSkipInIterations() {
568 return maxSequentialSkipInIterations(nativeHandle_);
569 }
570
571 @Override
572 public MemTableConfig memTableConfig() {
573 return this.memTableConfig_;
574 }
575
576 @Override
577 public ColumnFamilyOptions setMemTableConfig(
578 final MemTableConfig memTableConfig) {
579 setMemTableFactory(
580 nativeHandle_, memTableConfig.newMemTableFactoryHandle());
581 this.memTableConfig_ = memTableConfig;
582 return this;
583 }
584
585 @Override
586 public String memTableFactoryName() {
587 assert(isOwningHandle());
588 return memTableFactoryName(nativeHandle_);
589 }
590
591 @Override
592 public TableFormatConfig tableFormatConfig() {
593 return this.tableFormatConfig_;
594 }
595
596 @Override
597 public ColumnFamilyOptions setTableFormatConfig(
598 final TableFormatConfig tableFormatConfig) {
599 setTableFactory(nativeHandle_, tableFormatConfig.newTableFactoryHandle());
600 this.tableFormatConfig_ = tableFormatConfig;
601 return this;
602 }
603
604 @Override
605 public String tableFactoryName() {
606 assert(isOwningHandle());
607 return tableFactoryName(nativeHandle_);
608 }
609
610 @Override
611 public ColumnFamilyOptions setCfPaths(final Collection<DbPath> cfPaths) {
612 assert (isOwningHandle());
613
614 final int len = cfPaths.size();
615 final String paths[] = new String[len];
616 final long targetSizes[] = new long[len];
617
618 int i = 0;
619 for (final DbPath dbPath : cfPaths) {
620 paths[i] = dbPath.path.toString();
621 targetSizes[i] = dbPath.targetSize;
622 i++;
623 }
624 setCfPaths(nativeHandle_, paths, targetSizes);
625 return this;
626 }
627
628 @Override
629 public List<DbPath> cfPaths() {
630 final int len = (int) cfPathsLen(nativeHandle_);
631
632 if (len == 0) {
633 return Collections.emptyList();
634 }
635
636 final String paths[] = new String[len];
637 final long targetSizes[] = new long[len];
638
639 cfPaths(nativeHandle_, paths, targetSizes);
640
641 final List<DbPath> cfPaths = new ArrayList<>();
642 for (int i = 0; i < len; i++) {
643 cfPaths.add(new DbPath(Paths.get(paths[i]), targetSizes[i]));
644 }
645
646 return cfPaths;
647 }
648
649 @Override
650 public ColumnFamilyOptions setInplaceUpdateSupport(
651 final boolean inplaceUpdateSupport) {
652 setInplaceUpdateSupport(nativeHandle_, inplaceUpdateSupport);
653 return this;
654 }
655
656 @Override
657 public boolean inplaceUpdateSupport() {
658 return inplaceUpdateSupport(nativeHandle_);
659 }
660
661 @Override
662 public ColumnFamilyOptions setInplaceUpdateNumLocks(
663 final long inplaceUpdateNumLocks) {
664 setInplaceUpdateNumLocks(nativeHandle_, inplaceUpdateNumLocks);
665 return this;
666 }
667
668 @Override
669 public long inplaceUpdateNumLocks() {
670 return inplaceUpdateNumLocks(nativeHandle_);
671 }
672
673 @Override
674 public ColumnFamilyOptions setMemtablePrefixBloomSizeRatio(
675 final double memtablePrefixBloomSizeRatio) {
676 setMemtablePrefixBloomSizeRatio(nativeHandle_, memtablePrefixBloomSizeRatio);
677 return this;
678 }
679
680 @Override
681 public double memtablePrefixBloomSizeRatio() {
682 return memtablePrefixBloomSizeRatio(nativeHandle_);
683 }
684
685 @Override
686 public ColumnFamilyOptions setBloomLocality(int bloomLocality) {
687 setBloomLocality(nativeHandle_, bloomLocality);
688 return this;
689 }
690
691 @Override
692 public int bloomLocality() {
693 return bloomLocality(nativeHandle_);
694 }
695
696 @Override
697 public ColumnFamilyOptions setMaxSuccessiveMerges(
698 final long maxSuccessiveMerges) {
699 setMaxSuccessiveMerges(nativeHandle_, maxSuccessiveMerges);
700 return this;
701 }
702
703 @Override
704 public long maxSuccessiveMerges() {
705 return maxSuccessiveMerges(nativeHandle_);
706 }
707
708 @Override
709 public ColumnFamilyOptions setOptimizeFiltersForHits(
710 final boolean optimizeFiltersForHits) {
711 setOptimizeFiltersForHits(nativeHandle_, optimizeFiltersForHits);
712 return this;
713 }
714
715 @Override
716 public boolean optimizeFiltersForHits() {
717 return optimizeFiltersForHits(nativeHandle_);
718 }
719
720 @Override
721 public ColumnFamilyOptions
722 setMemtableHugePageSize(
723 long memtableHugePageSize) {
724 setMemtableHugePageSize(nativeHandle_,
725 memtableHugePageSize);
726 return this;
727 }
728
729 @Override
730 public long memtableHugePageSize() {
731 return memtableHugePageSize(nativeHandle_);
732 }
733
734 @Override
735 public ColumnFamilyOptions setSoftPendingCompactionBytesLimit(long softPendingCompactionBytesLimit) {
736 setSoftPendingCompactionBytesLimit(nativeHandle_,
737 softPendingCompactionBytesLimit);
738 return this;
739 }
740
741 @Override
742 public long softPendingCompactionBytesLimit() {
743 return softPendingCompactionBytesLimit(nativeHandle_);
744 }
745
746 @Override
747 public ColumnFamilyOptions setHardPendingCompactionBytesLimit(long hardPendingCompactionBytesLimit) {
748 setHardPendingCompactionBytesLimit(nativeHandle_, hardPendingCompactionBytesLimit);
749 return this;
750 }
751
752 @Override
753 public long hardPendingCompactionBytesLimit() {
754 return hardPendingCompactionBytesLimit(nativeHandle_);
755 }
756
757 @Override
758 public ColumnFamilyOptions setLevel0FileNumCompactionTrigger(int level0FileNumCompactionTrigger) {
759 setLevel0FileNumCompactionTrigger(nativeHandle_, level0FileNumCompactionTrigger);
760 return this;
761 }
762
763 @Override
764 public int level0FileNumCompactionTrigger() {
765 return level0FileNumCompactionTrigger(nativeHandle_);
766 }
767
768 @Override
769 public ColumnFamilyOptions setLevel0SlowdownWritesTrigger(int level0SlowdownWritesTrigger) {
770 setLevel0SlowdownWritesTrigger(nativeHandle_, level0SlowdownWritesTrigger);
771 return this;
772 }
773
774 @Override
775 public int level0SlowdownWritesTrigger() {
776 return level0SlowdownWritesTrigger(nativeHandle_);
777 }
778
779 @Override
780 public ColumnFamilyOptions setLevel0StopWritesTrigger(int level0StopWritesTrigger) {
781 setLevel0StopWritesTrigger(nativeHandle_, level0StopWritesTrigger);
782 return this;
783 }
784
785 @Override
786 public int level0StopWritesTrigger() {
787 return level0StopWritesTrigger(nativeHandle_);
788 }
789
790 @Override
791 public ColumnFamilyOptions setMaxBytesForLevelMultiplierAdditional(int[] maxBytesForLevelMultiplierAdditional) {
792 setMaxBytesForLevelMultiplierAdditional(nativeHandle_, maxBytesForLevelMultiplierAdditional);
793 return this;
794 }
795
796 @Override
797 public int[] maxBytesForLevelMultiplierAdditional() {
798 return maxBytesForLevelMultiplierAdditional(nativeHandle_);
799 }
800
801 @Override
802 public ColumnFamilyOptions setParanoidFileChecks(boolean paranoidFileChecks) {
803 setParanoidFileChecks(nativeHandle_, paranoidFileChecks);
804 return this;
805 }
806
807 @Override
808 public boolean paranoidFileChecks() {
809 return paranoidFileChecks(nativeHandle_);
810 }
811
812 @Override
813 public ColumnFamilyOptions setMaxWriteBufferNumberToMaintain(
814 final int maxWriteBufferNumberToMaintain) {
815 setMaxWriteBufferNumberToMaintain(
816 nativeHandle_, maxWriteBufferNumberToMaintain);
817 return this;
818 }
819
820 @Override
821 public int maxWriteBufferNumberToMaintain() {
822 return maxWriteBufferNumberToMaintain(nativeHandle_);
823 }
824
825 @Override
826 public ColumnFamilyOptions setCompactionPriority(
827 final CompactionPriority compactionPriority) {
828 setCompactionPriority(nativeHandle_, compactionPriority.getValue());
829 return this;
830 }
831
832 @Override
833 public CompactionPriority compactionPriority() {
834 return CompactionPriority.getCompactionPriority(
835 compactionPriority(nativeHandle_));
836 }
837
838 @Override
839 public ColumnFamilyOptions setReportBgIoStats(final boolean reportBgIoStats) {
840 setReportBgIoStats(nativeHandle_, reportBgIoStats);
841 return this;
842 }
843
844 @Override
845 public boolean reportBgIoStats() {
846 return reportBgIoStats(nativeHandle_);
847 }
848
849 @Override
850 public ColumnFamilyOptions setTtl(final long ttl) {
851 setTtl(nativeHandle_, ttl);
852 return this;
853 }
854
855 @Override
856 public long ttl() {
857 return ttl(nativeHandle_);
858 }
859
860 @Override
861 public ColumnFamilyOptions setCompactionOptionsUniversal(
862 final CompactionOptionsUniversal compactionOptionsUniversal) {
863 setCompactionOptionsUniversal(nativeHandle_,
864 compactionOptionsUniversal.nativeHandle_);
865 this.compactionOptionsUniversal_ = compactionOptionsUniversal;
866 return this;
867 }
868
869 @Override
870 public CompactionOptionsUniversal compactionOptionsUniversal() {
871 return this.compactionOptionsUniversal_;
872 }
873
874 @Override
875 public ColumnFamilyOptions setCompactionOptionsFIFO(final CompactionOptionsFIFO compactionOptionsFIFO) {
876 setCompactionOptionsFIFO(nativeHandle_,
877 compactionOptionsFIFO.nativeHandle_);
878 this.compactionOptionsFIFO_ = compactionOptionsFIFO;
879 return this;
880 }
881
882 @Override
883 public CompactionOptionsFIFO compactionOptionsFIFO() {
884 return this.compactionOptionsFIFO_;
885 }
886
887 @Override
888 public ColumnFamilyOptions setForceConsistencyChecks(final boolean forceConsistencyChecks) {
889 setForceConsistencyChecks(nativeHandle_, forceConsistencyChecks);
890 return this;
891 }
892
893 @Override
894 public boolean forceConsistencyChecks() {
895 return forceConsistencyChecks(nativeHandle_);
896 }
897
898 @Override
899 public ColumnFamilyOptions setSstPartitionerFactory(SstPartitionerFactory sstPartitionerFactory) {
900 setSstPartitionerFactory(nativeHandle_, sstPartitionerFactory.nativeHandle_);
901 this.sstPartitionerFactory_ = sstPartitionerFactory;
902 return this;
903 }
904
905 @Override
906 public ColumnFamilyOptions setCompactionThreadLimiter(
907 final ConcurrentTaskLimiter compactionThreadLimiter) {
908 setCompactionThreadLimiter(nativeHandle_, compactionThreadLimiter.nativeHandle_);
909 this.compactionThreadLimiter_ = compactionThreadLimiter;
910 return this;
911 }
912
913 @Override
914 public ConcurrentTaskLimiter compactionThreadLimiter() {
915 assert (isOwningHandle());
916 return this.compactionThreadLimiter_;
917 }
918
919 @Override
920 public SstPartitionerFactory sstPartitionerFactory() {
921 return sstPartitionerFactory_;
922 }
923
924 private static native long getColumnFamilyOptionsFromProps(
925 final long cfgHandle, String optString);
926 private static native long getColumnFamilyOptionsFromProps(final String optString);
927
928 private static native long newColumnFamilyOptions();
929 private static native long copyColumnFamilyOptions(final long handle);
930 private static native long newColumnFamilyOptionsFromOptions(
931 final long optionsHandle);
932 @Override protected final native void disposeInternal(final long handle);
933
934 private static native void oldDefaults(
935 final long handle, final int majorVersion, final int minorVersion);
936 private native void optimizeForSmallDb(final long handle);
937 private static native void optimizeForSmallDb(final long handle, final long cacheHandle);
938 private native void optimizeForPointLookup(long handle,
939 long blockCacheSizeMb);
940 private native void optimizeLevelStyleCompaction(long handle,
941 long memtableMemoryBudget);
942 private native void optimizeUniversalStyleCompaction(long handle,
943 long memtableMemoryBudget);
944 private native void setComparatorHandle(long handle, int builtinComparator);
945 private native void setComparatorHandle(long optHandle,
946 long comparatorHandle, byte comparatorType);
947 private native void setMergeOperatorName(long handle, String name);
948 private native void setMergeOperator(long handle, long mergeOperatorHandle);
949 private native void setCompactionFilterHandle(long handle,
950 long compactionFilterHandle);
951 private native void setCompactionFilterFactoryHandle(long handle,
952 long compactionFilterFactoryHandle);
953 private native void setWriteBufferSize(long handle, long writeBufferSize)
954 throws IllegalArgumentException;
955 private native long writeBufferSize(long handle);
956 private native void setMaxWriteBufferNumber(
957 long handle, int maxWriteBufferNumber);
958 private native int maxWriteBufferNumber(long handle);
959 private native void setMinWriteBufferNumberToMerge(
960 long handle, int minWriteBufferNumberToMerge);
961 private native int minWriteBufferNumberToMerge(long handle);
962 private native void setCompressionType(long handle, byte compressionType);
963 private native byte compressionType(long handle);
964 private native void setCompressionPerLevel(long handle,
965 byte[] compressionLevels);
966 private native byte[] compressionPerLevel(long handle);
967 private native void setBottommostCompressionType(long handle,
968 byte bottommostCompressionType);
969 private native byte bottommostCompressionType(long handle);
970 private native void setBottommostCompressionOptions(final long handle,
971 final long bottommostCompressionOptionsHandle);
972 private native void setCompressionOptions(long handle,
973 long compressionOptionsHandle);
974 private native void useFixedLengthPrefixExtractor(
975 long handle, int prefixLength);
976 private native void useCappedPrefixExtractor(
977 long handle, int prefixLength);
978 private native void setNumLevels(
979 long handle, int numLevels);
980 private native int numLevels(long handle);
981 private native void setLevelZeroFileNumCompactionTrigger(
982 long handle, int numFiles);
983 private native int levelZeroFileNumCompactionTrigger(long handle);
984 private native void setLevelZeroSlowdownWritesTrigger(
985 long handle, int numFiles);
986 private native int levelZeroSlowdownWritesTrigger(long handle);
987 private native void setLevelZeroStopWritesTrigger(
988 long handle, int numFiles);
989 private native int levelZeroStopWritesTrigger(long handle);
990 private native void setTargetFileSizeBase(
991 long handle, long targetFileSizeBase);
992 private native long targetFileSizeBase(long handle);
993 private native void setTargetFileSizeMultiplier(
994 long handle, int multiplier);
995 private native int targetFileSizeMultiplier(long handle);
996 private native void setMaxBytesForLevelBase(
997 long handle, long maxBytesForLevelBase);
998 private native long maxBytesForLevelBase(long handle);
999 private native void setLevelCompactionDynamicLevelBytes(
1000 long handle, boolean enableLevelCompactionDynamicLevelBytes);
1001 private native boolean levelCompactionDynamicLevelBytes(
1002 long handle);
1003 private native void setMaxBytesForLevelMultiplier(long handle, double multiplier);
1004 private native double maxBytesForLevelMultiplier(long handle);
1005 private native void setMaxCompactionBytes(long handle, long maxCompactionBytes);
1006 private native long maxCompactionBytes(long handle);
1007 private native void setArenaBlockSize(
1008 long handle, long arenaBlockSize)
1009 throws IllegalArgumentException;
1010 private native long arenaBlockSize(long handle);
1011 private native void setDisableAutoCompactions(
1012 long handle, boolean disableAutoCompactions);
1013 private native boolean disableAutoCompactions(long handle);
1014 private native void setCompactionStyle(long handle, byte compactionStyle);
1015 private native byte compactionStyle(long handle);
1016 private native void setMaxTableFilesSizeFIFO(
1017 long handle, long max_table_files_size);
1018 private native long maxTableFilesSizeFIFO(long handle);
1019 private native void setMaxSequentialSkipInIterations(
1020 long handle, long maxSequentialSkipInIterations);
1021 private native long maxSequentialSkipInIterations(long handle);
1022 private native void setMemTableFactory(long handle, long factoryHandle);
1023 private native String memTableFactoryName(long handle);
1024 private native void setTableFactory(long handle, long factoryHandle);
1025 private native String tableFactoryName(long handle);
1026 private static native void setCfPaths(
1027 final long handle, final String[] paths, final long[] targetSizes);
1028 private static native long cfPathsLen(final long handle);
1029 private static native void cfPaths(
1030 final long handle, final String[] paths, final long[] targetSizes);
1031 private native void setInplaceUpdateSupport(
1032 long handle, boolean inplaceUpdateSupport);
1033 private native boolean inplaceUpdateSupport(long handle);
1034 private native void setInplaceUpdateNumLocks(
1035 long handle, long inplaceUpdateNumLocks)
1036 throws IllegalArgumentException;
1037 private native long inplaceUpdateNumLocks(long handle);
1038 private native void setMemtablePrefixBloomSizeRatio(
1039 long handle, double memtablePrefixBloomSizeRatio);
1040 private native double memtablePrefixBloomSizeRatio(long handle);
1041 private native void setBloomLocality(
1042 long handle, int bloomLocality);
1043 private native int bloomLocality(long handle);
1044 private native void setMaxSuccessiveMerges(
1045 long handle, long maxSuccessiveMerges)
1046 throws IllegalArgumentException;
1047 private native long maxSuccessiveMerges(long handle);
1048 private native void setOptimizeFiltersForHits(long handle,
1049 boolean optimizeFiltersForHits);
1050 private native boolean optimizeFiltersForHits(long handle);
1051 private native void setMemtableHugePageSize(long handle,
1052 long memtableHugePageSize);
1053 private native long memtableHugePageSize(long handle);
1054 private native void setSoftPendingCompactionBytesLimit(long handle,
1055 long softPendingCompactionBytesLimit);
1056 private native long softPendingCompactionBytesLimit(long handle);
1057 private native void setHardPendingCompactionBytesLimit(long handle,
1058 long hardPendingCompactionBytesLimit);
1059 private native long hardPendingCompactionBytesLimit(long handle);
1060 private native void setLevel0FileNumCompactionTrigger(long handle,
1061 int level0FileNumCompactionTrigger);
1062 private native int level0FileNumCompactionTrigger(long handle);
1063 private native void setLevel0SlowdownWritesTrigger(long handle,
1064 int level0SlowdownWritesTrigger);
1065 private native int level0SlowdownWritesTrigger(long handle);
1066 private native void setLevel0StopWritesTrigger(long handle,
1067 int level0StopWritesTrigger);
1068 private native int level0StopWritesTrigger(long handle);
1069 private native void setMaxBytesForLevelMultiplierAdditional(long handle,
1070 int[] maxBytesForLevelMultiplierAdditional);
1071 private native int[] maxBytesForLevelMultiplierAdditional(long handle);
1072 private native void setParanoidFileChecks(long handle,
1073 boolean paranoidFileChecks);
1074 private native boolean paranoidFileChecks(long handle);
1075 private native void setMaxWriteBufferNumberToMaintain(final long handle,
1076 final int maxWriteBufferNumberToMaintain);
1077 private native int maxWriteBufferNumberToMaintain(final long handle);
1078 private native void setCompactionPriority(final long handle,
1079 final byte compactionPriority);
1080 private native byte compactionPriority(final long handle);
1081 private native void setReportBgIoStats(final long handle,
1082 final boolean reportBgIoStats);
1083 private native boolean reportBgIoStats(final long handle);
1084 private native void setTtl(final long handle, final long ttl);
1085 private native long ttl(final long handle);
1086 private native void setCompactionOptionsUniversal(final long handle,
1087 final long compactionOptionsUniversalHandle);
1088 private native void setCompactionOptionsFIFO(final long handle,
1089 final long compactionOptionsFIFOHandle);
1090 private native void setForceConsistencyChecks(final long handle,
1091 final boolean forceConsistencyChecks);
1092 private native boolean forceConsistencyChecks(final long handle);
1093 private native void setSstPartitionerFactory(long nativeHandle_, long newFactoryHandle);
1094 private static native void setCompactionThreadLimiter(
1095 final long nativeHandle_, final long compactionThreadLimiterHandle);
1096
1097 // instance variables
1098 // NOTE: If you add new member variables, please update the copy constructor above!
1099 private MemTableConfig memTableConfig_;
1100 private TableFormatConfig tableFormatConfig_;
1101 private AbstractComparator comparator_;
1102 private AbstractCompactionFilter<? extends AbstractSlice<?>> compactionFilter_;
1103 private AbstractCompactionFilterFactory<? extends AbstractCompactionFilter<?>>
1104 compactionFilterFactory_;
1105 private CompactionOptionsUniversal compactionOptionsUniversal_;
1106 private CompactionOptionsFIFO compactionOptionsFIFO_;
1107 private CompressionOptions bottommostCompressionOptions_;
1108 private CompressionOptions compressionOptions_;
1109 private SstPartitionerFactory sstPartitionerFactory_;
1110 private ConcurrentTaskLimiter compactionThreadLimiter_;
1111 }