Class 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 Detail

      • ForStIteratorWrapper

        public ForStIteratorWrapper​(@Nonnull
                                    org.forstdb.RocksIterator iterator)
    • Method Detail

      • isValid

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

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

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

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

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

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

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

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

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

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

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

        public byte[] key()
      • value

        public byte[] value()