]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/CompactionPriority.java
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / CompactionPriority.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 /**
9 * Compaction Priorities
10 */
11 public enum CompactionPriority {
12
13 /**
14 * Slightly Prioritize larger files by size compensated by #deletes
15 */
16 ByCompensatedSize((byte)0x0),
17
18 /**
19 * First compact files whose data's latest update time is oldest.
20 * Try this if you only update some hot keys in small ranges.
21 */
22 OldestLargestSeqFirst((byte)0x1),
23
24 /**
25 * First compact files whose range hasn't been compacted to the next level
26 * for the longest. If your updates are random across the key space,
27 * write amplification is slightly better with this option.
28 */
29 OldestSmallestSeqFirst((byte)0x2),
30
31 /**
32 * First compact files whose ratio between overlapping size in next level
33 * and its size is the smallest. It in many cases can optimize write
34 * amplification.
35 */
36 MinOverlappingRatio((byte)0x3);
37
38
39 private final byte value;
40
41 CompactionPriority(final byte value) {
42 this.value = value;
43 }
44
45 /**
46 * Returns the byte value of the enumerations value
47 *
48 * @return byte representation
49 */
50 public byte getValue() {
51 return value;
52 }
53
54 /**
55 * Get CompactionPriority by byte value.
56 *
57 * @param value byte representation of CompactionPriority.
58 *
59 * @return {@link org.rocksdb.CompactionPriority} instance or null.
60 * @throws java.lang.IllegalArgumentException if an invalid
61 * value is provided.
62 */
63 public static CompactionPriority getCompactionPriority(final byte value) {
64 for (final CompactionPriority compactionPriority :
65 CompactionPriority.values()) {
66 if (compactionPriority.getValue() == value){
67 return compactionPriority;
68 }
69 }
70 throw new IllegalArgumentException(
71 "Illegal value provided for CompactionPriority.");
72 }
73 }