]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
11fdf7f2 TL |
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). | |
7c673cae FG |
5 | |
6 | package org.rocksdb; | |
7 | ||
8 | /** | |
9 | * RocksDB {@link ReadOptions} read tiers. | |
10 | */ | |
11 | public enum ReadTier { | |
12 | READ_ALL_TIER((byte)0), | |
13 | BLOCK_CACHE_TIER((byte)1), | |
11fdf7f2 TL |
14 | PERSISTED_TIER((byte)2), |
15 | MEMTABLE_TIER((byte)3); | |
7c673cae FG |
16 | |
17 | private final byte value; | |
18 | ||
19 | ReadTier(final byte value) { | |
20 | this.value = value; | |
21 | } | |
22 | ||
23 | /** | |
24 | * Returns the byte value of the enumerations value | |
25 | * | |
26 | * @return byte representation | |
27 | */ | |
28 | public byte getValue() { | |
29 | return value; | |
30 | } | |
31 | ||
32 | /** | |
33 | * Get ReadTier by byte value. | |
34 | * | |
35 | * @param value byte representation of ReadTier. | |
36 | * | |
37 | * @return {@link org.rocksdb.ReadTier} instance or null. | |
38 | * @throws java.lang.IllegalArgumentException if an invalid | |
39 | * value is provided. | |
40 | */ | |
41 | public static ReadTier getReadTier(final byte value) { | |
42 | for (final ReadTier readTier : ReadTier.values()) { | |
43 | if (readTier.getValue() == value){ | |
44 | return readTier; | |
45 | } | |
46 | } | |
47 | throw new IllegalArgumentException("Illegal value provided for ReadTier."); | |
48 | } | |
49 | } |