use of org.apache.bookkeeper.stream.proto.kv.rpc.DeleteRangeRequest in project bookkeeper by apache.
the class StorageContainerImpl method delete.
@Override
public CompletableFuture<StorageContainerResponse> delete(StorageContainerRequest request) {
checkArgument(KV_DELETE_REQ == request.getRequestCase());
long scId = request.getScId();
DeleteRangeRequest rr = request.getKvDeleteReq();
RoutingHeader header = rr.getHeader();
RangeId rid = RangeId.of(header.getStreamId(), header.getRangeId());
TableStore store = tableStoreCache.getTableStore(rid);
if (null != store) {
return store.delete(request);
} else {
return tableStoreCache.openTableStore(scId, rid).thenCompose(s -> s.delete(request));
}
}
use of org.apache.bookkeeper.stream.proto.kv.rpc.DeleteRangeRequest in project bookkeeper by apache.
the class TestKvUtils method testNewDeleteRequest.
@Test
public void testNewDeleteRequest() {
try (DeleteOption<ByteBuf> option = optionFactory.newDeleteOption().endKey(key.retainedDuplicate()).prevKv(true).build()) {
DeleteRangeRequest rr = newDeleteRequest(key, option).build();
assertEquals(keyBs, rr.getKey());
assertEquals(keyBs, rr.getRangeEnd());
assertTrue(rr.getPrevKv());
assertFalse(rr.hasHeader());
}
}
Aggregations