Search in sources :

Example 1 with DeleteRangeResponse

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);
    }
}
Also used : DeleteRangeResponse(org.apache.bookkeeper.stream.proto.kv.rpc.DeleteRangeResponse) StorageContainerResponse(org.apache.bookkeeper.stream.proto.storage.StorageContainerResponse)

Example 2 with DeleteRangeResponse

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();
}
Also used : DeleteRangeResponse(org.apache.bookkeeper.stream.proto.kv.rpc.DeleteRangeResponse) StorageContainerResponse(org.apache.bookkeeper.stream.proto.storage.StorageContainerResponse)

Aggregations

DeleteRangeResponse (org.apache.bookkeeper.stream.proto.kv.rpc.DeleteRangeResponse)2 StorageContainerResponse (org.apache.bookkeeper.stream.proto.storage.StorageContainerResponse)2