Exemplo n.º 1
0
 private GetResponse doGetResponse(GetRequest request) {
   ClientProtos.Result.Builder resultBuilder = ClientProtos.Result.newBuilder();
   ByteString row = request.getGet().getRow();
   resultBuilder.addCell(getStartCode(row));
   GetResponse.Builder builder = GetResponse.newBuilder();
   builder.setResult(resultBuilder.build());
   return builder.build();
 }
Exemplo n.º 2
0
 static GetResponse doMetaGetResponse(
     final SortedMap<byte[], Pair<HRegionInfo, ServerName>> meta, final GetRequest request) {
   ClientProtos.Result.Builder resultBuilder = ClientProtos.Result.newBuilder();
   ByteString row = request.getGet().getRow();
   Pair<HRegionInfo, ServerName> p = meta.get(row.toByteArray());
   if (p == null) {
     if (request.getGet().getClosestRowBefore()) {
       byte[] bytes = row.toByteArray();
       SortedMap<byte[], Pair<HRegionInfo, ServerName>> head =
           bytes != null ? meta.headMap(bytes) : meta;
       p = head == null ? null : head.get(head.lastKey());
     }
   }
   if (p != null) {
     resultBuilder.addCell(getRegionInfo(row, p.getFirst()));
     resultBuilder.addCell(getServer(row, p.getSecond()));
   }
   resultBuilder.addCell(getStartCode(row));
   GetResponse.Builder builder = GetResponse.newBuilder();
   builder.setResult(resultBuilder.build());
   return builder.build();
 }