org.rocksdb.Slice Java Examples

The following examples show how to use org.rocksdb.Slice. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RocksDBDataIndexTable.java    From geowave with Apache License 2.0 6 votes vote down vote up
public CloseableIterator<GeoWaveRow> dataIndexIterator(
    final byte[] startDataId,
    final byte[] endDataId) {
  final RocksDB readDb = getReadDb();
  if (readDb == null) {
    return new CloseableIterator.Empty<>();
  }
  final ReadOptions options;
  final RocksIterator it;
  if (endDataId == null) {
    options = null;
    it = readDb.newIterator();
  } else {
    options =
        new ReadOptions().setIterateUpperBound(
            new Slice(ByteArrayUtils.getNextPrefix(endDataId)));
    it = readDb.newIterator(options);
  }
  if (startDataId == null) {
    it.seekToFirst();
  } else {
    it.seek(startDataId);
  }
  return new DataIndexRowIterator(options, it, adapterId, visibilityEnabled);
}
 
Example #2
Source File: RocksDBIndexTable.java    From geowave with Apache License 2.0 5 votes vote down vote up
public CloseableIterator<GeoWaveRow> iterator(final ByteArrayRange range) {
  final RocksDB readDb = getReadDb();
  if (readDb == null) {
    return new CloseableIterator.Empty<>();
  }
  final ReadOptions options;
  final RocksIterator it;
  if (range.getEnd() == null) {
    options = null;
    it = readDb.newIterator();
  } else {
    options = new ReadOptions().setIterateUpperBound(new Slice(range.getEndAsNextPrefix()));
    it = readDb.newIterator(options);
  }
  if (range.getStart() == null) {
    it.seekToFirst();
  } else {
    it.seek(range.getStart());
  }

  return new RocksDBRowIterator(
      options,
      it,
      adapterId,
      partition,
      requiresTimestamp,
      visibilityEnabled);
}
 
Example #3
Source File: RocksComparatorTest.java    From Voovan with Apache License 2.0 4 votes vote down vote up
@Override
public int compare(Slice a, Slice b) {
    return (int) ((Long)TSerialize.unserialize(a.data()) - (Long)TSerialize.unserialize(b.data()));
}
 
Example #4
Source File: EzRocksDbComparator.java    From ezdb with Apache License 2.0 4 votes vote down vote up
@Override
public int compare(Slice a, Slice b) {
	return Util.compareKeys(hashKeyComparator, rangeKeyComparator, a.data(), b.data());
}