use of org.apache.bookkeeper.stream.proto.kv.rpc.PutRequest in project bookkeeper by apache.
the class TestKvUtils method testNewPutRequest.
@Test
public void testNewPutRequest() {
try (PutOption<ByteBuf> option = Options.putAndGet()) {
PutRequest rr = newPutRequest(key, value, option).build();
assertEquals(keyBs, rr.getKey());
assertEquals(valueBs, rr.getValue());
assertTrue(rr.getPrevKv());
assertFalse(rr.hasHeader());
}
}
use of org.apache.bookkeeper.stream.proto.kv.rpc.PutRequest in project bookkeeper by apache.
the class StorageContainerImpl method put.
@Override
public CompletableFuture<StorageContainerResponse> put(StorageContainerRequest request) {
checkArgument(KV_PUT_REQ == request.getRequestCase());
long scId = request.getScId();
PutRequest rr = request.getKvPutReq();
RoutingHeader header = rr.getHeader();
RangeId rid = RangeId.of(header.getStreamId(), header.getRangeId());
TableStore store = tableStoreCache.getTableStore(rid);
if (null != store) {
return store.put(request);
} else {
return tableStoreCache.openTableStore(scId, rid).thenCompose(s -> s.put(request));
}
}
Aggregations