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


Java MultiRowMutationProtos类代码示例

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


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

示例1: multiMutate

import org.apache.hadoop.hbase.protobuf.generated.MultiRowMutationProtos; //导入依赖的package包/类
/**
 * Performs an atomic multi-Mutate operation against the given table.
 */
private static void multiMutate(Table table, byte[] row, Mutation... mutations)
    throws IOException {
  CoprocessorRpcChannel channel = table.coprocessorService(row);
  MultiRowMutationProtos.MutateRowsRequest.Builder mmrBuilder
    = MultiRowMutationProtos.MutateRowsRequest.newBuilder();
  for (Mutation mutation : mutations) {
    if (mutation instanceof Put) {
      mmrBuilder.addMutationRequest(ProtobufUtil.toMutation(
        ClientProtos.MutationProto.MutationType.PUT, mutation));
    } else if (mutation instanceof Delete) {
      mmrBuilder.addMutationRequest(ProtobufUtil.toMutation(
        ClientProtos.MutationProto.MutationType.DELETE, mutation));
    } else {
      throw new DoNotRetryIOException("multi in MetaEditor doesn't support "
        + mutation.getClass().getName());
    }
  }

  MultiRowMutationProtos.MultiRowMutationService.BlockingInterface service =
    MultiRowMutationProtos.MultiRowMutationService.newBlockingStub(channel);
  try {
    service.mutateRows(null, mmrBuilder.build());
  } catch (ServiceException ex) {
    ProtobufUtil.toIOException(ex);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:MetaTableAccessor.java

示例2: multiMutate

import org.apache.hadoop.hbase.protobuf.generated.MultiRowMutationProtos; //导入依赖的package包/类
/**
 * Performs an atomic multi-Mutate operation against the given table.
 */
private static void multiMutate(Table table, byte[] row, Mutation... mutations)
        throws IOException {
    CoprocessorRpcChannel channel = table.coprocessorService(row);
    MultiRowMutationProtos.MutateRowsRequest.Builder mmrBuilder
            = MultiRowMutationProtos.MutateRowsRequest.newBuilder();
    for (Mutation mutation : mutations) {
        if (mutation instanceof Put) {
            mmrBuilder.addMutationRequest(ProtobufUtil.toMutation(
                    ClientProtos.MutationProto.MutationType.PUT, mutation));
        } else if (mutation instanceof Delete) {
            mmrBuilder.addMutationRequest(ProtobufUtil.toMutation(
                    ClientProtos.MutationProto.MutationType.DELETE, mutation));
        } else {
            throw new DoNotRetryIOException("multi in MetaEditor doesn't support "
                    + mutation.getClass().getName());
        }
    }

    MultiRowMutationProtos.MultiRowMutationService.BlockingInterface service =
            MultiRowMutationProtos.MultiRowMutationService.newBlockingStub(channel);
    try {
        service.mutateRows(null, mmrBuilder.build());
    } catch (ServiceException ex) {
        ProtobufUtil.toIOException(ex);
    }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:30,代码来源:MetaTableAccessor.java

示例3: multiMutate

import org.apache.hadoop.hbase.protobuf.generated.MultiRowMutationProtos; //导入依赖的package包/类
private void multiMutate(List<Mutation> mutations) throws IOException {
  CoprocessorRpcChannel channel = rsGroupTable.coprocessorService(ROW_KEY);
  MultiRowMutationProtos.MutateRowsRequest.Builder mmrBuilder
    = MultiRowMutationProtos.MutateRowsRequest.newBuilder();
  for (Mutation mutation : mutations) {
    if (mutation instanceof Put) {
      mmrBuilder.addMutationRequest(org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(
          org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType.PUT,
          mutation));
    } else if (mutation instanceof Delete) {
      mmrBuilder.addMutationRequest(
          org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(
              org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.
                MutationType.DELETE, mutation));
    } else {
      throw new DoNotRetryIOException("multiMutate doesn't support "
        + mutation.getClass().getName());
    }
  }

  MultiRowMutationProtos.MultiRowMutationService.BlockingInterface service =
    MultiRowMutationProtos.MultiRowMutationService.newBlockingStub(channel);
  try {
    service.mutateRows(null, mmrBuilder.build());
  } catch (ServiceException ex) {
    ProtobufUtil.toIOException(ex);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:29,代码来源:RSGroupInfoManagerImpl.java

示例4: multiMutate

import org.apache.hadoop.hbase.protobuf.generated.MultiRowMutationProtos; //导入依赖的package包/类
/**
 * Performs an atomic multi-mutate operation against the given table.
 */
// Used by the RSGroup Coprocessor Endpoint. It had a copy/paste of the below. Need to reveal
// this facility for CPEP use or at least those CPEPs that are on their way to becoming part of
// core as is the intent for RSGroup eventually.
public static void multiMutate(Connection connection, final Table table, byte[] row,
    final List<Mutation> mutations)
throws IOException {
  debugLogMutations(mutations);
  // TODO: Need rollback!!!!
  // TODO: Need Retry!!!
  // TODO: What for a timeout? Default write timeout? GET FROM HTABLE?
  // TODO: Review when we come through with ProcedureV2.
  RegionServerCallable<MutateRowsResponse,
      MultiRowMutationProtos.MultiRowMutationService.BlockingInterface> callable =
      new RegionServerCallable<MutateRowsResponse,
        MultiRowMutationProtos.MultiRowMutationService.BlockingInterface>(
            connection, table.getName(), row, null/*RpcController not used in this CPEP!*/) {
    @Override
    protected MutateRowsResponse rpcCall() throws Exception {
      final MutateRowsRequest.Builder builder = MutateRowsRequest.newBuilder();
      for (Mutation mutation : mutations) {
        if (mutation instanceof Put) {
          builder.addMutationRequest(ProtobufUtil.toMutation(
            ClientProtos.MutationProto.MutationType.PUT, mutation));
        } else if (mutation instanceof Delete) {
          builder.addMutationRequest(ProtobufUtil.toMutation(
            ClientProtos.MutationProto.MutationType.DELETE, mutation));
        } else {
          throw new DoNotRetryIOException("multi in MetaEditor doesn't support "
            + mutation.getClass().getName());
        }
      }
      // The call to #prepare that ran before this invocation will have populated HRegionLocation.
      HRegionLocation hrl = getLocation();
      RegionSpecifier region = ProtobufUtil.buildRegionSpecifier(
          RegionSpecifierType.REGION_NAME, hrl.getRegionInfo().getRegionName());
      builder.setRegion(region);
      // The rpcController here is awkward. The Coprocessor Endpoint wants an instance of a
      // com.google.protobuf but we are going over an rpc that is all shaded protobuf so it
      // wants a org.apache.h.h.shaded.com.google.protobuf.RpcController. Set up a factory
      // that makes com.google.protobuf.RpcController and then copy into it configs.
      return getStub().mutateRows(null, builder.build());
    }

    @Override
    // Called on the end of the super.prepare call. Set the stub.
    protected void setStubByServiceName(ServerName serviceName/*Ignored*/) throws IOException {
      CoprocessorRpcChannel channel = table.coprocessorService(getRow());
      setStub(MultiRowMutationProtos.MultiRowMutationService.newBlockingStub(channel));
    }
  };
  int writeTimeout = connection.getConfiguration().getInt(HConstants.HBASE_RPC_WRITE_TIMEOUT_KEY,
      connection.getConfiguration().getInt(HConstants.HBASE_RPC_TIMEOUT_KEY,
          HConstants.DEFAULT_HBASE_RPC_TIMEOUT));
  // The region location should be cached in connection. Call prepare so this callable picks
  // up the region location (see super.prepare method).
  callable.prepare(false);
  callable.call(writeTimeout);
}
 
开发者ID:apache,项目名称:hbase,代码行数:62,代码来源:MetaTableAccessor.java


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