use of org.apache.bookkeeper.stream.proto.kv.rpc.RangeRequest in project bookkeeper by apache.
the class TestKvUtils method testNewRangeRequest.
@Test
public void testNewRangeRequest() {
try (RangeOption<ByteBuf> rangeOption = optionFactory.newRangeOption().endKey(key.retainedDuplicate()).countOnly(true).keysOnly(true).limit(10).maxCreateRev(1234L).minCreateRev(234L).maxModRev(2345L).minModRev(1235L).build()) {
RangeRequest rr = newRangeRequest(key, rangeOption).build();
assertEquals(keyBs, rr.getKey());
assertEquals(keyBs, rr.getRangeEnd());
assertTrue(rr.getCountOnly());
assertTrue(rr.getKeysOnly());
assertEquals(10, rr.getLimit());
assertEquals(1234L, rr.getMaxCreateRevision());
assertEquals(234L, rr.getMinCreateRevision());
assertEquals(2345L, rr.getMaxModRevision());
assertEquals(1235L, rr.getMinModRevision());
assertFalse(rr.hasHeader());
}
}
use of org.apache.bookkeeper.stream.proto.kv.rpc.RangeRequest in project bookkeeper by apache.
the class StorageContainerImpl method range.
//
// Table API
//
@Override
public CompletableFuture<StorageContainerResponse> range(StorageContainerRequest request) {
checkArgument(KV_RANGE_REQ == request.getRequestCase());
long scId = request.getScId();
RangeRequest rr = request.getKvRangeReq();
RoutingHeader header = rr.getHeader();
RangeId rid = RangeId.of(header.getStreamId(), header.getRangeId());
TableStore store = tableStoreCache.getTableStore(rid);
if (null != store) {
return store.range(request);
} else {
return tableStoreCache.openTableStore(scId, rid).thenCompose(s -> s.range(request));
}
}
Aggregations