]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/CompactionPriority.java
update ceph source to reef 18.1.2
[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 * Keeps a cursor(s) of the successor of the file (key range) was/were
40 * compacted before, and always picks the next files (key range) in that
41 * level. The file picking process will cycle through all the files in a
42 * round-robin manner.
43 */
44 RoundRobin((byte)0x4);
45
46
47 private final byte value;
48
49 CompactionPriority(final byte value) {
50 this.value = value;
51 }
52
53 /**
54 * Returns the byte value of the enumerations value
55 *
56 * @return byte representation
57 */
58 public byte getValue() {
59 return value;
60 }
61
62 /**
63 * Get CompactionPriority by byte value.
64 *
65 * @param value byte representation of CompactionPriority.
66 *
67 * @return {@link org.rocksdb.CompactionPriority} instance or null.
68 * @throws java.lang.IllegalArgumentException if an invalid
69 * value is provided.
70 */
71 public static CompactionPriority getCompactionPriority(final byte value) {
72 for (final CompactionPriority compactionPriority :
73 CompactionPriority.values()) {
74 if (compactionPriority.getValue() == value){
75 return compactionPriority;
76 }
77 }
78 throw new IllegalArgumentException(
79 "Illegal value provided for CompactionPriority.");
80 }
81 }