Package org.yamcs.yarch.rocksdb
Class AscendingRangeIterator
- java.lang.Object
-
- org.yamcs.yarch.rocksdb.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 Summary
Constructors Constructor Description AscendingRangeIterator(org.rocksdb.RocksIterator it, byte[] rangeStart, boolean strictStart, byte[] rangeStop, boolean strictStop)Constructs an iterator restricted to a range.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanisValid()byte[]key()voidnext()voidprev()byte[]value()
-
-
-
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
-
-
Method Detail
-
isValid
public boolean isValid()
- Specified by:
isValidin interfaceDbIterator
-
next
public void next()
- Specified by:
nextin interfaceDbIterator
-
key
public byte[] key()
- Specified by:
keyin interfaceDbIterator
-
value
public byte[] value()
- Specified by:
valuein interfaceDbIterator
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceDbIterator
-
prev
public void prev()
- Specified by:
previn interfaceDbIterator
-
-