Class DescendingRangeIterator

  • All Implemented Interfaces:
    AutoCloseable, DbIterator

    public class DescendingRangeIterator
    extends Object
    implements DbIterator
    Wrapper around a rocksdb iterator that only supports prev() and is restricted to a range.

    If the rangeStart or rangeEnd are specified, any key which starts or it's equal with them is considered as matching.

    That means they will all be returned when strictStart/End=false or they will all be skipped if strictStart/End=true.

    For example, with the following DB:

      1: 0x00 0x00 0x00 0x02
      2: 0x01 0x01 0x01 0x00
      3: 0x01 0x01 0x01 0x03
      4: 0x01 0x01 0x02 0x00
     
    and rangeStart = 0x01 0x01 0x01, strictStart=true

    the iterator will only return record 4

    with rangeEnd = 0x01, strictEnd = false, the iterator will return all records in descending order 4,3,2,1.

    • Constructor Detail

      • DescendingRangeIterator

        public DescendingRangeIterator​(org.rocksdb.RocksIterator it,
                                       byte[] rangeStart,
                                       byte[] rangeEnd)
        Creates a new range iterator that iteates in descending order from rangeEnd to rangeStart
        Parameters:
        it -
        rangeStart -
        rangeEnd -
      • DescendingRangeIterator

        public DescendingRangeIterator​(org.rocksdb.RocksIterator it,
                                       DbRange range)