org.apache.hadoop.hbase.client.Append.getTimeRange()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(185)

本文整理了Java中org.apache.hadoop.hbase.client.Append.getTimeRange()方法的一些代码示例,展示了Append.getTimeRange()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Append.getTimeRange()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Append
类名称:Append
方法名:getTimeRange

Append.getTimeRange介绍

[英]Gets the TimeRange used for this append.
[中]获取用于此附加的时间范围。

代码示例

代码示例来源:origin: apache/hbase

/**
 * Copy constructor
 * @param appendToCopy append to copy
 */
public Append(Append appendToCopy) {
 super(appendToCopy);
 this.tr = appendToCopy.getTimeRange();
}

代码示例来源:origin: apache/hbase

@Override
 public Result preAppend(final ObserverContext<RegionCoprocessorEnvironment> e,
   final Append append) throws IOException {
  NavigableMap<byte [], List<Cell>> map = append.getFamilyCellMap();
  for (Map.Entry<byte [], List<Cell>> entry : map.entrySet()) {
   for (Cell cell : entry.getValue()) {
    String appendStr = Bytes.toString(cell.getValueArray(), cell.getValueOffset(),
      cell.getValueLength());
    if (appendStr.equals("b")) {
     tr10 = append.getTimeRange();
    } else if (appendStr.equals("c") && !append.getTimeRange().isAllTime()) {
     tr2 = append.getTimeRange();
    }
   }
  }
  return null;
 }
}

代码示例来源:origin: apache/hbase

break;
case APPEND:
 tr = ((Append)mutation).getTimeRange();
 break;
default:

代码示例来源:origin: apache/hbase

public static MutationProto toMutationNoData(final MutationType type, final Mutation mutation,
  final MutationProto.Builder builder, long nonce) throws IOException {
 getMutationBuilderAndSetCommonFields(type, mutation, builder);
 builder.setAssociatedCellCount(mutation.size());
 if (mutation instanceof Increment) {
  builder.setTimeRange(ProtobufUtil.toTimeRange(((Increment) mutation).getTimeRange()));
 }
 if (mutation instanceof Append) {
  builder.setTimeRange(ProtobufUtil.toTimeRange(((Append) mutation).getTimeRange()));
 }
 if (nonce != HConstants.NO_NONCE) {
  builder.setNonce(nonce);
 }
 return builder.build();
}

代码示例来源:origin: org.apache.hbase/hbase-client

/**
 * Copy constructor
 * @param appendToCopy append to copy
 */
public Append(Append appendToCopy) {
 super(appendToCopy);
 this.tr = appendToCopy.getTimeRange();
}

代码示例来源:origin: apache/hbase

public static MutationProto toMutationNoData(final MutationType type, final Mutation mutation,
  final MutationProto.Builder builder, long nonce) throws IOException {
 getMutationBuilderAndSetCommonFields(type, mutation, builder);
 builder.setAssociatedCellCount(mutation.size());
 if (mutation instanceof Increment) {
  builder.setTimeRange(toTimeRange(((Increment)mutation).getTimeRange()));
 }
 if (mutation instanceof Append) {
  builder.setTimeRange(toTimeRange(((Append)mutation).getTimeRange()));
 }
 if (nonce != HConstants.NO_NONCE) {
  builder.setNonce(nonce);
 }
 return builder.build();
}

代码示例来源:origin: apache/hbase

