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 aroundRocksIterator
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 Constructor Description ForStIteratorWrapper(org.forstdb.RocksIterator iterator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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()
-
-
-
Method Detail
-
isValid
public boolean isValid()
- Specified by:
isValid
in interfaceorg.forstdb.RocksIteratorInterface
-
seekToFirst
public void seekToFirst()
- Specified by:
seekToFirst
in interfaceorg.forstdb.RocksIteratorInterface
-
seekToLast
public void seekToLast()
- Specified by:
seekToLast
in interfaceorg.forstdb.RocksIteratorInterface
-
seek
public void seek(byte[] target)
- Specified by:
seek
in interfaceorg.forstdb.RocksIteratorInterface
-
seekForPrev
public void seekForPrev(byte[] target)
- Specified by:
seekForPrev
in interfaceorg.forstdb.RocksIteratorInterface
-
seek
public void seek(ByteBuffer target)
- Specified by:
seek
in interfaceorg.forstdb.RocksIteratorInterface
-
seekForPrev
public void seekForPrev(ByteBuffer target)
- Specified by:
seekForPrev
in interfaceorg.forstdb.RocksIteratorInterface
-
next
public void next()
- Specified by:
next
in interfaceorg.forstdb.RocksIteratorInterface
-
prev
public void prev()
- Specified by:
prev
in interfaceorg.forstdb.RocksIteratorInterface
-
status
public void status()
- Specified by:
status
in interfaceorg.forstdb.RocksIteratorInterface
-
refresh
public void refresh() throws org.forstdb.RocksDBException
- Specified by:
refresh
in interfaceorg.forstdb.RocksIteratorInterface
- Throws:
org.forstdb.RocksDBException
-
key
public byte[] key()
-
value
public byte[] value()
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-