Package org.yamcs.yarch.rocksdb
Class DescendingRangeIterator
- java.lang.Object
-
- org.yamcs.yarch.rocksdb.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 ifstrictStart/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
andrangeStart = 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 Summary
Constructors Constructor Description DescendingRangeIterator(org.rocksdb.RocksIterator it, byte[] rangeStart, byte[] rangeEnd)
Creates a new range iterator that iteates in descending order from rangeEnd to rangeStartDescendingRangeIterator(org.rocksdb.RocksIterator it, DbRange range)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
isValid()
byte[]
key()
void
next()
void
prev()
byte[]
value()
-
-
-
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)
-
-
Method Detail
-
isValid
public boolean isValid()
- Specified by:
isValid
in interfaceDbIterator
-
prev
public void prev()
- Specified by:
prev
in interfaceDbIterator
-
next
public void next()
- Specified by:
next
in interfaceDbIterator
-
key
public byte[] key()
- Specified by:
key
in interfaceDbIterator
-
value
public byte[] value()
- Specified by:
value
in interfaceDbIterator
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceDbIterator
-
-