Class RocksIteratorWrapper

java.lang.Object
org.apache.flink.state.rocksdb.RocksIteratorWrapper
All Implemented Interfaces:
Closeable, AutoCloseable, org.rocksdb.RocksIteratorInterface
Direct Known Subclasses:
RocksTransformingIteratorWrapper

public class RocksIteratorWrapper extends Object implements org.rocksdb.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 Details

    • RocksIteratorWrapper

      public RocksIteratorWrapper(@Nonnull org.rocksdb.RocksIterator iterator)
  • Method Details

    • isValid

      public boolean isValid()
      Specified by:
      isValid in interface org.rocksdb.RocksIteratorInterface
    • seekToFirst

      public void seekToFirst()
      Specified by:
      seekToFirst in interface org.rocksdb.RocksIteratorInterface
    • seekToLast

      public void seekToLast()
      Specified by:
      seekToLast in interface org.rocksdb.RocksIteratorInterface
    • seek

      public void seek(byte[] target)
      Specified by:
      seek in interface org.rocksdb.RocksIteratorInterface
    • seekForPrev

      public void seekForPrev(byte[] target)
      Specified by:
      seekForPrev in interface org.rocksdb.RocksIteratorInterface
    • seek

      public void seek(ByteBuffer target)
      Specified by:
      seek in interface org.rocksdb.RocksIteratorInterface
    • seekForPrev

      public void seekForPrev(ByteBuffer target)
      Specified by:
      seekForPrev in interface org.rocksdb.RocksIteratorInterface
    • next

      public void next()
      Specified by:
      next in interface org.rocksdb.RocksIteratorInterface
    • prev

      public void prev()
      Specified by:
      prev in interface org.rocksdb.RocksIteratorInterface
    • status

      public void status()
      Specified by:
      status in interface org.rocksdb.RocksIteratorInterface
    • refresh

      public void refresh() throws org.rocksdb.RocksDBException
      Specified by:
      refresh in interface org.rocksdb.RocksIteratorInterface
      Throws:
      org.rocksdb.RocksDBException
    • key

      public byte[] key()
    • value

      public byte[] value()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable