public class RocksIteratorWrapper extends Object implements org.rocksdb.RocksIteratorInterface, Closeable
RocksIterator to check the iterator status for
all the methods mentioned to require this check in the wiki documentation: seek, next,
seekToFirst, seekToLast, seekForPrev, and prev. At that time, this was required because the
iterator may pass the blocks or files it had difficulties in reading (because of IO errors, data
corruptions or other issues) and continue with the next available keys. The status flag may not
be OK, even if the iterator is valid.
However, after 3810 was merged, the behaviour had changed. If the iterator is valid, the status() is guaranteed to be OK; If the iterator is not valid, there are two possibilities: 1) We have reached the end of the data. And in this case, status() is OK; 2) There is an error. In this case, status() is not OK; More information can be found here.
| Constructor and Description |
|---|
RocksIteratorWrapper(org.rocksdb.RocksIterator iterator) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
isValid() |
byte[] |
key() |
void |
next() |
void |
prev() |
void |
refresh() |
void |
seek(byte[] target) |
void |
seek(ByteBuffer target) |
void |
seekForPrev(byte[] target) |
void |
seekForPrev(ByteBuffer target) |
void |
seekToFirst() |
void |
seekToLast() |
void |
status() |
byte[] |
value() |
public RocksIteratorWrapper(@Nonnull org.rocksdb.RocksIterator iterator)
public boolean isValid()
isValid in interface org.rocksdb.RocksIteratorInterfacepublic void seekToFirst()
seekToFirst in interface org.rocksdb.RocksIteratorInterfacepublic void seekToLast()
seekToLast in interface org.rocksdb.RocksIteratorInterfacepublic void seek(byte[] target)
seek in interface org.rocksdb.RocksIteratorInterfacepublic void seekForPrev(byte[] target)
seekForPrev in interface org.rocksdb.RocksIteratorInterfacepublic void seek(ByteBuffer target)
seek in interface org.rocksdb.RocksIteratorInterfacepublic void seekForPrev(ByteBuffer target)
seekForPrev in interface org.rocksdb.RocksIteratorInterfacepublic void next()
next in interface org.rocksdb.RocksIteratorInterfacepublic void prev()
prev in interface org.rocksdb.RocksIteratorInterfacepublic void status()
status in interface org.rocksdb.RocksIteratorInterfacepublic void refresh()
throws org.rocksdb.RocksDBException
refresh in interface org.rocksdb.RocksIteratorInterfaceorg.rocksdb.RocksDBExceptionpublic byte[] key()
public byte[] value()
public void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.