Repository navigation
Expand file tree
/
Copy pathEncodingType.java
More file actions
55 lines (50 loc) · 1.79 KB
/
Copy pathEncodingType.java
File metadata and controls
55 lines (50 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
package org.rocksdb;
/**
* EncodingType
*
* <p>The value will determine how to encode keys
* when writing to a new SST file.</p>
*
* <p>This value will be stored
* inside the SST file which will be used when reading from
* the file, which makes it possible for users to choose
* different encoding type when reopening a DB. Files with
* different encoding types can co-exist in the same DB and
* can be read.</p>
*/
public enum EncodingType {
/**
* Always write full keys without any special encoding.
*/
kPlain((byte) 0),
/**
* <p>Find opportunity to write the same prefix once for multiple rows.
* In some cases, when a key follows a previous key with the same prefix,
* instead of writing out the full key, it just writes out the size of the
* shared prefix, as well as other bytes, to save some bytes.</p>
*
* <p>When using this option, the user is required to use the same prefix
* extractor to make sure the same prefix will be extracted from the same key.
* The Name() value of the prefix extractor will be stored in the file. When
* reopening the file, the name of the options.prefix_extractor given will be
* bitwise compared to the prefix extractors stored in the file. An error
* will be returned if the two don't match.</p>
*/
kPrefix((byte) 1);
/**
* Returns the byte value of the enumerations value
*
* @return byte representation
*/
public byte getValue() {
return value_;
}
EncodingType(final byte value) {
value_ = value;
}
private final byte value_;
}