private void assertEquals(Mutation origin, Mutation clone) {
 Assert.assertEquals(origin.getFamilyCellMap().size(), clone.getFamilyCellMap().size());
 for (byte[] family : origin.getFamilyCellMap().keySet()) {
  List<Cell> originCells = origin.getCellList(family);
  List<Cell> cloneCells = clone.getCellList(family);
  Assert.assertEquals(originCells.size(), cloneCells.size());
  for (int i = 0; i != cloneCells.size(); ++i) {
   Cell originCell = originCells.get(i);
   Cell cloneCell = cloneCells.get(i);
   assertTrue(CellUtil.equals(originCell, cloneCell));
   assertTrue(CellUtil.matchingValue(originCell, cloneCell));
  }
 }
 Assert.assertEquals(origin.getAttributesMap().size(), clone.getAttributesMap().size());
 for (String name : origin.getAttributesMap().keySet()) {
  byte[] originValue = origin.getAttributesMap().get(name);
  byte[] cloneValue = clone.getAttributesMap().get(name);
  assertTrue(Bytes.equals(originValue, cloneValue));
 }
 Assert.assertEquals(origin.getTimestamp(), clone.getTimestamp());
 Assert.assertEquals(origin.getPriority(), clone.getPriority());
 if (origin instanceof Append) {
  assertEquals(((Append)origin).getTimeRange(), ((Append)clone).getTimeRange());
 }
 if (origin instanceof Increment) {
  assertEquals(((Increment)origin).getTimeRange(), ((Increment)clone).getTimeRange());
 }
}

代码示例来源:origin: apache/hbase

builder.setTimeRange(ProtobufUtil.toTimeRange(((Append) mutation).getTimeRange()));

代码示例来源:origin: apache/hbase

builder.setTimeRange(toTimeRange(((Append) mutation).getTimeRange()));

代码示例来源:origin: apache/hbase

mutateBuilder.setTimeRange(ProtobufUtil.toTimeRange(append.getTimeRange()));
assertEquals(mutateBuilder.build(), ProtobufUtil.toMutation(MutationType.APPEND, append));

代码示例来源:origin: apache/hbase

@Override
public Result preAppendAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
  final Append append) throws IOException {
 if (append.getAttribute(CHECK_COVERING_PERM) != null) {
  // We had failure with table, cf and q perm checks and now giving a chance for cell
  // perm check
  TableName table = c.getEnvironment().getRegion().getRegionInfo().getTable();
  AuthResult authResult = null;
  User user = getActiveUser(c);
  if (checkCoveringPermission(user, OpType.APPEND, c.getEnvironment(), append.getRow(),
    append.getFamilyCellMap(), append.getTimeRange().getMax(), Action.WRITE)) {
   authResult = AuthResult.allow(OpType.APPEND.toString(),
     "Covering cell set", user, Action.WRITE, table, append.getFamilyCellMap());
  } else {
   authResult = AuthResult.deny(OpType.APPEND.toString(),
     "Covering cell set", user, Action.WRITE, table, append.getFamilyCellMap());
  }
  AccessChecker.logResult(authResult);
  if (authorizationEnabled && !authResult.isAllowed()) {
   throw new AccessDeniedException("Insufficient permissions " +
    authResult.toContextString());
  }
 }
 return null;
}

代码示例来源:origin: apache/hbase

mutateBuilder.setTimeRange(ProtobufUtil.toTimeRange(append.getTimeRange()));
assertEquals(mutateBuilder.build(), ProtobufUtil.toMutation(MutationType.APPEND, append));

代码示例来源:origin: com.aliyun.hbase/alihbase-client

/**
 * Copy constructor
 * @param appendToCopy append to copy
 */
public Append(Append appendToCopy) {
 super(appendToCopy);
 this.tr = appendToCopy.getTimeRange();
}

代码示例来源:origin: org.apache.hbase/hbase-client

public static MutationProto toMutationNoData(final MutationType type, final Mutation mutation,
  final MutationProto.Builder builder, long nonce) throws IOException {
 getMutationBuilderAndSetCommonFields(type, mutation, builder);
 builder.setAssociatedCellCount(mutation.size());
 if (mutation instanceof Increment) {
  builder.setTimeRange(ProtobufUtil.toTimeRange(((Increment) mutation).getTimeRange()));
 }
 if (mutation instanceof Append) {
  builder.setTimeRange(ProtobufUtil.toTimeRange(((Append) mutation).getTimeRange()));
 }
 if (nonce != HConstants.NO_NONCE) {
  builder.setNonce(nonce);
 }
 return builder.build();
}

