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

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

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

Append.getAttribute介绍

暂无

代码示例

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

@Override
public Result preAppend(ObserverContext<RegionCoprocessorEnvironment> c, Append append)
  throws IOException {
 User user = getActiveUser(c);
 checkForReservedTagPresence(user, append);
 // Require WRITE permission to the table, CF, and the KV to be appended
 RegionCoprocessorEnvironment env = c.getEnvironment();
 Map<byte[],? extends Collection<Cell>> families = append.getFamilyCellMap();
 AuthResult authResult = permissionGranted(OpType.APPEND, user,
   env, families, Action.WRITE);
 AccessChecker.logResult(authResult);
 if (!authResult.isAllowed()) {
  if (cellFeaturesEnabled && !compatibleEarlyTermination) {
   append.setAttribute(CHECK_COVERING_PERM, TRUE);
  } else if (authorizationEnabled)  {
   throw new AccessDeniedException("Insufficient permissions " +
    authResult.toContextString());
  }
 }
 byte[] bytes = append.getAttribute(AccessControlConstants.OP_ATTRIBUTE_ACL);
 if (bytes != null) {
  if (cellFeaturesEnabled) {
   addCellPermissions(bytes, append.getFamilyCellMap());
  } else {
   throw new DoNotRetryIOException("Cell ACLs cannot be persisted");
  }
 }
 return null;
}

代码示例来源: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: forcedotcom/phoenix

