]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/AccessHint.java
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / AccessHint.java
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
5
6 package org.rocksdb;
7
8 /**
9 * File access pattern once a compaction has started
10 */
11 public enum AccessHint {
12 NONE((byte)0x0),
13 NORMAL((byte)0x1),
14 SEQUENTIAL((byte)0x2),
15 WILLNEED((byte)0x3);
16
17 private final byte value;
18
19 AccessHint(final byte value) {
20 this.value = value;
21 }
22
23 /**
24 * <p>Returns the byte value of the enumerations value.</p>
25 *
26 * @return byte representation
27 */
28 public byte getValue() {
29 return value;
30 }
31
32 /**
33 * <p>Get the AccessHint enumeration value by
34 * passing the byte identifier to this method.</p>
35 *
36 * @param byteIdentifier of AccessHint.
37 *
38 * @return AccessHint instance.
39 *
40 * @throws IllegalArgumentException if the access hint for the byteIdentifier
41 * cannot be found
42 */
43 public static AccessHint getAccessHint(final byte byteIdentifier) {
44 for (final AccessHint accessHint : AccessHint.values()) {
45 if (accessHint.getValue() == byteIdentifier) {
46 return accessHint;
47 }
48 }
49
50 throw new IllegalArgumentException(
51 "Illegal value provided for AccessHint.");
52 }
53 }