Class AscendingRangeIterator

  • All Implemented Interfaces:
    AutoCloseable, DbIterator

    public class AscendingRangeIterator
    extends Object
    implements DbIterator
    wrapper around a rocksdb iterator that only supports next() and is restricted to a range.
    • Constructor Detail

      • AscendingRangeIterator

        public AscendingRangeIterator​(org.rocksdb.RocksIterator it,
                                      byte[] rangeStart,
                                      boolean strictStart,
                                      byte[] rangeStop,
                                      boolean strictStop)
        Constructs an iterator restricted to a range. Unlike the RocksDB standard iterators, if strictStart=true then the first rangeStart.length bytes of the key are compared with the rangeStart, if they are equal the record is skipped. same is valid for strictEnd So 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 skip records 1,2 and 3 and start from record 4 To scan all records that start with a prefix, you can use rangeStart=rangeStop=prefix , strictStart=strictStop=false