]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/MutableColumnFamilyOptions.java
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / MutableColumnFamilyOptions.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.util.*;
9
10 public class MutableColumnFamilyOptions {
11 private final static String KEY_VALUE_PAIR_SEPARATOR = ";";
12 private final static char KEY_VALUE_SEPARATOR = '=';
13 private final static String INT_ARRAY_INT_SEPARATOR = ",";
14
15 private final String[] keys;
16 private final String[] values;
17
18 // user must use builder pattern, or parser
19 private MutableColumnFamilyOptions(final String keys[],
20 final String values[]) {
21 this.keys = keys;
22 this.values = values;
23 }
24
25 String[] getKeys() {
26 return keys;
27 }
28
29 String[] getValues() {
30 return values;
31 }
32
33 /**
34 * Creates a builder which allows you
35 * to set MutableColumnFamilyOptions in a fluent
36 * manner
37 *
38 * @return A builder for MutableColumnFamilyOptions
39 */
40 public static MutableColumnFamilyOptionsBuilder builder() {
41 return new MutableColumnFamilyOptionsBuilder();
42 }
43
44 /**
45 * Parses a String representation of MutableColumnFamilyOptions
46 *
47 * The format is: key1=value1;key2=value2;key3=value3 etc
48 *
49 * For int[] values, each int should be separated by a comma, e.g.
50 *
51 * key1=value1;intArrayKey1=1,2,3
52 *
53 * @param str The string representation of the mutable column family options
54 *
55 * @return A builder for the mutable column family options
56 */
57 public static MutableColumnFamilyOptionsBuilder parse(final String str) {
58 Objects.requireNonNull(str);
59
60 final MutableColumnFamilyOptionsBuilder builder =
61 new MutableColumnFamilyOptionsBuilder();
62
63 final String options[] = str.trim().split(KEY_VALUE_PAIR_SEPARATOR);
64 for(final String option : options) {
65 final int equalsOffset = option.indexOf(KEY_VALUE_SEPARATOR);
66 if(equalsOffset <= 0) {
67 throw new IllegalArgumentException(
68 "options string has an invalid key=value pair");
69 }
70
71 final String key = option.substring(0, equalsOffset);
72 if(key == null || key.isEmpty()) {
73 throw new IllegalArgumentException("options string is invalid");
74 }
75
76 final String value = option.substring(equalsOffset + 1);
77 if(value == null || value.isEmpty()) {
78 throw new IllegalArgumentException("options string is invalid");
79 }
80
81 builder.fromString(key, value);
82 }
83
84 return builder;
85 }
86
87 /**
88 * Returns a string representation
89 * of MutableColumnFamilyOptions which is
90 * suitable for consumption by {@link #parse(String)}
91 *
92 * @return String representation of MutableColumnFamilyOptions
93 */
94 @Override
95 public String toString() {
96 final StringBuilder buffer = new StringBuilder();
97 for(int i = 0; i < keys.length; i++) {
98 buffer
99 .append(keys[i])
100 .append(KEY_VALUE_SEPARATOR)
101 .append(values[i]);
102
103 if(i + 1 < keys.length) {
104 buffer.append(KEY_VALUE_PAIR_SEPARATOR);
105 }
106 }
107 return buffer.toString();
108 }
109
110 public enum ValueType {
111 DOUBLE,
112 LONG,
113 INT,
114 BOOLEAN,
115 INT_ARRAY,
116 ENUM
117 }
118
119 public enum MemtableOption implements MutableColumnFamilyOptionKey {
120 write_buffer_size(ValueType.LONG),
121 arena_block_size(ValueType.LONG),
122 memtable_prefix_bloom_size_ratio(ValueType.DOUBLE),
123 @Deprecated memtable_prefix_bloom_bits(ValueType.INT),
124 @Deprecated memtable_prefix_bloom_probes(ValueType.INT),
125 memtable_huge_page_size(ValueType.LONG),
126 max_successive_merges(ValueType.LONG),
127 @Deprecated filter_deletes(ValueType.BOOLEAN),
128 max_write_buffer_number(ValueType.INT),
129 inplace_update_num_locks(ValueType.LONG);
130
131 private final ValueType valueType;
132 MemtableOption(final ValueType valueType) {
133 this.valueType = valueType;
134 }
135
136 @Override
137 public ValueType getValueType() {
138 return valueType;
139 }
140 }
141
142 public enum CompactionOption implements MutableColumnFamilyOptionKey {
143 disable_auto_compactions(ValueType.BOOLEAN),
144 @Deprecated soft_rate_limit(ValueType.DOUBLE),
145 soft_pending_compaction_bytes_limit(ValueType.LONG),
146 @Deprecated hard_rate_limit(ValueType.DOUBLE),
147 hard_pending_compaction_bytes_limit(ValueType.LONG),
148 level0_file_num_compaction_trigger(ValueType.INT),
149 level0_slowdown_writes_trigger(ValueType.INT),
150 level0_stop_writes_trigger(ValueType.INT),
151 max_compaction_bytes(ValueType.LONG),
152 target_file_size_base(ValueType.LONG),
153 target_file_size_multiplier(ValueType.INT),
154 max_bytes_for_level_base(ValueType.LONG),
155 max_bytes_for_level_multiplier(ValueType.INT),
156 max_bytes_for_level_multiplier_additional(ValueType.INT_ARRAY);
157
158 private final ValueType valueType;
159 CompactionOption(final ValueType valueType) {
160 this.valueType = valueType;
161 }
162
163 @Override
164 public ValueType getValueType() {
165 return valueType;
166 }
167 }
168
169 public enum MiscOption implements MutableColumnFamilyOptionKey {
170 max_sequential_skip_in_iterations(ValueType.LONG),
171 paranoid_file_checks(ValueType.BOOLEAN),
172 report_bg_io_stats(ValueType.BOOLEAN),
173 compression_type(ValueType.ENUM);
174
175 private final ValueType valueType;
176 MiscOption(final ValueType valueType) {
177 this.valueType = valueType;
178 }
179
180 @Override
181 public ValueType getValueType() {
182 return valueType;
183 }
184 }
185
186 private interface MutableColumnFamilyOptionKey {
187 String name();
188 ValueType getValueType();
189 }
190
191 private static abstract class MutableColumnFamilyOptionValue<T> {
192 protected final T value;
193
194 MutableColumnFamilyOptionValue(final T value) {
195 this.value = value;
196 }
197
198 abstract double asDouble() throws NumberFormatException;
199 abstract long asLong() throws NumberFormatException;
200 abstract int asInt() throws NumberFormatException;
201 abstract boolean asBoolean() throws IllegalStateException;
202 abstract int[] asIntArray() throws IllegalStateException;
203 abstract String asString();
204 abstract T asObject();
205 }
206
207 private static class MutableColumnFamilyOptionStringValue
208 extends MutableColumnFamilyOptionValue<String> {
209 MutableColumnFamilyOptionStringValue(final String value) {
210 super(value);
211 }
212
213 @Override
214 double asDouble() throws NumberFormatException {
215 return Double.parseDouble(value);
216 }
217
218 @Override
219 long asLong() throws NumberFormatException {
220 return Long.parseLong(value);
221 }
222
223 @Override
224 int asInt() throws NumberFormatException {
225 return Integer.parseInt(value);
226 }
227
228 @Override
229 boolean asBoolean() throws IllegalStateException {
230 return Boolean.parseBoolean(value);
231 }
232
233 @Override
234 int[] asIntArray() throws IllegalStateException {
235 throw new IllegalStateException("String is not applicable as int[]");
236 }
237
238 @Override
239 String asString() {
240 return value;
241 }
242
243 @Override
244 String asObject() {
245 return value;
246 }
247 }
248
249 private static class MutableColumnFamilyOptionDoubleValue
250 extends MutableColumnFamilyOptionValue<Double> {
251 MutableColumnFamilyOptionDoubleValue(final double value) {
252 super(value);
253 }
254
255 @Override
256 double asDouble() {
257 return value;
258 }
259
260 @Override
261 long asLong() throws NumberFormatException {
262 return value.longValue();
263 }
264
265 @Override
266 int asInt() throws NumberFormatException {
267 if(value > Integer.MAX_VALUE || value < Integer.MIN_VALUE) {
268 throw new NumberFormatException(
269 "double value lies outside the bounds of int");
270 }
271 return value.intValue();
272 }
273
274 @Override
275 boolean asBoolean() throws IllegalStateException {
276 throw new IllegalStateException(
277 "double is not applicable as boolean");
278 }
279
280 @Override
281 int[] asIntArray() throws IllegalStateException {
282 if(value > Integer.MAX_VALUE || value < Integer.MIN_VALUE) {
283 throw new NumberFormatException(
284 "double value lies outside the bounds of int");
285 }
286 return new int[] { value.intValue() };
287 }
288
289 @Override
290 String asString() {
291 return Double.toString(value);
292 }
293
294 @Override
295 Double asObject() {
296 return value;
297 }
298 }
299
300 private static class MutableColumnFamilyOptionLongValue
301 extends MutableColumnFamilyOptionValue<Long> {
302 MutableColumnFamilyOptionLongValue(final long value) {
303 super(value);
304 }
305
306 @Override
307 double asDouble() {
308 if(value > Double.MAX_VALUE || value < Double.MIN_VALUE) {
309 throw new NumberFormatException(
310 "long value lies outside the bounds of int");
311 }
312 return value.doubleValue();
313 }
314
315 @Override
316 long asLong() throws NumberFormatException {
317 return value;
318 }
319
320 @Override
321 int asInt() throws NumberFormatException {
322 if(value > Integer.MAX_VALUE || value < Integer.MIN_VALUE) {
323 throw new NumberFormatException(
324 "long value lies outside the bounds of int");
325 }
326 return value.intValue();
327 }
328
329 @Override
330 boolean asBoolean() throws IllegalStateException {
331 throw new IllegalStateException(
332 "long is not applicable as boolean");
333 }
334
335 @Override
336 int[] asIntArray() throws IllegalStateException {
337 if(value > Integer.MAX_VALUE || value < Integer.MIN_VALUE) {
338 throw new NumberFormatException(
339 "long value lies outside the bounds of int");
340 }
341 return new int[] { value.intValue() };
342 }
343
344 @Override
345 String asString() {
346 return Long.toString(value);
347 }
348
349 @Override
350 Long asObject() {
351 return value;
352 }
353 }
354
355 private static class MutableColumnFamilyOptionIntValue
356 extends MutableColumnFamilyOptionValue<Integer> {
357 MutableColumnFamilyOptionIntValue(final int value) {
358 super(value);
359 }
360
361 @Override
362 double asDouble() {
363 if(value > Double.MAX_VALUE || value < Double.MIN_VALUE) {
364 throw new NumberFormatException("int value lies outside the bounds of int");
365 }
366 return value.doubleValue();
367 }
368
369 @Override
370 long asLong() throws NumberFormatException {
371 return value;
372 }
373
374 @Override
375 int asInt() throws NumberFormatException {
376 return value;
377 }
378
379 @Override
380 boolean asBoolean() throws IllegalStateException {
381 throw new IllegalStateException("int is not applicable as boolean");
382 }
383
384 @Override
385 int[] asIntArray() throws IllegalStateException {
386 return new int[] { value };
387 }
388
389 @Override
390 String asString() {
391 return Integer.toString(value);
392 }
393
394 @Override
395 Integer asObject() {
396 return value;
397 }
398 }
399
400 private static class MutableColumnFamilyOptionBooleanValue
401 extends MutableColumnFamilyOptionValue<Boolean> {
402 MutableColumnFamilyOptionBooleanValue(final boolean value) {
403 super(value);
404 }
405
406 @Override
407 double asDouble() {
408 throw new NumberFormatException("boolean is not applicable as double");
409 }
410
411 @Override
412 long asLong() throws NumberFormatException {
413 throw new NumberFormatException("boolean is not applicable as Long");
414 }
415
416 @Override
417 int asInt() throws NumberFormatException {
418 throw new NumberFormatException("boolean is not applicable as int");
419 }
420
421 @Override
422 boolean asBoolean() {
423 return value;
424 }
425
426 @Override
427 int[] asIntArray() throws IllegalStateException {
428 throw new IllegalStateException("boolean is not applicable as int[]");
429 }
430
431 @Override
432 String asString() {
433 return Boolean.toString(value);
434 }
435
436 @Override
437 Boolean asObject() {
438 return value;
439 }
440 }
441
442 private static class MutableColumnFamilyOptionIntArrayValue
443 extends MutableColumnFamilyOptionValue<int[]> {
444 MutableColumnFamilyOptionIntArrayValue(final int[] value) {
445 super(value);
446 }
447
448 @Override
449 double asDouble() {
450 throw new NumberFormatException("int[] is not applicable as double");
451 }
452
453 @Override
454 long asLong() throws NumberFormatException {
455 throw new NumberFormatException("int[] is not applicable as Long");
456 }
457
458 @Override
459 int asInt() throws NumberFormatException {
460 throw new NumberFormatException("int[] is not applicable as int");
461 }
462
463 @Override
464 boolean asBoolean() {
465 throw new NumberFormatException("int[] is not applicable as boolean");
466 }
467
468 @Override
469 int[] asIntArray() throws IllegalStateException {
470 return value;
471 }
472
473 @Override
474 String asString() {
475 final StringBuilder builder = new StringBuilder();
476 for(int i = 0; i < value.length; i++) {
477 builder.append(Integer.toString(i));
478 if(i + 1 < value.length) {
479 builder.append(INT_ARRAY_INT_SEPARATOR);
480 }
481 }
482 return builder.toString();
483 }
484
485 @Override
486 int[] asObject() {
487 return value;
488 }
489 }
490
491 private static class MutableColumnFamilyOptionEnumValue<T extends Enum<T>>
492 extends MutableColumnFamilyOptionValue<T> {
493
494 MutableColumnFamilyOptionEnumValue(final T value) {
495 super(value);
496 }
497
498 @Override
499 double asDouble() throws NumberFormatException {
500 throw new NumberFormatException("Enum is not applicable as double");
501 }
502
503 @Override
504 long asLong() throws NumberFormatException {
505 throw new NumberFormatException("Enum is not applicable as long");
506 }
507
508 @Override
509 int asInt() throws NumberFormatException {
510 throw new NumberFormatException("Enum is not applicable as int");
511 }
512
513 @Override
514 boolean asBoolean() throws IllegalStateException {
515 throw new NumberFormatException("Enum is not applicable as boolean");
516 }
517
518 @Override
519 int[] asIntArray() throws IllegalStateException {
520 throw new NumberFormatException("Enum is not applicable as int[]");
521 }
522
523 @Override
524 String asString() {
525 return value.name();
526 }
527
528 @Override
529 T asObject() {
530 return value;
531 }
532 }
533
534 public static class MutableColumnFamilyOptionsBuilder
535 implements MutableColumnFamilyOptionsInterface {
536
537 private final static Map<String, MutableColumnFamilyOptionKey> ALL_KEYS_LOOKUP = new HashMap<>();
538 static {
539 for(final MutableColumnFamilyOptionKey key : MemtableOption.values()) {
540 ALL_KEYS_LOOKUP.put(key.name(), key);
541 }
542
543 for(final MutableColumnFamilyOptionKey key : CompactionOption.values()) {
544 ALL_KEYS_LOOKUP.put(key.name(), key);
545 }
546
547 for(final MutableColumnFamilyOptionKey key : MiscOption.values()) {
548 ALL_KEYS_LOOKUP.put(key.name(), key);
549 }
550 }
551
552 private final Map<MutableColumnFamilyOptionKey, MutableColumnFamilyOptionValue<?>> options = new LinkedHashMap<>();
553
554 public MutableColumnFamilyOptions build() {
555 final String keys[] = new String[options.size()];
556 final String values[] = new String[options.size()];
557
558 int i = 0;
559 for(final Map.Entry<MutableColumnFamilyOptionKey, MutableColumnFamilyOptionValue<?>> option : options.entrySet()) {
560 keys[i] = option.getKey().name();
561 values[i] = option.getValue().asString();
562 i++;
563 }
564
565 return new MutableColumnFamilyOptions(keys, values);
566 }
567
568 private MutableColumnFamilyOptionsBuilder setDouble(
569 final MutableColumnFamilyOptionKey key, final double value) {
570 if(key.getValueType() != ValueType.DOUBLE) {
571 throw new IllegalArgumentException(
572 key + " does not accept a double value");
573 }
574 options.put(key, new MutableColumnFamilyOptionDoubleValue(value));
575 return this;
576 }
577
578 private double getDouble(final MutableColumnFamilyOptionKey key)
579 throws NoSuchElementException, NumberFormatException {
580 final MutableColumnFamilyOptionValue<?> value = options.get(key);
581 if(value == null) {
582 throw new NoSuchElementException(key.name() + " has not been set");
583 }
584 return value.asDouble();
585 }
586
587 private MutableColumnFamilyOptionsBuilder setLong(
588 final MutableColumnFamilyOptionKey key, final long value) {
589 if(key.getValueType() != ValueType.LONG) {
590 throw new IllegalArgumentException(
591 key + " does not accept a long value");
592 }
593 options.put(key, new MutableColumnFamilyOptionLongValue(value));
594 return this;
595 }
596
597 private long getLong(final MutableColumnFamilyOptionKey key)
598 throws NoSuchElementException, NumberFormatException {
599 final MutableColumnFamilyOptionValue<?> value = options.get(key);
600 if(value == null) {
601 throw new NoSuchElementException(key.name() + " has not been set");
602 }
603 return value.asLong();
604 }
605
606 private MutableColumnFamilyOptionsBuilder setInt(
607 final MutableColumnFamilyOptionKey key, final int value) {
608 if(key.getValueType() != ValueType.INT) {
609 throw new IllegalArgumentException(
610 key + " does not accept an integer value");
611 }
612 options.put(key, new MutableColumnFamilyOptionIntValue(value));
613 return this;
614 }
615
616 private int getInt(final MutableColumnFamilyOptionKey key)
617 throws NoSuchElementException, NumberFormatException {
618 final MutableColumnFamilyOptionValue<?> value = options.get(key);
619 if(value == null) {
620 throw new NoSuchElementException(key.name() + " has not been set");
621 }
622 return value.asInt();
623 }
624
625 private MutableColumnFamilyOptionsBuilder setBoolean(
626 final MutableColumnFamilyOptionKey key, final boolean value) {
627 if(key.getValueType() != ValueType.BOOLEAN) {
628 throw new IllegalArgumentException(
629 key + " does not accept a boolean value");
630 }
631 options.put(key, new MutableColumnFamilyOptionBooleanValue(value));
632 return this;
633 }
634
635 private boolean getBoolean(final MutableColumnFamilyOptionKey key)
636 throws NoSuchElementException, NumberFormatException {
637 final MutableColumnFamilyOptionValue<?> value = options.get(key);
638 if(value == null) {
639 throw new NoSuchElementException(key.name() + " has not been set");
640 }
641 return value.asBoolean();
642 }
643
644 private MutableColumnFamilyOptionsBuilder setIntArray(
645 final MutableColumnFamilyOptionKey key, final int[] value) {
646 if(key.getValueType() != ValueType.INT_ARRAY) {
647 throw new IllegalArgumentException(
648 key + " does not accept an int array value");
649 }
650 options.put(key, new MutableColumnFamilyOptionIntArrayValue(value));
651 return this;
652 }
653
654 private int[] getIntArray(final MutableColumnFamilyOptionKey key)
655 throws NoSuchElementException, NumberFormatException {
656 final MutableColumnFamilyOptionValue<?> value = options.get(key);
657 if(value == null) {
658 throw new NoSuchElementException(key.name() + " has not been set");
659 }
660 return value.asIntArray();
661 }
662
663 private <T extends Enum<T>> MutableColumnFamilyOptionsBuilder setEnum(
664 final MutableColumnFamilyOptionKey key, final T value) {
665 if(key.getValueType() != ValueType.ENUM) {
666 throw new IllegalArgumentException(
667 key + " does not accept a Enum value");
668 }
669 options.put(key, new MutableColumnFamilyOptionEnumValue<T>(value));
670 return this;
671
672 }
673
674 private <T extends Enum<T>> T getEnum(final MutableColumnFamilyOptionKey key)
675 throws NoSuchElementException, NumberFormatException {
676 final MutableColumnFamilyOptionValue<?> value = options.get(key);
677 if(value == null) {
678 throw new NoSuchElementException(key.name() + " has not been set");
679 }
680
681 if(!(value instanceof MutableColumnFamilyOptionEnumValue)) {
682 throw new NoSuchElementException(key.name() + " is not of Enum type");
683 }
684
685 return ((MutableColumnFamilyOptionEnumValue<T>)value).asObject();
686 }
687
688 public MutableColumnFamilyOptionsBuilder fromString(final String keyStr,
689 final String valueStr) throws IllegalArgumentException {
690 Objects.requireNonNull(keyStr);
691 Objects.requireNonNull(valueStr);
692
693 final MutableColumnFamilyOptionKey key = ALL_KEYS_LOOKUP.get(keyStr);
694 switch(key.getValueType()) {
695 case DOUBLE:
696 return setDouble(key, Double.parseDouble(valueStr));
697
698 case LONG:
699 return setLong(key, Long.parseLong(valueStr));
700
701 case INT:
702 return setInt(key, Integer.parseInt(valueStr));
703
704 case BOOLEAN:
705 return setBoolean(key, Boolean.parseBoolean(valueStr));
706
707 case INT_ARRAY:
708 final String[] strInts = valueStr
709 .trim().split(INT_ARRAY_INT_SEPARATOR);
710 if(strInts == null || strInts.length == 0) {
711 throw new IllegalArgumentException(
712 "int array value is not correctly formatted");
713 }
714
715 final int value[] = new int[strInts.length];
716 int i = 0;
717 for(final String strInt : strInts) {
718 value[i++] = Integer.parseInt(strInt);
719 }
720 return setIntArray(key, value);
721 }
722
723 throw new IllegalStateException(
724 key + " has unknown value type: " + key.getValueType());
725 }
726
727 @Override
728 public MutableColumnFamilyOptionsBuilder setWriteBufferSize(
729 final long writeBufferSize) {
730 return setLong(MemtableOption.write_buffer_size, writeBufferSize);
731 }
732
733 @Override
734 public long writeBufferSize() {
735 return getLong(MemtableOption.write_buffer_size);
736 }
737
738 @Override
739 public MutableColumnFamilyOptionsBuilder setArenaBlockSize(
740 final long arenaBlockSize) {
741 return setLong(MemtableOption.arena_block_size, arenaBlockSize);
742 }
743
744 @Override
745 public long arenaBlockSize() {
746 return getLong(MemtableOption.arena_block_size);
747 }
748
749 @Override
750 public MutableColumnFamilyOptionsBuilder setMemtablePrefixBloomSizeRatio(
751 final double memtablePrefixBloomSizeRatio) {
752 return setDouble(MemtableOption.memtable_prefix_bloom_size_ratio,
753 memtablePrefixBloomSizeRatio);
754 }
755
756 @Override
757 public double memtablePrefixBloomSizeRatio() {
758 return getDouble(MemtableOption.memtable_prefix_bloom_size_ratio);
759 }
760
761 @Override
762 public MutableColumnFamilyOptionsBuilder setMemtableHugePageSize(
763 final long memtableHugePageSize) {
764 return setLong(MemtableOption.memtable_huge_page_size,
765 memtableHugePageSize);
766 }
767
768 @Override
769 public long memtableHugePageSize() {
770 return getLong(MemtableOption.memtable_huge_page_size);
771 }
772
773 @Override
774 public MutableColumnFamilyOptionsBuilder setMaxSuccessiveMerges(
775 final long maxSuccessiveMerges) {
776 return setLong(MemtableOption.max_successive_merges, maxSuccessiveMerges);
777 }
778
779 @Override
780 public long maxSuccessiveMerges() {
781 return getLong(MemtableOption.max_successive_merges);
782 }
783
784 @Override
785 public MutableColumnFamilyOptionsBuilder setMaxWriteBufferNumber(
786 final int maxWriteBufferNumber) {
787 return setInt(MemtableOption.max_write_buffer_number,
788 maxWriteBufferNumber);
789 }
790
791 @Override
792 public int maxWriteBufferNumber() {
793 return getInt(MemtableOption.max_write_buffer_number);
794 }
795
796 @Override
797 public MutableColumnFamilyOptionsBuilder setInplaceUpdateNumLocks(
798 final long inplaceUpdateNumLocks) {
799 return setLong(MemtableOption.inplace_update_num_locks,
800 inplaceUpdateNumLocks);
801 }
802
803 @Override
804 public long inplaceUpdateNumLocks() {
805 return getLong(MemtableOption.inplace_update_num_locks);
806 }
807
808 @Override
809 public MutableColumnFamilyOptionsBuilder setDisableAutoCompactions(
810 final boolean disableAutoCompactions) {
811 return setBoolean(CompactionOption.disable_auto_compactions,
812 disableAutoCompactions);
813 }
814
815 @Override
816 public boolean disableAutoCompactions() {
817 return getBoolean(CompactionOption.disable_auto_compactions);
818 }
819
820 @Override
821 public MutableColumnFamilyOptionsBuilder setSoftPendingCompactionBytesLimit(
822 final long softPendingCompactionBytesLimit) {
823 return setLong(CompactionOption.soft_pending_compaction_bytes_limit,
824 softPendingCompactionBytesLimit);
825 }
826
827 @Override
828 public long softPendingCompactionBytesLimit() {
829 return getLong(CompactionOption.soft_pending_compaction_bytes_limit);
830 }
831
832 @Override
833 public MutableColumnFamilyOptionsBuilder setHardPendingCompactionBytesLimit(
834 final long hardPendingCompactionBytesLimit) {
835 return setLong(CompactionOption.hard_pending_compaction_bytes_limit,
836 hardPendingCompactionBytesLimit);
837 }
838
839 @Override
840 public long hardPendingCompactionBytesLimit() {
841 return getLong(CompactionOption.hard_pending_compaction_bytes_limit);
842 }
843
844 @Override
845 public MutableColumnFamilyOptionsBuilder setLevel0FileNumCompactionTrigger(
846 final int level0FileNumCompactionTrigger) {
847 return setInt(CompactionOption.level0_file_num_compaction_trigger,
848 level0FileNumCompactionTrigger);
849 }
850
851 @Override
852 public int level0FileNumCompactionTrigger() {
853 return getInt(CompactionOption.level0_file_num_compaction_trigger);
854 }
855
856 @Override
857 public MutableColumnFamilyOptionsBuilder setLevel0SlowdownWritesTrigger(
858 final int level0SlowdownWritesTrigger) {
859 return setInt(CompactionOption.level0_slowdown_writes_trigger,
860 level0SlowdownWritesTrigger);
861 }
862
863 @Override
864 public int level0SlowdownWritesTrigger() {
865 return getInt(CompactionOption.level0_slowdown_writes_trigger);
866 }
867
868 @Override
869 public MutableColumnFamilyOptionsBuilder setLevel0StopWritesTrigger(
870 final int level0StopWritesTrigger) {
871 return setInt(CompactionOption.level0_stop_writes_trigger,
872 level0StopWritesTrigger);
873 }
874
875 @Override
876 public int level0StopWritesTrigger() {
877 return getInt(CompactionOption.level0_stop_writes_trigger);
878 }
879
880 @Override
881 public MutableColumnFamilyOptionsBuilder setMaxCompactionBytes(final long maxCompactionBytes) {
882 return setLong(CompactionOption.max_compaction_bytes, maxCompactionBytes);
883 }
884
885 @Override
886 public long maxCompactionBytes() {
887 return getLong(CompactionOption.max_compaction_bytes);
888 }
889
890
891 @Override
892 public MutableColumnFamilyOptionsBuilder setTargetFileSizeBase(
893 final long targetFileSizeBase) {
894 return setLong(CompactionOption.target_file_size_base,
895 targetFileSizeBase);
896 }
897
898 @Override
899 public long targetFileSizeBase() {
900 return getLong(CompactionOption.target_file_size_base);
901 }
902
903 @Override
904 public MutableColumnFamilyOptionsBuilder setTargetFileSizeMultiplier(
905 final int targetFileSizeMultiplier) {
906 return setInt(CompactionOption.target_file_size_multiplier,
907 targetFileSizeMultiplier);
908 }
909
910 @Override
911 public int targetFileSizeMultiplier() {
912 return getInt(CompactionOption.target_file_size_multiplier);
913 }
914
915 @Override
916 public MutableColumnFamilyOptionsBuilder setMaxBytesForLevelBase(
917 final long maxBytesForLevelBase) {
918 return setLong(CompactionOption.max_bytes_for_level_base,
919 maxBytesForLevelBase);
920 }
921
922 @Override
923 public long maxBytesForLevelBase() {
924 return getLong(CompactionOption.max_bytes_for_level_base);
925 }
926
927 @Override
928 public MutableColumnFamilyOptionsBuilder setMaxBytesForLevelMultiplier(
929 final double maxBytesForLevelMultiplier) {
930 return setDouble(CompactionOption.max_bytes_for_level_multiplier, maxBytesForLevelMultiplier);
931 }
932
933 @Override
934 public double maxBytesForLevelMultiplier() {
935 return getDouble(CompactionOption.max_bytes_for_level_multiplier);
936 }
937
938 @Override
939 public MutableColumnFamilyOptionsBuilder setMaxBytesForLevelMultiplierAdditional(
940 final int[] maxBytesForLevelMultiplierAdditional) {
941 return setIntArray(
942 CompactionOption.max_bytes_for_level_multiplier_additional,
943 maxBytesForLevelMultiplierAdditional);
944 }
945
946 @Override
947 public int[] maxBytesForLevelMultiplierAdditional() {
948 return getIntArray(
949 CompactionOption.max_bytes_for_level_multiplier_additional);
950 }
951
952 @Override
953 public MutableColumnFamilyOptionsBuilder setMaxSequentialSkipInIterations(
954 final long maxSequentialSkipInIterations) {
955 return setLong(MiscOption.max_sequential_skip_in_iterations,
956 maxSequentialSkipInIterations);
957 }
958
959 @Override
960 public long maxSequentialSkipInIterations() {
961 return getLong(MiscOption.max_sequential_skip_in_iterations);
962 }
963
964 @Override
965 public MutableColumnFamilyOptionsBuilder setParanoidFileChecks(
966 final boolean paranoidFileChecks) {
967 return setBoolean(MiscOption.paranoid_file_checks, paranoidFileChecks);
968 }
969
970 @Override
971 public boolean paranoidFileChecks() {
972 return getBoolean(MiscOption.paranoid_file_checks);
973 }
974
975 @Override
976 public MutableColumnFamilyOptionsBuilder setCompressionType(
977 final CompressionType compressionType) {
978 return setEnum(MiscOption.compression_type, compressionType);
979 }
980
981 @Override
982 public CompressionType compressionType() {
983 return (CompressionType)getEnum(MiscOption.compression_type);
984 }
985
986 @Override
987 public MutableColumnFamilyOptionsBuilder setReportBgIoStats(
988 final boolean reportBgIoStats) {
989 return setBoolean(MiscOption.report_bg_io_stats, reportBgIoStats);
990 }
991
992 @Override
993 public boolean reportBgIoStats() {
994 return getBoolean(MiscOption.report_bg_io_stats);
995 }
996 }
997 }