本文整理了Java中org.apache.hadoop.hbase.client.Increment.getTimeRange()
方法的一些代码示例,展示了Increment.getTimeRange()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Increment.getTimeRange()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Increment
类名称:Increment
方法名:getTimeRange
[英]Gets the TimeRange used for this increment.
[中]获取用于此增量的时间范围。
代码示例来源:origin: apache/hbase
/**
* Copy constructor
* @param incrementToCopy increment to copy
*/
public Increment(Increment incrementToCopy) {
super(incrementToCopy);
this.tr = incrementToCopy.getTimeRange();
}
代码示例来源:origin: apache/hbase
@Override
public Result preIncrement(final ObserverContext<RegionCoprocessorEnvironment> e,
final Increment increment) throws IOException {
NavigableMap<byte [], List<Cell>> map = increment.getFamilyCellMap();
for (Map.Entry<byte [], List<Cell>> entry : map.entrySet()) {
for (Cell cell : entry.getValue()) {
long incr = Bytes.toLong(cell.getValueArray(), cell.getValueOffset(),
cell.getValueLength());
if (incr == 10) {
tr10 = increment.getTimeRange();
} else if (incr == 2 && !increment.getTimeRange().isAllTime()) {
tr2 = increment.getTimeRange();
}
}
}
return super.preIncrement(e, increment);
}
}
代码示例来源:origin: apache/hbase
switch (op) {
case INCREMENT:
tr = ((Increment)mutation).getTimeRange();
break;
case APPEND:
代码示例来源: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: org.apache.hbase/hbase-client
/**
* Copy constructor
* @param incrementToCopy increment to copy
*/
public Increment(Increment incrementToCopy) {
super(incrementToCopy);
this.tr = incrementToCopy.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(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: 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(((Increment) mutation).getTimeRange()));
代码示例来源:origin: apache/hbase
builder.setTimeRange(toTimeRange(((Increment) mutation).getTimeRange()));
代码示例来源:origin: apache/hbase
mutateBuilder.setTimeRange(ProtobufUtil.toTimeRange(increment.getTimeRange()));
assertEquals(mutateBuilder.build(), ProtobufUtil.toMutation(MutationType.INCREMENT, increment));
代码示例来源:origin: apache/hbase
@Override
public Result preIncrementAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
final Increment increment) throws IOException {
if (increment.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.INCREMENT, c.getEnvironment(), increment.getRow(),
increment.getFamilyCellMap(), increment.getTimeRange().getMax(), Action.WRITE)) {
authResult = AuthResult.allow(OpType.INCREMENT.toString(), "Covering cell set",
user, Action.WRITE, table, increment.getFamilyCellMap());
} else {
authResult = AuthResult.deny(OpType.INCREMENT.toString(), "Covering cell set",
user, Action.WRITE, table, increment.getFamilyCellMap());
}
AccessChecker.logResult(authResult);
if (authorizationEnabled && !authResult.isAllowed()) {
throw new AccessDeniedException("Insufficient permissions " +
authResult.toContextString());
}
}
return null;
}
代码示例来源:origin: apache/hbase
mutateBuilder.setTimeRange(ProtobufUtil.toTimeRange(increment.getTimeRange()));
assertEquals(mutateBuilder.build(), ProtobufUtil.toMutation(MutationType.INCREMENT, increment));
代码示例来源: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
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
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(ProtobufUtil.toTimeRange(((Increment) mutation).getTimeRange()));
代码示例来源:origin: org.apache.hbase/hbase-client
builder.setTimeRange(toTimeRange(((Increment) mutation).getTimeRange()));
代码示例来源:origin: forcedotcom/phoenix
HRegion region = env.getRegion();
byte[] row = increment.getRow();
TimeRange tr = increment.getTimeRange();
region.startRegionOperation();
try {
代码示例来源:origin: apache/phoenix
byte[] row = increment.getRow();
List<RowLock> locks = Lists.newArrayList();
TimeRange tr = increment.getTimeRange();
region.startRegionOperation();
try {
代码示例来源:origin: org.apache.hbase/hbase-client
mutateBuilder.setTimeRange(ProtobufUtil.toTimeRange(increment.getTimeRange()));
assertEquals(mutateBuilder.build(), ProtobufUtil.toMutation(MutationType.INCREMENT, increment));
内容来源于网络,如有侵权,请联系作者删除!