代码示例来源:origin: org.apache.hbase/hbase-client

public static MutationProto toMutationNoData(final MutationType type, final Mutation mutation,
  final MutationProto.Builder builder, long nonce) throws IOException {
 getMutationBuilderAndSetCommonFields(type, mutation, builder);
 builder.setAssociatedCellCount(mutation.size());
 if (mutation instanceof Increment) {
  builder.setTimeRange(toTimeRange(((Increment)mutation).getTimeRange()));
 }
 if (mutation instanceof Append) {
  builder.setTimeRange(toTimeRange(((Append)mutation).getTimeRange()));
 }
 if (nonce != HConstants.NO_NONCE) {
  builder.setNonce(nonce);
 }
 return builder.build();
}

代码示例来源:origin: org.apache.hbase/hbase-client

private void assertEquals(Mutation origin, Mutation clone) {
 Assert.assertEquals(origin.getFamilyCellMap().size(), clone.getFamilyCellMap().size());
 for (byte[] family : origin.getFamilyCellMap().keySet()) {
  List<Cell> originCells = origin.getCellList(family);
  List<Cell> cloneCells = clone.getCellList(family);
  Assert.assertEquals(originCells.size(), cloneCells.size());
  for (int i = 0; i != cloneCells.size(); ++i) {
   Cell originCell = originCells.get(i);
   Cell cloneCell = cloneCells.get(i);
   assertTrue(CellUtil.equals(originCell, cloneCell));
   assertTrue(CellUtil.matchingValue(originCell, cloneCell));
  }
 }
 Assert.assertEquals(origin.getAttributesMap().size(), clone.getAttributesMap().size());
 for (String name : origin.getAttributesMap().keySet()) {
  byte[] originValue = origin.getAttributesMap().get(name);
  byte[] cloneValue = clone.getAttributesMap().get(name);
  assertTrue(Bytes.equals(originValue, cloneValue));
 }
 Assert.assertEquals(origin.getTimestamp(), clone.getTimestamp());
 Assert.assertEquals(origin.getPriority(), clone.getPriority());
 if (origin instanceof Append) {
  assertEquals(((Append)origin).getTimeRange(), ((Append)clone).getTimeRange());
 }
 if (origin instanceof Increment) {
  assertEquals(((Increment)origin).getTimeRange(), ((Increment)clone).getTimeRange());
 }
}

代码示例来源:origin: org.apache.hbase/hbase-client

builder.setTimeRange(toTimeRange(((Append) mutation).getTimeRange()));

代码示例来源:origin: org.apache.hbase/hbase-client

builder.setTimeRange(ProtobufUtil.toTimeRange(((Append) mutation).getTimeRange()));

代码示例来源:origin: org.apache.hbase/hbase-client

mutateBuilder.setTimeRange(ProtobufUtil.toTimeRange(append.getTimeRange()));
assertEquals(mutateBuilder.build(), ProtobufUtil.toMutation(MutationType.APPEND, append));

代码示例来源:origin: com.aliyun.hbase/alihbase-client

public static MutationProto toMutationNoData(final MutationType type, final Mutation mutation,
  final MutationProto.Builder builder, long nonce) throws IOException {
 getMutationBuilderAndSetCommonFields(type, mutation, builder);
 builder.setAssociatedCellCount(mutation.size());
 if (mutation instanceof Increment) {
  builder.setTimeRange(toTimeRange(((Increment)mutation).getTimeRange()));
 }
 if (mutation instanceof Append) {
  builder.setTimeRange(toTimeRange(((Append)mutation).getTimeRange()));
 }
 if (nonce != HConstants.NO_NONCE) {
  builder.setNonce(nonce);
 }
 return builder.build();
}

相关文章