use of org.apache.bookkeeper.stream.proto.kv.rpc.DeleteRangeResponse in project bookkeeper by apache.
the class TableStoreImplTest method deleteKeyFromTableStore.
KeyValue deleteKeyFromTableStore(int key) throws Exception {
StorageContainerResponse response = result(tableStore.delete(StorageContainerRequest.newBuilder().setScId(SC_ID).setKvDeleteReq(DeleteRangeRequest.newBuilder().setHeader(HEADER).setKey(getKey(key)).setPrevKv(true).build()).build()));
assertEquals(StatusCode.SUCCESS, response.getCode());
assertEquals(ResponseCase.KV_DELETE_RESP, response.getResponseCase());
DeleteRangeResponse delResp = response.getKvDeleteResp();
assertEquals(HEADER, delResp.getHeader().getRoutingHeader());
if (0 == delResp.getPrevKvsCount()) {
return null;
} else {
return delResp.getPrevKvs(0);
}
}
use of org.apache.bookkeeper.stream.proto.kv.rpc.DeleteRangeResponse in project bookkeeper by apache.
the class TableStoreImplTest method deleteRange.
List<KeyValue> deleteRange(int startKey, int endKey) throws Exception {
StorageContainerResponse response = result(tableStore.delete(StorageContainerRequest.newBuilder().setScId(SC_ID).setKvDeleteReq(DeleteRangeRequest.newBuilder().setHeader(HEADER).setKey(getKey(startKey)).setRangeEnd(getKey(endKey)).setPrevKv(true).build()).build()));
assertEquals(StatusCode.SUCCESS, response.getCode());
assertEquals(ResponseCase.KV_DELETE_RESP, response.getResponseCase());
DeleteRangeResponse delResp = response.getKvDeleteResp();
assertEquals(HEADER, delResp.getHeader().getRoutingHeader());
return delResp.getPrevKvsList();
}
Aggregations