public Result preAppend(final ObserverContext<RegionCoprocessorEnvironment> e,
    final Append append) throws IOException {
  byte[] opBuf = append.getAttribute(OPERATION_ATTRIB);
  if (opBuf == null) {
    return null;
    maxGetTimestamp = minGetTimestamp + 1;
  } else {
    clientTimestampBuf = append.getAttribute(MAX_TIMERANGE_ATTRIB);
    if (clientTimestampBuf != null) {
      clientTimestamp = maxGetTimestamp = Bytes.toLong(clientTimestampBuf);
      case RETURN_SEQUENCE:
        KeyValue currentValueKV = result.raw()[0];
        long expectedValue = PDataType.LONG.getCodec().decodeLong(append.getAttribute(CURRENT_VALUE_ATTRIB), 0, null);
        long value = PDataType.LONG.getCodec().decodeLong(currentValueKV.getBuffer(), currentValueKV.getValueOffset(), null);

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

org.apache.hadoop.hbase.coprocessor.ObserverContext<RegionCoprocessorEnvironment> e,
  Append append) throws IOException {
byte[] opBuf = append.getAttribute(OPERATION_ATTRIB);
if (opBuf == null) {
  return null;
  maxGetTimestamp = minGetTimestamp + 1;
} else {
  clientTimestampBuf = append.getAttribute(MAX_TIMERANGE_ATTRIB);
  if (clientTimestampBuf != null) {
    clientTimestamp = maxGetTimestamp = Bytes.toLong(clientTimestampBuf);
    case RETURN_SEQUENCE:
      KeyValue currentValueKV = PhoenixKeyValueUtil.maybeCopyCell(result.rawCells()[0]);
      long expectedValue = PLong.INSTANCE.getCodec().decodeLong(append.getAttribute(CURRENT_VALUE_ATTRIB), 0, SortOrder.getDefault());
      long value = PLong.INSTANCE.getCodec().decodeLong(currentValueKV.getValueArray(),
       currentValueKV.getValueOffset(), SortOrder.getDefault());

代码示例来源:origin: co.cask.hbase/hbase

/**
 * @return current setting for returnResults
 */
public boolean isReturnResults() {
 byte[] v = getAttribute(RETURN_RESULTS);
 return v == null ? true : Bytes.toBoolean(v);
}

代码示例来源:origin: org.apache.phoenix/phoenix-core

org.apache.hadoop.hbase.coprocessor.ObserverContext<RegionCoprocessorEnvironment> e,
  Append append) throws IOException {
byte[] opBuf = append.getAttribute(OPERATION_ATTRIB);
if (opBuf == null) {
  return null;
  maxGetTimestamp = minGetTimestamp + 1;
} else {
  clientTimestampBuf = append.getAttribute(MAX_TIMERANGE_ATTRIB);
  if (clientTimestampBuf != null) {
    clientTimestamp = maxGetTimestamp = Bytes.toLong(clientTimestampBuf);
    case RETURN_SEQUENCE:
      KeyValue currentValueKV = PhoenixKeyValueUtil.maybeCopyCell(result.rawCells()[0]);
      long expectedValue = PLong.INSTANCE.getCodec().decodeLong(append.getAttribute(CURRENT_VALUE_ATTRIB), 0, SortOrder.getDefault());
      long value = PLong.INSTANCE.getCodec().decodeLong(currentValueKV.getValueArray(),
       currentValueKV.getValueOffset(), SortOrder.getDefault());

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

org.apache.hadoop.hbase.coprocessor.ObserverContext<RegionCoprocessorEnvironment> e,
  Append append) throws IOException {
byte[] opBuf = append.getAttribute(OPERATION_ATTRIB);
if (opBuf == null) {
  return null;
  maxGetTimestamp = minGetTimestamp + 1;
} else {
  clientTimestampBuf = append.getAttribute(MAX_TIMERANGE_ATTRIB);
  if (clientTimestampBuf != null) {
    clientTimestamp = maxGetTimestamp = Bytes.toLong(clientTimestampBuf);
    case RETURN_SEQUENCE:
      KeyValue currentValueKV = PhoenixKeyValueUtil.maybeCopyCell(result.rawCells()[0]);
      long expectedValue = PLong.INSTANCE.getCodec().decodeLong(append.getAttribute(CURRENT_VALUE_ATTRIB), 0, SortOrder.getDefault());
      long value = PLong.INSTANCE.getCodec().decodeLong(currentValueKV.getValueArray(),
       currentValueKV.getValueOffset(), SortOrder.getDefault());

代码示例来源:origin: harbby/presto-connectors

@Override
public Result preAppend(ObserverContext<RegionCoprocessorEnvironment> c, Append append)
  throws IOException {
 User user = getActiveUser();
 checkForReservedTagPresence(user, append);
 // Require WRITE permission to the table, CF, and the KV to be appended
 RegionCoprocessorEnvironment env = c.getEnvironment();
 Map<byte[],? extends Collection<Cell>> families = append.getFamilyCellMap();
 AuthResult authResult = permissionGranted(OpType.APPEND, user, env, families, Action.WRITE);
 logResult(authResult);
 if (!authResult.isAllowed()) {
  if (cellFeaturesEnabled && !compatibleEarlyTermination) {
   append.setAttribute(CHECK_COVERING_PERM, TRUE);
  } else if (authorizationEnabled)  {
   throw new AccessDeniedException("Insufficient permissions " +
    authResult.toContextString());
  }
 }
 byte[] bytes = append.getAttribute(AccessControlConstants.OP_ATTRIBUTE_ACL);
 if (bytes != null) {
  if (cellFeaturesEnabled) {
   addCellPermissions(bytes, append.getFamilyCellMap());
  } else {
   throw new DoNotRetryIOException("Cell ACLs cannot be persisted");
  }
 }
 return null;
}

代码示例来源:origin: harbby/presto-connectors

@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;
  if (checkCoveringPermission(OpType.APPEND, c.getEnvironment(), append.getRow(),
    append.getFamilyCellMap(), HConstants.LATEST_TIMESTAMP, Action.WRITE)) {
   authResult = AuthResult.allow(OpType.APPEND.toString(), "Covering cell set",
     getActiveUser(), Action.WRITE, table, append.getFamilyCellMap());
  } else {
   authResult = AuthResult.deny(OpType.APPEND.toString(), "Covering cell set",
     getActiveUser(), Action.WRITE, table, append.getFamilyCellMap());
  }
  logResult(authResult);
  if (authorizationEnabled && !authResult.isAllowed()) {
   throw new AccessDeniedException("Insufficient permissions " +
    authResult.toContextString());
  }
 }
 return null;
}

相关文章