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


Java MutationType.DELETE属性代码示例

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


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

示例1: buildRegionAction

/**
 * 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,代码行数:34,代码来源:RequestConverter.java

示例2: buildNoDataRegionAction

/**
 * 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,代码行数:35,代码来源:RequestConverter.java

示例3: toMutation

public static MutationProto toMutation(final MutationType type, final Mutation mutation,
    MutationProto.Builder builder)
throws IOException {
  builder = getMutationBuilderAndSetCommonFields(type, mutation, builder);
  ColumnValue.Builder columnBuilder = ColumnValue.newBuilder();
  QualifierValue.Builder valueBuilder = QualifierValue.newBuilder();
  for (Map.Entry<byte[],List<Cell>> family: mutation.getFamilyCellMap().entrySet()) {
    columnBuilder.clear();
    columnBuilder.setFamily(ZeroCopyLiteralByteString.wrap(family.getKey()));
    for (Cell cell: family.getValue()) {
      KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
      valueBuilder.setQualifier(ZeroCopyLiteralByteString.wrap(
          kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength()));
      valueBuilder.setValue(ZeroCopyLiteralByteString.wrap(
          kv.getValueArray(), kv.getValueOffset(), kv.getValueLength()));
      valueBuilder.setTimestamp(kv.getTimestamp());
      if (type == MutationType.DELETE) {
        KeyValue.Type keyValueType = KeyValue.Type.codeToType(kv.getType());
        valueBuilder.setDeleteType(toDeleteType(keyValueType));
      }
      columnBuilder.addQualifierValue(valueBuilder.build());
    }
    builder.addColumnValue(columnBuilder.build());
  }
  return builder.build();
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:26,代码来源:ProtobufUtil.java

示例4: serialize

@Override
public void serialize(Mutation mutation) throws IOException {
  MutationType type;
  if (mutation instanceof Put) {
    type = MutationType.PUT;
  } else if (mutation instanceof Delete) {
    type = MutationType.DELETE;
  } else {
    throw new IllegalArgumentException("Only Put and Delete are supported");
  }
  ProtobufUtil.toMutation(type, mutation).writeDelimitedTo(out);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:12,代码来源:MutationSerialization.java

示例5: buildMutateRequest

/**
 * 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,代码行数:45,代码来源:RequestConverter.java

示例6: toMutation

/**
 * Convert a MutateRequest to Mutation
 *
 * @param proto the protocol buffer Mutate to convert
 * @return the converted Mutation
 * @throws IOException
 */
public static Mutation toMutation(final MutationProto proto) throws IOException {
  MutationType type = proto.getMutateType();
  if (type == MutationType.APPEND) {
    return toAppend(proto, null);
  }
  if (type == MutationType.DELETE) {
    return toDelete(proto, null);
  }
  if (type == MutationType.PUT) {
    return toPut(proto, null);
  }
  throw new IOException("Unknown mutation type " + type);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:ProtobufUtil.java

示例7: getType

private static MutationType getType(Mutation mutation) {
  if (mutation instanceof Put) {
    return MutationType.PUT;
  } else if (mutation instanceof Delete) {
    return MutationType.DELETE;
  } else {
    // Increment and Append are not idempotent.  They should not be used in distributed jobs.
    throw new IllegalArgumentException("Only Put and Delete are supported");
  }
}
 
开发者ID:apache,项目名称:beam,代码行数:10,代码来源:HBaseMutationCoder.java


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