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


Java RowMutations.getMutations方法代码示例

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


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

示例1: buildRegionAction

import org.apache.hadoop.hbase.client.RowMutations; //导入方法依赖的package包/类
/**
 * Create a protocol buffer MultiRequest for row mutations.
 * Does not propagate Action absolute position.  Does not set atomic action on the created
 * RegionAtomic.  Caller should do that if wanted.
 * @param regionName
 * @param rowMutations
 * @return a data-laden RegionMutation.Builder
 * @throws IOException
 */
public static RegionAction.Builder buildRegionAction(final byte [] regionName,
    final RowMutations rowMutations)
throws IOException {
  RegionAction.Builder builder =
    getRegionActionBuilderWithRegion(RegionAction.newBuilder(), regionName);
  ClientProtos.Action.Builder actionBuilder = ClientProtos.Action.newBuilder();
  MutationProto.Builder mutationBuilder = MutationProto.newBuilder();
  for (Mutation mutation: rowMutations.getMutations()) {
    MutationType mutateType = null;
    if (mutation instanceof Put) {
      mutateType = MutationType.PUT;
    } else if (mutation instanceof Delete) {
      mutateType = MutationType.DELETE;
    } else {
      throw new DoNotRetryIOException("RowMutations supports only put and delete, not " +
        mutation.getClass().getName());
    }
    mutationBuilder.clear();
    MutationProto mp = ProtobufUtil.toMutation(mutateType, mutation, mutationBuilder);
    actionBuilder.clear();
    actionBuilder.setMutation(mp);
    builder.addAction(actionBuilder.build());
  }
  return builder;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:35,代码来源:RequestConverter.java

示例2: buildNoDataRegionAction

import org.apache.hadoop.hbase.client.RowMutations; //导入方法依赖的package包/类
/**
 * Create a protocol buffer MultiRequest for row mutations that does not hold data.  Data/Cells
 * are carried outside of protobuf.  Return references to the Cells in <code>cells</code> param.
  * Does not propagate Action absolute position.  Does not set atomic action on the created
 * RegionAtomic.  Caller should do that if wanted.
 * @param regionName
 * @param rowMutations
 * @param cells Return in here a list of Cells as CellIterable.
 * @return a region mutation minus data
 * @throws IOException
 */
public static RegionAction.Builder buildNoDataRegionAction(final byte[] regionName,
    final RowMutations rowMutations, final List<CellScannable> cells,
    final RegionAction.Builder regionActionBuilder,
    final ClientProtos.Action.Builder actionBuilder,
    final MutationProto.Builder mutationBuilder)
throws IOException {
  for (Mutation mutation: rowMutations.getMutations()) {
    MutationType type = null;
    if (mutation instanceof Put) {
      type = MutationType.PUT;
    } else if (mutation instanceof Delete) {
      type = MutationType.DELETE;
    } else {
      throw new DoNotRetryIOException("RowMutations supports only put and delete, not " +
        mutation.getClass().getName());
    }
    mutationBuilder.clear();
    MutationProto mp = ProtobufUtil.toMutationNoData(type, mutation, mutationBuilder);
    cells.add(mutation);
    actionBuilder.clear();
    regionActionBuilder.addAction(actionBuilder.setMutation(mp).build());
  }
  return regionActionBuilder;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:36,代码来源:RequestConverter.java

示例3: convertQualifiersToAliases

import org.apache.hadoop.hbase.client.RowMutations; //导入方法依赖的package包/类
RowMutations convertQualifiersToAliases(MTableDescriptor mTableDescriptor,
        final RowMutations originalRowMutations)
        throws IOException{
  RowMutations modifiedRowMutations = new RowMutations(originalRowMutations.getRow());
  for (Mutation originalMutation : originalRowMutations.getMutations()) {
    Class<?> mutationClass = originalMutation.getClass();
    if (Put.class.isAssignableFrom(mutationClass)) {
      modifiedRowMutations.add(
              convertQualifiersToAliases(mTableDescriptor, (Put)originalMutation));
    } else if (Delete.class.isAssignableFrom(mutationClass)) {
      modifiedRowMutations.add(
              convertQualifiersToAliases(mTableDescriptor, (Delete)originalMutation));
    }
  }
  return modifiedRowMutations;
}
 
开发者ID:dvimont,项目名称:ColumnManagerForHBase,代码行数:17,代码来源:Repository.java

示例4: buildRegionAction

import org.apache.hadoop.hbase.client.RowMutations; //导入方法依赖的package包/类
/**
 * Create a protocol buffer MultiRequest for row mutations.
 * Does not propagate Action absolute position.
 *
 * @param regionName   The region name the actions apply to.
 * @param rowMutations The row mutations to apply to the region
 * @return a data-laden RegionAction
 */
public static RegionAction buildRegionAction(final byte[] regionName,
                                             final RowMutations rowMutations)
    throws IOException {
  final RegionSpecifier region = buildRegionSpecifier(regionName);
  final List<Action> actions = new ArrayList<>();
  int index = 0;
  for (Mutation mutation : rowMutations.getMutations()) {
    MutationProto.MutationType mutateType;
    if (mutation instanceof Put) {
      mutateType = MutationProto.MutationType.PUT;
    } else if (mutation instanceof Delete) {
      mutateType = MutationProto.MutationType.DELETE;
    } else {
      throw new DoNotRetryIOException("RowMutations supports only put and delete, not "
          + mutation.getClass().getName());
    }
    final MutationProto mp = ProtobufUtil.toMutation(mutateType, mutation);
    final Action action = new Action(++index, mp, new c5db.client.generated.Get());
    actions.add(action);

  }
  return new RegionAction(region, true, actions);
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:32,代码来源:RequestConverter.java

示例5: buildMultiRequest

import org.apache.hadoop.hbase.client.RowMutations; //导入方法依赖的package包/类
/**
 * Create a protocol buffer MultiRequest for a row mutations
 *
 * @param regionName
 * @param rowMutations
 * @return a multi request
 * @throws IOException
 */
public static MultiRequest buildMultiRequest(final byte[] regionName,
    final RowMutations rowMutations) throws IOException {
  MultiRequest.Builder builder = MultiRequest.newBuilder();
  RegionSpecifier region = buildRegionSpecifier(
    RegionSpecifierType.REGION_NAME, regionName);
  builder.setRegion(region);
  builder.setAtomic(true);
  for (Mutation mutation: rowMutations.getMutations()) {
    MutateType mutateType = null;
    if (mutation instanceof Put) {
      mutateType = MutateType.PUT;
    } else if (mutation instanceof Delete) {
      mutateType = MutateType.DELETE;
    } else {
      throw new DoNotRetryIOException(
        "RowMutations supports only put and delete, not "
          + mutation.getClass().getName());
    }
    Mutate mutate = ProtobufUtil.toMutate(mutateType, mutation);
    builder.addAction(MultiAction.newBuilder().setMutate(mutate).build());
  }
  return builder.build();
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:32,代码来源:RequestConverter.java

示例6: buildMutateRequest

import org.apache.hadoop.hbase.client.RowMutations; //导入方法依赖的package包/类
/**
 * Create a protocol buffer MutateRequest for conditioned row mutations
 *
 * @param regionName
 * @param row
 * @param family
 * @param qualifier
 * @param comparator
 * @param compareType
 * @param rowMutations
 * @return a mutate request
 * @throws IOException
 */
public static ClientProtos.MultiRequest buildMutateRequest(
    final byte[] regionName, final byte[] row, final byte[] family,
    final byte [] qualifier, final ByteArrayComparable comparator,
    final CompareType compareType, final RowMutations rowMutations) throws IOException {
  RegionAction.Builder builder =
      getRegionActionBuilderWithRegion(RegionAction.newBuilder(), regionName);
  builder.setAtomic(true);
  ClientProtos.Action.Builder actionBuilder = ClientProtos.Action.newBuilder();
  MutationProto.Builder mutationBuilder = MutationProto.newBuilder();
  Condition condition = buildCondition(
      row, family, qualifier, comparator, compareType);
  for (Mutation mutation: rowMutations.getMutations()) {
    MutationType mutateType = null;
    if (mutation instanceof Put) {
      mutateType = MutationType.PUT;
    } else if (mutation instanceof Delete) {
      mutateType = MutationType.DELETE;
    } else {
      throw new DoNotRetryIOException("RowMutations supports only put and delete, not " +
          mutation.getClass().getName());
    }
    mutationBuilder.clear();
    MutationProto mp = ProtobufUtil.toMutation(mutateType, mutation, mutationBuilder);
    actionBuilder.clear();
    actionBuilder.setMutation(mp);
    builder.addAction(actionBuilder.build());
  }
  ClientProtos.MultiRequest request =
      ClientProtos.MultiRequest.newBuilder().addRegionAction(builder.build())
          .setCondition(condition).build();
  return request;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:46,代码来源:RequestConverter.java

示例7: putColumnAuditorSchemaEntities

import org.apache.hadoop.hbase.client.RowMutations; //导入方法依赖的package包/类
/**
 * Invoked by MTable for real-time audit of mutations.
 *
 * @param mtd MTableDescriptor
 * @param mutations RowMutations
 * @throws IOException if a remote or network exception occurs
 */
void putColumnAuditorSchemaEntities(MTableDescriptor mtd, RowMutations mutations)
        throws IOException {
  if (!isIncludedTable(mtd.getTableName())) {
    return;
  }
  for (Mutation mutation : mutations.getMutations()) {
    putColumnAuditorSchemaEntities(mtd, mutation);
  }
}
 
开发者ID:dvimont,项目名称:ColumnManagerForHBase,代码行数:17,代码来源:Repository.java

示例8: validateColumns

import org.apache.hadoop.hbase.client.RowMutations; //导入方法依赖的package包/类
void validateColumns(MTableDescriptor mtd, RowMutations mutations) throws IOException {
  if (isIncludedTable(mtd.getTableName())
          && mtd.hasColDescriptorWithColDefinitionsEnforced()) {
    for (Mutation mutation : mutations.getMutations()) {
      validateColumns(mtd, mutation);
    }
  }
}
 
开发者ID:dvimont,项目名称:ColumnManagerForHBase,代码行数:9,代码来源:Repository.java

示例9: mutateRow

import org.apache.hadoop.hbase.client.RowMutations; //导入方法依赖的package包/类
@Override
public void mutateRow(RowMutations rm) throws IOException {
  if (tx == null) {
    throw new IOException("Transaction not started");
  }
  RowMutations transactionalMutations = new RowMutations();
  for (Mutation mutation : rm.getMutations()) {
    if (mutation instanceof Put) {
      transactionalMutations.add(transactionalizeAction((Put) mutation));
    } else if (mutation instanceof Delete) {
      transactionalMutations.add(transactionalizeAction((Delete) mutation));
    }
  }
  hTable.mutateRow(transactionalMutations);
}
 
开发者ID:apache,项目名称:incubator-tephra,代码行数:16,代码来源:TransactionAwareHTable.java

示例10: checkAndMutate

import org.apache.hadoop.hbase.client.RowMutations; //导入方法依赖的package包/类
@Override
public boolean checkAndMutate(
    final byte [] row, final byte [] family, final byte [] qualifier,
    final CompareFilter.CompareOp compareOp, final byte [] value, final RowMutations rm)
    throws IOException {
  List<Mutation> adaptedMutations = new ArrayList<>();
  for (org.apache.hadoop.hbase.client.Mutation mut : rm.getMutations()) {
    adaptedMutations.addAll(mutationAdapter.adapt(mut).getMutationsList());
  }

  CheckAndMutateRowRequest.Builder requestBuilder =
      makeConditionalMutationRequestBuilder(
          row,
          family,
          qualifier,
          compareOp,
          value,
          rm.getRow(),
          adaptedMutations);

  try {
    CheckAndMutateRowResponse response =
        client.checkAndMutateRow(requestBuilder.build());
    return wasMutationApplied(requestBuilder, response);
  } catch (Throwable throwable) {
    throw new IOException(
        makeGenericExceptionMessage(
            "checkAndMutate",
            options.getProjectId(),
            tableName.getQualifierAsString(),
            row),
        throwable);
  }
}
 
开发者ID:dmmcerlean,项目名称:cloud-bigtable-client,代码行数:35,代码来源:BigtableTable.java

示例11: adapt

import org.apache.hadoop.hbase.client.RowMutations; //导入方法依赖的package包/类
public MutateRowRequest.Builder adapt(RowMutations mutations) {
  MutateRowRequest.Builder result = MutateRowRequest.newBuilder();

  result.setRowKey(ByteString.copyFrom(mutations.getRow()));

  for (Mutation mutation : mutations.getMutations()) {
    MutateRowRequest.Builder bigtableBuilder = mutationAdapter.adapt(mutation);
    result.addAllMutations(bigtableBuilder.getMutationsList());
  }

  return result;
}
 
开发者ID:dmmcerlean,项目名称:cloud-bigtable-client,代码行数:13,代码来源:RowMutationsAdapter.java

示例12: mutateRow

import org.apache.hadoop.hbase.client.RowMutations; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void mutateRow(RowMutations rm) throws IOException {
    // currently only support Put and Delete
    for (Mutation mutation : rm.getMutations()) {
        if (mutation instanceof Put) {
            put((Put) mutation);
        } else if (mutation instanceof Delete) {
            delete((Delete) mutation);
        }
    }
}
 
开发者ID:apache,项目名称:kylin,代码行数:15,代码来源:MockHTable.java

示例13: mutateRow

import org.apache.hadoop.hbase.client.RowMutations; //导入方法依赖的package包/类
@Override
public void mutateRow(RowMutations rm) throws IOException {
  // Don't need nonces here - RowMutations only supports puts and deletes
  final List<Mutation> m = rm.getMutations();
  batchMutate(m.toArray(new Mutation[m.size()]), true, HConstants.NO_NONCE,
      HConstants.NO_NONCE);
}
 
开发者ID:apache,项目名称:hbase,代码行数:8,代码来源:HRegion.java


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