]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/SstFileReader.java
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
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).
8 public class SstFileReader
extends RocksObject
{
10 RocksDB
.loadLibrary();
13 public SstFileReader(final Options options
) {
14 super(newSstFileReader(options
.nativeHandle_
));
18 * Returns an iterator that will iterate on all keys in the default
19 * column family including both keys in the DB and uncommitted keys in this
22 * Setting {@link ReadOptions#setSnapshot(Snapshot)} will affect what is read
23 * from the DB but will NOT change which keys are read from this transaction
24 * (the keys in this transaction do not yet belong to any snapshot and will be
25 * fetched regardless).
27 * Caller is responsible for deleting the returned Iterator.
29 * @param readOptions Read options.
31 * @return instance of iterator object.
33 public SstFileReaderIterator
newIterator(final ReadOptions readOptions
) {
34 assert (isOwningHandle());
35 long iter
= newIterator(nativeHandle_
, readOptions
.nativeHandle_
);
36 return new SstFileReaderIterator(this, iter
);
40 * Prepare SstFileReader to read a file.
42 * @param filePath the location of file
44 * @throws RocksDBException thrown if error happens in underlying
47 public void open(final String filePath
) throws RocksDBException
{
48 open(nativeHandle_
, filePath
);
54 * @throws RocksDBException if the checksum is not valid
56 public void verifyChecksum() throws RocksDBException
{
57 verifyChecksum(nativeHandle_
);
61 * Get the properties of the table.
63 * @return the properties
65 * @throws RocksDBException if an error occurs whilst getting the table
68 public TableProperties
getTableProperties() throws RocksDBException
{
69 return getTableProperties(nativeHandle_
);
72 @Override protected final native void disposeInternal(final long handle
);
73 private native long newIterator(final long handle
, final long readOptionsHandle
);
75 private native void open(final long handle
, final String filePath
)
76 throws RocksDBException
;
78 private native static long newSstFileReader(final long optionsHandle
);
79 private native void verifyChecksum(final long handle
) throws RocksDBException
;
80 private native TableProperties
getTableProperties(final long handle
)
81 throws RocksDBException
;