コード例 #1
0
 @Override
 public RowSwapProcessorRequest getRequestData() throws IOException {
   RowSwapProcessorRequest.Builder builder = RowSwapProcessorRequest.newBuilder();
   builder.setRow1(ByteStringer.wrap(row1));
   builder.setRow2(ByteStringer.wrap(row2));
   return builder.build();
 }
コード例 #2
0
 @Override
 public FriendsOfFriendsProcessorRequest getRequestData() throws IOException {
   FriendsOfFriendsProcessorRequest.Builder builder =
       FriendsOfFriendsProcessorRequest.newBuilder();
   builder.setPerson(ByteStringer.wrap(person));
   builder.setRow(ByteStringer.wrap(row));
   builder.addAllResult(result);
   FriendsOfFriendsProcessorRequest f = builder.build();
   return f;
 }
コード例 #3
0
 @Override
 public IncCounterProcessorRequest getRequestData() throws IOException {
   IncCounterProcessorRequest.Builder builder = IncCounterProcessorRequest.newBuilder();
   builder.setCounter(counter);
   builder.setRow(ByteStringer.wrap(row));
   return builder.build();
 }
コード例 #4
0
ファイル: HRegionInfo.java プロジェクト: dobromyslov/hbase
 /**
  * Convert a HRegionInfo to a RegionInfo
  *
  * @param info the HRegionInfo to convert
  * @return the converted RegionInfo
  */
 public static RegionInfo convert(final HRegionInfo info) {
   if (info == null) return null;
   RegionInfo.Builder builder = RegionInfo.newBuilder();
   builder.setTableName(ProtobufUtil.toProtoTableName(info.getTable()));
   builder.setRegionId(info.getRegionId());
   if (info.getStartKey() != null) {
     builder.setStartKey(ByteStringer.wrap(info.getStartKey()));
   }
   if (info.getEndKey() != null) {
     builder.setEndKey(ByteStringer.wrap(info.getEndKey()));
   }
   builder.setOffline(info.isOffline());
   builder.setSplit(info.isSplit());
   builder.setReplicaId(info.getReplicaId());
   return builder.build();
 }
コード例 #5
0
 /** @return The filter serialized using pb */
 public byte[] toByteArray() {
   FilterProtos.MultipleColumnPrefixFilter.Builder builder =
       FilterProtos.MultipleColumnPrefixFilter.newBuilder();
   for (byte[] element : sortedPrefixes) {
     if (element != null) builder.addSortedPrefixes(ByteStringer.wrap(element));
   }
   return builder.build().toByteArray();
 }
コード例 #6
0
ファイル: WALKey.java プロジェクト: huanyuqianlun/hbase
 public org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALKey.Builder getBuilder(
     WALCellCodec.ByteStringCompressor compressor) throws IOException {
   org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALKey.Builder builder =
       org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALKey.newBuilder();
   if (compressionContext == null) {
     builder.setEncodedRegionName(ByteStringer.wrap(this.encodedRegionName));
     builder.setTableName(ByteStringer.wrap(this.tablename.getName()));
   } else {
     builder.setEncodedRegionName(
         compressor.compress(this.encodedRegionName, compressionContext.regionDict));
     builder.setTableName(
         compressor.compress(this.tablename.getName(), compressionContext.tableDict));
   }
   builder.setLogSequenceNumber(this.logSeqNum);
   builder.setWriteTime(writeTime);
   if (this.origLogSeqNum > 0) {
     builder.setOrigSequenceNumber(this.origLogSeqNum);
   }
   if (this.nonce != HConstants.NO_NONCE) {
     builder.setNonce(nonce);
   }
   if (this.nonceGroup != HConstants.NO_NONCE) {
     builder.setNonceGroup(nonceGroup);
   }
   HBaseProtos.UUID.Builder uuidBuilder = HBaseProtos.UUID.newBuilder();
   for (UUID clusterId : clusterIds) {
     uuidBuilder.setLeastSigBits(clusterId.getLeastSignificantBits());
     uuidBuilder.setMostSigBits(clusterId.getMostSignificantBits());
     builder.addClusterIds(uuidBuilder.build());
   }
   if (scopes != null) {
     for (Map.Entry<byte[], Integer> e : scopes.entrySet()) {
       ByteString family =
           (compressionContext == null)
               ? ByteStringer.wrap(e.getKey())
               : compressor.compress(e.getKey(), compressionContext.familyDict);
       builder.addScopes(
           FamilyScope.newBuilder()
               .setFamily(family)
               .setScopeType(ScopeType.valueOf(e.getValue())));
     }
   }
   return builder;
 }
コード例 #7
0
ファイル: CustomFilter.java プロジェクト: Zod-Li/hbase-book
 @Override
 public byte[] toByteArray() {
   FilterProtos.CustomFilter.Builder builder = FilterProtos.CustomFilter.newBuilder();
   if (value != null)
     builder.setValue(
         ByteStringer.wrap(
             value)); // co CustomFilter-6-Write Writes the given value out so it can be sent to
                      // the servers.
   return builder.build().toByteArray();
 }
コード例 #8
0
 @Override
 public TimeoutProcessorRequest getRequestData() throws IOException {
   TimeoutProcessorRequest.Builder builder = TimeoutProcessorRequest.newBuilder();
   builder.setRow(ByteStringer.wrap(row));
   return builder.build();
 }