]>
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 | * IndexType used in conjunction with BlockBasedTable. | |
10 | */ | |
11 | public enum IndexType { | |
12 | /** | |
13 | * A space efficient index block that is optimized for | |
14 | * binary-search-based index. | |
15 | */ | |
16 | kBinarySearch((byte) 0), | |
17 | /** | |
18 | * The hash index, if enabled, will do the hash lookup when | |
19 | * {@code Options.prefix_extractor} is provided. | |
20 | */ | |
21 | kHashSearch((byte) 1), | |
22 | /** | |
23 | * A two-level index implementation. Both levels are binary search indexes. | |
24 | */ | |
20effc67 TL |
25 | kTwoLevelIndexSearch((byte) 2), |
26 | /** | |
27 | * Like {@link #kBinarySearch}, but index also contains first key of each block. | |
28 | * This allows iterators to defer reading the block until it's actually | |
29 | * needed. May significantly reduce read amplification of short range scans. | |
30 | * Without it, iterator seek usually reads one block from each level-0 file | |
31 | * and from each level, which may be expensive. | |
32 | * Works best in combination with: | |
33 | * - IndexShorteningMode::kNoShortening, | |
34 | * - custom FlushBlockPolicy to cut blocks at some meaningful boundaries, | |
35 | * e.g. when prefix changes. | |
36 | * Makes the index significantly bigger (2x or more), especially when keys | |
37 | * are long. | |
38 | */ | |
39 | kBinarySearchWithFirstKey((byte) 3); | |
7c673cae FG |
40 | |
41 | /** | |
42 | * Returns the byte value of the enumerations value | |
43 | * | |
44 | * @return byte representation | |
45 | */ | |
46 | public byte getValue() { | |
47 | return value_; | |
48 | } | |
49 | ||
494da23a | 50 | IndexType(byte value) { |
7c673cae FG |
51 | value_ = value; |
52 | } | |
53 | ||
54 | private final byte value_; | |
55 | } |