当前位置: 首页>>代码示例>>Java>>正文


Java HBaseProtos.RegionSpecifier方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier方法的典型用法代码示例。如果您正苦于以下问题:Java HBaseProtos.RegionSpecifier方法的具体用法?Java HBaseProtos.RegionSpecifier怎么用?Java HBaseProtos.RegionSpecifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.protobuf.generated.HBaseProtos的用法示例。


在下文中一共展示了HBaseProtos.RegionSpecifier方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createServerLoadProto

import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
private ClusterStatusProtos.ServerLoad createServerLoadProto() {
  HBaseProtos.RegionSpecifier rSpecOne =
      HBaseProtos.RegionSpecifier.newBuilder()
          .setType(HBaseProtos.RegionSpecifier.RegionSpecifierType.ENCODED_REGION_NAME)
          .setValue(ByteString.copyFromUtf8("ASDFGQWERT")).build();
  HBaseProtos.RegionSpecifier rSpecTwo =
      HBaseProtos.RegionSpecifier.newBuilder()
          .setType(HBaseProtos.RegionSpecifier.RegionSpecifierType.ENCODED_REGION_NAME)
          .setValue(ByteString.copyFromUtf8("QWERTYUIOP")).build();

  ClusterStatusProtos.RegionLoad rlOne =
      ClusterStatusProtos.RegionLoad.newBuilder().setRegionSpecifier(rSpecOne).setStores(10)
          .setStorefiles(101).setStoreUncompressedSizeMB(106).setStorefileSizeMB(520)
          .setStorefileIndexSizeMB(42).setRootIndexSizeKB(201).setReadRequestsCount(Integer.MAX_VALUE).setWriteRequestsCount(Integer.MAX_VALUE).build();
  ClusterStatusProtos.RegionLoad rlTwo =
      ClusterStatusProtos.RegionLoad.newBuilder().setRegionSpecifier(rSpecTwo).setStores(3)
          .setStorefiles(13).setStoreUncompressedSizeMB(23).setStorefileSizeMB(300)
          .setStorefileIndexSizeMB(40).setRootIndexSizeKB(303).setReadRequestsCount(Integer.MAX_VALUE).setWriteRequestsCount(Integer.MAX_VALUE).build();

  ClusterStatusProtos.ServerLoad sl =
      ClusterStatusProtos.ServerLoad.newBuilder().addRegionLoads(rlOne).
        addRegionLoads(rlTwo).build();
  return sl;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:25,代码来源:TestServerLoad.java

示例2: createServerLoadProto

import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
private ClusterStatusProtos.ServerLoad createServerLoadProto() {
  HBaseProtos.RegionSpecifier rSpecOne =
      HBaseProtos.RegionSpecifier.newBuilder()
          .setType(HBaseProtos.RegionSpecifier.RegionSpecifierType.ENCODED_REGION_NAME)
          .setValue(ByteString.copyFromUtf8("ASDFGQWERT")).build();
  HBaseProtos.RegionSpecifier rSpecTwo =
      HBaseProtos.RegionSpecifier.newBuilder()
          .setType(HBaseProtos.RegionSpecifier.RegionSpecifierType.ENCODED_REGION_NAME)
          .setValue(ByteString.copyFromUtf8("QWERTYUIOP")).build();

  ClusterStatusProtos.RegionLoad rlOne =
      ClusterStatusProtos.RegionLoad.newBuilder().setRegionSpecifier(rSpecOne).setStores(10)
          .setStorefiles(101).setStoreUncompressedSizeMB(106).setStorefileSizeMB(520)
          .setStorefileIndexSizeMB(42).setRootIndexSizeKB(201).build();
  ClusterStatusProtos.RegionLoad rlTwo =
      ClusterStatusProtos.RegionLoad.newBuilder().setRegionSpecifier(rSpecTwo).setStores(3)
          .setStorefiles(13).setStoreUncompressedSizeMB(23).setStorefileSizeMB(300)
          .setStorefileIndexSizeMB(40).setRootIndexSizeKB(303).build();

  ClusterStatusProtos.ServerLoad sl =
      ClusterStatusProtos.ServerLoad.newBuilder().addRegionLoads(rlOne).
        addRegionLoads(rlTwo).build();
  return sl;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:25,代码来源:TestServerLoad.java

示例3: getResults

import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
/**
 * Get the results from a protocol buffer MultiResponse
 *
 * @param request the protocol buffer MultiResponse to convert
 * @param cells Cells to go with the passed in <code>proto</code>.  Can be null.
 * @return the results that were in the MultiResponse (a Result or an Exception).
 * @throws IOException
 */
public static org.apache.hadoop.hbase.client.MultiResponse getResults(final MultiRequest request,
    final MultiResponse response, final CellScanner cells)
throws IOException {
  int requestRegionActionCount = request.getRegionActionCount();
  int responseRegionActionResultCount = response.getRegionActionResultCount();
  if (requestRegionActionCount != responseRegionActionResultCount) {
    throw new IllegalStateException("Request mutation count=" + responseRegionActionResultCount +
        " does not match response mutation result count=" + responseRegionActionResultCount);
  }

  org.apache.hadoop.hbase.client.MultiResponse results =
    new org.apache.hadoop.hbase.client.MultiResponse();

  for (int i = 0; i < responseRegionActionResultCount; i++) {
    RegionAction actions = request.getRegionAction(i);
    RegionActionResult actionResult = response.getRegionActionResult(i);
    HBaseProtos.RegionSpecifier rs = actions.getRegion();
    if (rs.hasType() &&
        (rs.getType() != HBaseProtos.RegionSpecifier.RegionSpecifierType.REGION_NAME)){
      throw new IllegalArgumentException(
          "We support only encoded types for protobuf multi response.");
    }
    byte[] regionName = rs.getValue().toByteArray();

    if (actionResult.hasException()) {
      Throwable regionException =  ProtobufUtil.toException(actionResult.getException());
      results.addException(regionName, regionException);
      continue;
    }

    if (actions.getActionCount() != actionResult.getResultOrExceptionCount()) {
      throw new IllegalStateException("actions.getActionCount=" + actions.getActionCount() +
          ", actionResult.getResultOrExceptionCount=" +
          actionResult.getResultOrExceptionCount() + " for region " + actions.getRegion());
    }

    for (ResultOrException roe : actionResult.getResultOrExceptionList()) {
      Object responseValue;
      if (roe.hasException()) {
        responseValue = ProtobufUtil.toException(roe.getException());
      } else if (roe.hasResult()) {
        responseValue = ProtobufUtil.toResult(roe.getResult(), cells);
        // add the load stats, if we got any
        if (roe.hasLoadStats()) {
          ((Result) responseValue).addResults(roe.getLoadStats());
        }
      } else if (roe.hasServiceResult()) {
        responseValue = roe.getServiceResult();
      } else {
        // no result & no exception. Unexpected.
        throw new IllegalStateException("No result & no exception roe=" + roe +
            " for region " + actions.getRegion());
      }
      results.add(regionName, roe.getIndex(), responseValue);
    }
  }

  return results;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:68,代码来源:ResponseConverter.java

示例4: getResults

import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
/**
 * Get the results from a protocol buffer MultiResponse
 *
 * @param request the protocol buffer MultiResponse to convert
 * @param cells Cells to go with the passed in <code>proto</code>.  Can be null.
 * @return the results that were in the MultiResponse (a Result or an Exception).
 * @throws IOException
 */
public static org.apache.hadoop.hbase.client.MultiResponse getResults(final MultiRequest request,
    final MultiResponse response, final CellScanner cells)
throws IOException {
  int requestRegionActionCount = request.getRegionActionCount();
  int responseRegionActionResultCount = response.getRegionActionResultCount();
  if (requestRegionActionCount != responseRegionActionResultCount) {
    throw new IllegalStateException("Request mutation count=" + responseRegionActionResultCount +
        " does not match response mutation result count=" + responseRegionActionResultCount);
  }

  org.apache.hadoop.hbase.client.MultiResponse results =
    new org.apache.hadoop.hbase.client.MultiResponse();

  for (int i = 0; i < responseRegionActionResultCount; i++) {
    RegionAction actions = request.getRegionAction(i);
    RegionActionResult actionResult = response.getRegionActionResult(i);
    HBaseProtos.RegionSpecifier rs = actions.getRegion();
    if (rs.hasType() &&
        (rs.getType() != HBaseProtos.RegionSpecifier.RegionSpecifierType.REGION_NAME)){
      throw new IllegalArgumentException(
          "We support only encoded types for protobuf multi response.");
    }
    byte[] regionName = rs.getValue().toByteArray();

    if (actionResult.hasException()){
      Throwable regionException =  ProtobufUtil.toException(actionResult.getException());
      results.addException(regionName, regionException);
      continue;
    }

    if (actions.getActionCount() != actionResult.getResultOrExceptionCount()) {
      throw new IllegalStateException("actions.getActionCount=" + actions.getActionCount() +
          ", actionResult.getResultOrExceptionCount=" +
          actionResult.getResultOrExceptionCount() + " for region " + actions.getRegion());
    }

    for (ResultOrException roe : actionResult.getResultOrExceptionList()) {
      if (roe.hasException()) {
        results.add(regionName, new Pair<Integer, Object>(roe.getIndex(),
            ProtobufUtil.toException(roe.getException())));
      } else if (roe.hasResult()) {
        results.add(regionName, new Pair<Integer, Object>(roe.getIndex(),
            ProtobufUtil.toResult(roe.getResult(), cells)));
      } else if (roe.hasServiceResult()) {
        results.add(regionName, roe.getIndex(), roe.getServiceResult());
      } else {
        // no result & no exception. Unexpected.
        throw new IllegalStateException("No result & no exception roe=" + roe +
            " for region " + actions.getRegion());
      }
    }
  }

  return results;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:64,代码来源:ResponseConverter.java


注:本文中的org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。