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