use of org.apache.ignite.internal.rocksdb.RocksBiPredicate in project ignite-3 by apache.
the class RocksDbKeyValueStorage method higherOrCeiling.
/**
* Gets an entry from the keys index with the least key greater than or equal to the specified key, depending on the strictlyHigher
* parameter.
*
* @param key Key.
* @param strictlyHigher {@code true} for a strictly higher entry, {@code false} for a ceiling one.
* @return Entry for the least key greater than or equal to the specified key. If no such entry exists returns {@code null}.
*/
@Nullable
private IgniteBiTuple<byte[], long[]> higherOrCeiling(byte[] key, boolean strictlyHigher) {
try (RocksIterator iterator = index.newIterator()) {
iterator.seek(key);
RocksBiPredicate predicate = strictlyHigher ? (k, v) -> CMP.compare(k, key) > 0 : (k, v) -> CMP.compare(k, key) >= 0;
boolean found = find(iterator, predicate);
if (!found) {
return null;
}
return new IgniteBiTuple<>(iterator.key(), getAsLongs(iterator.value()));
} catch (RocksDBException e) {
throw new IgniteInternalException(e);
}
}
Aggregations