-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Expand file tree
/
Copy pathSstFileReader.java
More file actions
82 lines (72 loc) · 2.58 KB
/
SstFileReader.java
File metadata and controls
82 lines (72 loc) · 2.58 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// 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;
public class SstFileReader extends RocksObject {
static {
RocksDB.loadLibrary();
}
public SstFileReader(final Options options) {
super(newSstFileReader(options.nativeHandle_));
}
/**
* Returns an iterator that will iterate on all keys in the default
* column family including both keys in the DB and uncommitted keys in this
* transaction.
*
* Setting {@link ReadOptions#setSnapshot(Snapshot)} will affect what is read
* from the DB but will NOT change which keys are read from this transaction
* (the keys in this transaction do not yet belong to any snapshot and will be
* fetched regardless).
*
* Caller is responsible for deleting the returned Iterator.
*
* @param readOptions Read options.
*
* @return instance of iterator object.
*/
public SstFileReaderIterator newIterator(final ReadOptions readOptions) {
assert (isOwningHandle());
long iter = newIterator(nativeHandle_, readOptions.nativeHandle_);
return new SstFileReaderIterator(this, iter);
}
/**
* Prepare SstFileReader to read a file.
*
* @param filePath the location of file
*
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void open(final String filePath) throws RocksDBException {
open(nativeHandle_, filePath);
}
/**
* Verify checksum
*
* @throws RocksDBException if the checksum is not valid
*/
public void verifyChecksum() throws RocksDBException {
verifyChecksum(nativeHandle_);
}
/**
* Get the properties of the table.
*
* @return the properties
*
* @throws RocksDBException if an error occurs whilst getting the table
* properties
*/
public TableProperties getTableProperties() throws RocksDBException {
return getTableProperties(nativeHandle_);
}
@Override protected final native void disposeInternal(final long handle);
private native long newIterator(final long handle, final long readOptionsHandle);
private native void open(final long handle, final String filePath)
throws RocksDBException;
private native static long newSstFileReader(final long optionsHandle);
private native void verifyChecksum(final long handle) throws RocksDBException;
private native TableProperties getTableProperties(final long handle)
throws RocksDBException;
}