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.RocksIteratorInterface
public void seekToFirst()
seekToFirst
in interface org.rocksdb.RocksIteratorInterface
public void seekToLast()
seekToLast
in interface org.rocksdb.RocksIteratorInterface
public void seek(byte[] target)
seek
in interface org.rocksdb.RocksIteratorInterface
public void seekForPrev(byte[] target)
seekForPrev
in interface org.rocksdb.RocksIteratorInterface
public void seek(ByteBuffer target)
seek
in interface org.rocksdb.RocksIteratorInterface
public void seekForPrev(ByteBuffer target)
seekForPrev
in interface org.rocksdb.RocksIteratorInterface
public void next()
next
in interface org.rocksdb.RocksIteratorInterface
public void prev()
prev
in interface org.rocksdb.RocksIteratorInterface
public void status()
status
in interface org.rocksdb.RocksIteratorInterface
public void refresh() throws org.rocksdb.RocksDBException
refresh
in interface org.rocksdb.RocksIteratorInterface
org.rocksdb.RocksDBException
public byte[] key()
public byte[] value()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.