]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/BackgroundErrorReason.java
import quincy beta 17.1.0
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / BackgroundErrorReason.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 public enum BackgroundErrorReason {
9 FLUSH((byte) 0x0),
10 COMPACTION((byte) 0x1),
11 WRITE_CALLBACK((byte) 0x2),
12 MEMTABLE((byte) 0x3);
13
14 private final byte value;
15
16 BackgroundErrorReason(final byte value) {
17 this.value = value;
18 }
19
20 /**
21 * Get the internal representation.
22 *
23 * @return the internal representation
24 */
25 byte getValue() {
26 return value;
27 }
28
29 /**
30 * Get the BackgroundErrorReason from the internal representation value.
31 *
32 * @return the background error reason.
33 *
34 * @throws IllegalArgumentException if the value is unknown.
35 */
36 static BackgroundErrorReason fromValue(final byte value) {
37 for (final BackgroundErrorReason backgroundErrorReason : BackgroundErrorReason.values()) {
38 if (backgroundErrorReason.value == value) {
39 return backgroundErrorReason;
40 }
41 }
42
43 throw new IllegalArgumentException(
44 "Illegal value provided for BackgroundErrorReason: " + value);
45 }
46 }