Class ForStIteratorWrapper
java.lang.Object
org.apache.flink.state.forst.sync.ForStIteratorWrapper
- All Implemented Interfaces:
Closeable,AutoCloseable,org.forstdb.RocksIteratorInterface
public class ForStIteratorWrapper
extends Object
implements org.forstdb.RocksIteratorInterface, Closeable
This class was originally a wrapper around
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleanisValid()byte[]key()voidnext()voidprev()voidrefresh()voidseek(byte[] target) voidseek(ByteBuffer target) voidseekForPrev(byte[] target) voidseekForPrev(ByteBuffer target) voidvoidvoidstatus()byte[]value()
-
Constructor Details
-
ForStIteratorWrapper
public ForStIteratorWrapper(@Nonnull org.forstdb.RocksIterator iterator)
-
-
Method Details
-
isValid
public boolean isValid()- Specified by:
isValidin interfaceorg.forstdb.RocksIteratorInterface
-
seekToFirst
public void seekToFirst()- Specified by:
seekToFirstin interfaceorg.forstdb.RocksIteratorInterface
-
seekToLast
public void seekToLast()- Specified by:
seekToLastin interfaceorg.forstdb.RocksIteratorInterface
-
seek
public void seek(byte[] target) - Specified by:
seekin interfaceorg.forstdb.RocksIteratorInterface
-
seekForPrev
public void seekForPrev(byte[] target) - Specified by:
seekForPrevin interfaceorg.forstdb.RocksIteratorInterface
-
seek
- Specified by:
seekin interfaceorg.forstdb.RocksIteratorInterface
-
seekForPrev
- Specified by:
seekForPrevin interfaceorg.forstdb.RocksIteratorInterface
-
next
public void next()- Specified by:
nextin interfaceorg.forstdb.RocksIteratorInterface
-
prev
public void prev()- Specified by:
previn interfaceorg.forstdb.RocksIteratorInterface
-
status
public void status()- Specified by:
statusin interfaceorg.forstdb.RocksIteratorInterface
-
refresh
public void refresh() throws org.forstdb.RocksDBException- Specified by:
refreshin interfaceorg.forstdb.RocksIteratorInterface- Throws:
org.forstdb.RocksDBException
-
key
public byte[] key() -
value
public byte[] value() -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-