]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/java/src/main/java/org/rocksdb/CompactionReason.java
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / CompactionReason.java
CommitLineData
494da23a
TL
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
6package org.rocksdb;
7
8public enum CompactionReason {
9 kUnknown((byte)0x0),
10
11 /**
12 * [Level] number of L0 files > level0_file_num_compaction_trigger
13 */
14 kLevelL0FilesNum((byte)0x1),
15
16 /**
17 * [Level] total size of level > MaxBytesForLevel()
18 */
19 kLevelMaxLevelSize((byte)0x2),
20
21 /**
22 * [Universal] Compacting for size amplification
23 */
24 kUniversalSizeAmplification((byte)0x3),
25
26 /**
27 * [Universal] Compacting for size ratio
28 */
29 kUniversalSizeRatio((byte)0x4),
30
31 /**
32 * [Universal] number of sorted runs > level0_file_num_compaction_trigger
33 */
34 kUniversalSortedRunNum((byte)0x5),
35
36 /**
37 * [FIFO] total size > max_table_files_size
38 */
39 kFIFOMaxSize((byte)0x6),
40
41 /**
42 * [FIFO] reduce number of files.
43 */
44 kFIFOReduceNumFiles((byte)0x7),
45
46 /**
47 * [FIFO] files with creation time < (current_time - interval)
48 */
49 kFIFOTtl((byte)0x8),
50
51 /**
52 * Manual compaction
53 */
54 kManualCompaction((byte)0x9),
55
56 /**
57 * DB::SuggestCompactRange() marked files for compaction
58 */
59 kFilesMarkedForCompaction((byte)0x10),
60
61 /**
62 * [Level] Automatic compaction within bottommost level to cleanup duplicate
63 * versions of same user key, usually due to a released snapshot.
64 */
65 kBottommostFiles((byte)0x0A),
66
67 /**
68 * Compaction based on TTL
69 */
70 kTtl((byte)0x0B),
71
72 /**
73 * According to the comments in flush_job.cc, RocksDB treats flush as
74 * a level 0 compaction in internal stats.
75 */
76 kFlush((byte)0x0C),
77
78 /**
79 * Compaction caused by external sst file ingestion
80 */
1e59de90
TL
81 kExternalSstIngestion((byte) 0x0D),
82
83 /**
84 * Compaction due to SST file being too old
85 */
86 kPeriodicCompaction((byte) 0x0E),
87
88 /**
89 * Compaction in order to move files to temperature
90 */
91 kChangeTemperature((byte) 0x0F);
494da23a
TL
92
93 private final byte value;
94
95 CompactionReason(final byte value) {
96 this.value = value;
97 }
98
99 /**
100 * Get the internal representation value.
101 *
102 * @return the internal representation value
103 */
104 byte getValue() {
105 return value;
106 }
107
108 /**
109 * Get the CompactionReason from the internal representation value.
110 *
111 * @return the compaction reason.
112 *
113 * @throws IllegalArgumentException if the value is unknown.
114 */
115 static CompactionReason fromValue(final byte value) {
116 for (final CompactionReason compactionReason : CompactionReason.values()) {
117 if(compactionReason.value == value) {
118 return compactionReason;
119 }
120 }
121
122 throw new IllegalArgumentException(
123 "Illegal value provided for CompactionReason: " + value);
124 }
125}