org.apache.tephra.Transaction.getVisibilityLevel()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(16.1k)|赞(0)|评价(0)|浏览(110)

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

Transaction.getVisibilityLevel介绍

[英]Returns the currently set visibility level.
[中]返回当前设置的可见性级别。

代码示例

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

@Override
public PhoenixVisibilityLevel getVisibilityLevel() {
  VisibilityLevel visibilityLevel = null;
  Transaction tx = getCurrentTransaction();
  assert(tx != null);
  visibilityLevel = tx.getVisibilityLevel();
  PhoenixVisibilityLevel phoenixVisibilityLevel;
  switch (visibilityLevel) {
  case SNAPSHOT:
    phoenixVisibilityLevel = PhoenixVisibilityLevel.SNAPSHOT;
    break;
  case SNAPSHOT_EXCLUDE_CURRENT:
    phoenixVisibilityLevel = PhoenixVisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT;
    break;
  case SNAPSHOT_ALL:
    phoenixVisibilityLevel = PhoenixVisibilityLevel.SNAPSHOT_ALL;
  default:
    phoenixVisibilityLevel = null;
  }
  return phoenixVisibilityLevel;
}

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

@Override
public PhoenixVisibilityLevel getVisibilityLevel() {
  VisibilityLevel visibilityLevel = null;
  Transaction tx = getCurrentTransaction();
  assert(tx != null);
  visibilityLevel = tx.getVisibilityLevel();
  PhoenixVisibilityLevel phoenixVisibilityLevel;
  switch (visibilityLevel) {
  case SNAPSHOT:
    phoenixVisibilityLevel = PhoenixVisibilityLevel.SNAPSHOT;
    break;
  case SNAPSHOT_EXCLUDE_CURRENT:
    phoenixVisibilityLevel = PhoenixVisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT;
    break;
  case SNAPSHOT_ALL:
    phoenixVisibilityLevel = PhoenixVisibilityLevel.SNAPSHOT_ALL;
  default:
    phoenixVisibilityLevel = null;
  }
  return phoenixVisibilityLevel;
}

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

@Override
public PhoenixVisibilityLevel getVisibilityLevel() {
  VisibilityLevel visibilityLevel = null;
  Transaction tx = getCurrentTransaction();
  assert(tx != null);
  visibilityLevel = tx.getVisibilityLevel();
  PhoenixVisibilityLevel phoenixVisibilityLevel;
  switch (visibilityLevel) {
  case SNAPSHOT:
    phoenixVisibilityLevel = PhoenixVisibilityLevel.SNAPSHOT;
    break;
  case SNAPSHOT_EXCLUDE_CURRENT:
    phoenixVisibilityLevel = PhoenixVisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT;
    break;
  case SNAPSHOT_ALL:
    phoenixVisibilityLevel = PhoenixVisibilityLevel.SNAPSHOT_ALL;
  default:
    phoenixVisibilityLevel = null;
  }
  return phoenixVisibilityLevel;
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-0.96

/**
 * Creates a new {@link Filter} for returning data only from visible transactions.
 *
 * @param tx the current transaction to apply.  Only data visible to this transaction will be returned.
 * @param ttlByFamily map of time-to-live (TTL) (in milliseconds) by column family name
 * @param allowEmptyValues if {@code true} cells with empty {@code byte[]} values will be returned, if {@code false}
 *                         these will be interpreted as "delete" markers and the column will be filtered out
 * @param scanType the type of scan operation being performed
 * @param cellFilter if non-null, this filter will be applied to all cells visible to the current transaction, by
 *                   calling {@link Filter#filterKeyValue(org.apache.hadoop.hbase.Cell)}.  If null, then
 *                   {@link Filter.ReturnCode#INCLUDE_AND_NEXT_COL} will be returned instead.
 */
 public TransactionVisibilityFilter(Transaction tx, Map<byte[], Long> ttlByFamily, boolean allowEmptyValues,
               ScanType scanType, @Nullable Filter cellFilter) {
 this.tx = tx;
 this.oldestTsByFamily = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
 for (Map.Entry<byte[], Long> ttlEntry : ttlByFamily.entrySet()) {
  long familyTTL = ttlEntry.getValue();
  oldestTsByFamily.put(ttlEntry.getKey(),
             familyTTL <= 0 ? 0 : tx.getVisibilityUpperBound() - familyTTL * TxConstants.MAX_TX_PER_MS);
 }
 this.allowEmptyValues = allowEmptyValues;
 this.clearDeletes =
   scanType == ScanType.COMPACT_DROP_DELETES ||
    (scanType == ScanType.USER_SCAN && tx.getVisibilityLevel() != Transaction.VisibilityLevel.SNAPSHOT_ALL);
 this.cellFilter = cellFilter;
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-0.98

/**
 * Creates a new {@link org.apache.hadoop.hbase.filter.Filter} for returning data only from visible transactions.
 *
 * @param tx the current transaction to apply.  Only data visible to this transaction will be returned.
 * @param ttlByFamily map of time-to-live (TTL) (in milliseconds) by column family name
 * @param allowEmptyValues if {@code true} cells with empty {@code byte[]} values will be returned, if {@code false}
 *                         these will be interpreted as "delete" markers and the column will be filtered out
 * @param scanType the type of scan operation being performed
 * @param cellFilter if non-null, this filter will be applied to all cells visible to the current transaction, by
 *                   calling {@link Filter#filterKeyValue(org.apache.hadoop.hbase.Cell)}.  If null, then
 *                   {@link Filter.ReturnCode#INCLUDE_AND_NEXT_COL} will be returned instead.
 */
public TransactionVisibilityFilter(Transaction tx, Map<byte[], Long> ttlByFamily, boolean allowEmptyValues,
              ScanType scanType, @Nullable Filter cellFilter) {
 this.tx = tx;
 this.oldestTsByFamily = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
 for (Map.Entry<byte[], Long> ttlEntry : ttlByFamily.entrySet()) {
  long familyTTL = ttlEntry.getValue();
  oldestTsByFamily.put(ttlEntry.getKey(),
             familyTTL <= 0 ? 0 : tx.getVisibilityUpperBound() - familyTTL * TxConstants.MAX_TX_PER_MS);
 }
 this.allowEmptyValues = allowEmptyValues;
 this.clearDeletes =
  scanType == ScanType.COMPACT_DROP_DELETES ||
   (scanType == ScanType.USER_SCAN && tx.getVisibilityLevel() != Transaction.VisibilityLevel.SNAPSHOT_ALL);
 this.cellFilter = cellFilter;
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.0-cdh

/**
 * Creates a new {@link org.apache.hadoop.hbase.filter.Filter} for returning data only from visible transactions.
 *
 * @param tx the current transaction to apply.  Only data visible to this transaction will be returned.
 * @param ttlByFamily map of time-to-live (TTL) (in milliseconds) by column family name
 * @param allowEmptyValues if {@code true} cells with empty {@code byte[]} values will be returned, if {@code false}
 *                         these will be interpreted as "delete" markers and the column will be filtered out
 * @param scanType the type of scan operation being performed
 * @param cellFilter if non-null, this filter will be applied to all cells visible to the current transaction, by
 *                   calling {@link Filter#filterKeyValue(org.apache.hadoop.hbase.Cell)}.  If null, then
 *                   {@link Filter.ReturnCode#INCLUDE_AND_NEXT_COL} will be returned instead.
 */
public TransactionVisibilityFilter(Transaction tx, Map<byte[], Long> ttlByFamily, boolean allowEmptyValues,
              ScanType scanType, @Nullable Filter cellFilter) {
 this.tx = tx;
 this.oldestTsByFamily = Maps.newTreeMap();
 for (Map.Entry<byte[], Long> ttlEntry : ttlByFamily.entrySet()) {
  long familyTTL = ttlEntry.getValue();
  oldestTsByFamily.put(new ImmutableBytesWritable(ttlEntry.getKey()),
             familyTTL <= 0 ? 0 : tx.getVisibilityUpperBound() - familyTTL * TxConstants.MAX_TX_PER_MS);
 }
 this.allowEmptyValues = allowEmptyValues;
 this.clearDeletes =
  scanType == ScanType.COMPACT_DROP_DELETES ||
   (scanType == ScanType.USER_SCAN && tx.getVisibilityLevel() != Transaction.VisibilityLevel.SNAPSHOT_ALL);
 this.cellFilter = cellFilter;
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.1

/**
 * Creates a new {@link org.apache.hadoop.hbase.filter.Filter} for returning data only from visible transactions.
 *
 * @param tx the current transaction to apply.  Only data visible to this transaction will be returned.
 * @param ttlByFamily map of time-to-live (TTL) (in milliseconds) by column family name
 * @param allowEmptyValues if {@code true} cells with empty {@code byte[]} values will be returned, if {@code false}
 *                         these will be interpreted as "delete" markers and the column will be filtered out
 * @param scanType the type of scan operation being performed
 * @param cellFilter if non-null, this filter will be applied to all cells visible to the current transaction, by
 *                   calling {@link Filter#filterKeyValue(org.apache.hadoop.hbase.Cell)}.  If null, then
 *                   {@link Filter.ReturnCode#INCLUDE_AND_NEXT_COL} will be returned instead.
 */
 public TransactionVisibilityFilter(Transaction tx, Map<byte[], Long> ttlByFamily, boolean allowEmptyValues,
               ScanType scanType, @Nullable Filter cellFilter) {
 this.tx = tx;
 this.oldestTsByFamily = Maps.newTreeMap();
 for (Map.Entry<byte[], Long> ttlEntry : ttlByFamily.entrySet()) {
  long familyTTL = ttlEntry.getValue();
  oldestTsByFamily.put(new ImmutableBytesWritable(ttlEntry.getKey()),
             familyTTL <= 0 ? 0 : tx.getVisibilityUpperBound() - familyTTL * TxConstants.MAX_TX_PER_MS);
 }
 this.allowEmptyValues = allowEmptyValues;
 this.clearDeletes =
  scanType == ScanType.COMPACT_DROP_DELETES ||
   (scanType == ScanType.USER_SCAN && tx.getVisibilityLevel() != Transaction.VisibilityLevel.SNAPSHOT_ALL);
 this.cellFilter = cellFilter;
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.0

/**
 * Creates a new {@link org.apache.hadoop.hbase.filter.Filter} for returning data only from visible transactions.
 *
 * @param tx the current transaction to apply.  Only data visible to this transaction will be returned.
 * @param ttlByFamily map of time-to-live (TTL) (in milliseconds) by column family name
 * @param allowEmptyValues if {@code true} cells with empty {@code byte[]} values will be returned, if {@code false}
 *                         these will be interpreted as "delete" markers and the column will be filtered out
 * @param scanType the type of scan operation being performed
 * @param cellFilter if non-null, this filter will be applied to all cells visible to the current transaction, by
 *                   calling {@link Filter#filterKeyValue(org.apache.hadoop.hbase.Cell)}.  If null, then
 *                   {@link Filter.ReturnCode#INCLUDE_AND_NEXT_COL} will be returned instead.
 */
public TransactionVisibilityFilter(Transaction tx, Map<byte[], Long> ttlByFamily, boolean allowEmptyValues,
              ScanType scanType, @Nullable Filter cellFilter) {
 this.tx = tx;
 this.oldestTsByFamily = Maps.newTreeMap();
 for (Map.Entry<byte[], Long> ttlEntry : ttlByFamily.entrySet()) {
  long familyTTL = ttlEntry.getValue();
  oldestTsByFamily.put(new ImmutableBytesWritable(ttlEntry.getKey()),
             familyTTL <= 0 ? 0 : tx.getVisibilityUpperBound() - familyTTL * TxConstants.MAX_TX_PER_MS);
 }
 this.allowEmptyValues = allowEmptyValues;
 this.clearDeletes =
  scanType == ScanType.COMPACT_DROP_DELETES ||
   (scanType == ScanType.USER_SCAN && tx.getVisibilityLevel() != Transaction.VisibilityLevel.SNAPSHOT_ALL);
 this.cellFilter = cellFilter;
}

代码示例来源:origin: org.apache.tephra/tephra-api

/**
 * Creates a new transaction for a checkpoint operation, copying all members from the original transaction,
 * with the updated checkpoint write pointers.
 *
 * @param toCopy the original transaction containing the state to copy
 * @param writePointer the new write pointer to use for the transaction
 * @param checkpointPointers the list of write pointers added from checkpoints on the transaction
 */
public Transaction(Transaction toCopy, long writePointer, long[] checkpointPointers) {
 this(toCopy.getReadPointer(), toCopy.getTransactionId(), writePointer, toCopy.getInvalids(),
   toCopy.getInProgress(), toCopy.getFirstShortInProgress(), toCopy.getType(), checkpointPointers,
   toCopy.getVisibilityLevel());
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.1

@Override
public Cell transformCell(Cell cell) throws IOException {
 // Convert Tephra deletes back into HBase deletes
 if (tx.getVisibilityLevel() == Transaction.VisibilityLevel.SNAPSHOT_ALL) {
  if (DeleteTracker.isFamilyDelete(cell)) {
   return new KeyValue(CellUtil.cloneRow(cell), CellUtil.cloneFamily(cell), null, cell.getTimestamp(),
             KeyValue.Type.DeleteFamily);
  } else if (isColumnDelete(cell)) {
   // Note: in some cases KeyValue.Type.Delete is used in Delete object,
   // and in some other cases KeyValue.Type.DeleteColumn is used.
   // Since Tephra cannot distinguish between the two, we return KeyValue.Type.DeleteColumn.
   // KeyValue.Type.DeleteColumn makes both CellUtil.isDelete and CellUtil.isDeleteColumns return true, and will
   // work in both cases.
   return new KeyValue(CellUtil.cloneRow(cell), CellUtil.cloneFamily(cell), CellUtil.cloneQualifier(cell),
             cell.getTimestamp(), KeyValue.Type.DeleteColumn);
  }
 }
 return cell;
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.0

@Override
public Cell transformCell(Cell cell) throws IOException {
 // Convert Tephra deletes back into HBase deletes
 if (tx.getVisibilityLevel() == Transaction.VisibilityLevel.SNAPSHOT_ALL) {
  if (DeleteTracker.isFamilyDelete(cell)) {
   return new KeyValue(CellUtil.cloneRow(cell), CellUtil.cloneFamily(cell), null, cell.getTimestamp(),
             KeyValue.Type.DeleteFamily);
  } else if (isColumnDelete(cell)) {
   // Note: in some cases KeyValue.Type.Delete is used in Delete object,
   // and in some other cases KeyValue.Type.DeleteColumn is used.
   // Since Tephra cannot distinguish between the two, we return KeyValue.Type.DeleteColumn.
   // KeyValue.Type.DeleteColumn makes both CellUtil.isDelete and CellUtil.isDeleteColumns return true, and will
   // work in both cases.
   return new KeyValue(CellUtil.cloneRow(cell), CellUtil.cloneFamily(cell), CellUtil.cloneQualifier(cell),
             cell.getTimestamp(), KeyValue.Type.DeleteColumn);
  }
 }
 return cell;
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-0.98

@Override
public Cell transformCell(Cell cell) throws IOException {
 // Convert Tephra deletes back into HBase deletes
 if (tx.getVisibilityLevel() == Transaction.VisibilityLevel.SNAPSHOT_ALL) {
  if (DeleteTracker.isFamilyDelete(cell)) {
   return new KeyValue(CellUtil.cloneRow(cell), CellUtil.cloneFamily(cell), null, cell.getTimestamp(),
             KeyValue.Type.DeleteFamily);
  } else if (isColumnDelete(cell)) {
   // Note: in some cases KeyValue.Type.Delete is used in Delete object,
   // and in some other cases KeyValue.Type.DeleteColumn is used.
   // Since Tephra cannot distinguish between the two, we return KeyValue.Type.DeleteColumn.
   // KeyValue.Type.DeleteColumn makes both CellUtil.isDelete and CellUtil.isDeleteColumns return true, and will
   // work in both cases.
   return new KeyValue(CellUtil.cloneRow(cell), CellUtil.cloneFamily(cell), CellUtil.cloneQualifier(cell),
             cell.getTimestamp(), KeyValue.Type.DeleteColumn);
  }
 }
 return cell;
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.0-cdh

@Override
public Cell transformCell(Cell cell) throws IOException {
 // Convert Tephra deletes back into HBase deletes
 if (tx.getVisibilityLevel() == Transaction.VisibilityLevel.SNAPSHOT_ALL) {
  if (DeleteTracker.isFamilyDelete(cell)) {
   return new KeyValue(CellUtil.cloneRow(cell), CellUtil.cloneFamily(cell), null, cell.getTimestamp(),
             KeyValue.Type.DeleteFamily);
  } else if (isColumnDelete(cell)) {
   // Note: in some cases KeyValue.Type.Delete is used in Delete object,
   // and in some other cases KeyValue.Type.DeleteColumn is used.
   // Since Tephra cannot distinguish between the two, we return KeyValue.Type.DeleteColumn.
   // KeyValue.Type.DeleteColumn makes both CellUtil.isDelete and CellUtil.isDeleteColumns return true, and will
   // work in both cases.
   return new KeyValue(CellUtil.cloneRow(cell), CellUtil.cloneFamily(cell), CellUtil.cloneQualifier(cell),
             cell.getTimestamp(), KeyValue.Type.DeleteColumn);
  }
 }
 return cell;
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-0.96

@Override
public Cell transformCell(Cell cell) throws IOException {
 // Convert Tephra deletes back into HBase deletes
 if (tx.getVisibilityLevel() == Transaction.VisibilityLevel.SNAPSHOT_ALL) {
  if (DeleteTracker.isFamilyDelete(cell)) {
   return new KeyValue(CellUtil.cloneRow(cell), CellUtil.cloneFamily(cell), null, cell.getTimestamp(),
             KeyValue.Type.DeleteFamily);
  } else if (isColumnDelete(cell)) {
   // Note: in some cases KeyValue.Type.Delete is used in Delete object,
   // and in some other cases KeyValue.Type.DeleteColumn is used.
   // Since Tephra cannot distinguish between the two, we return KeyValue.Type.DeleteColumn.
   // KeyValue.Type.DeleteColumn makes both CellUtil.isDelete and CellUtil.isDeleteColumns return true, and will
   // work in both cases.
   return new KeyValue(CellUtil.cloneRow(cell), CellUtil.cloneFamily(cell), CellUtil.cloneQualifier(cell),
             cell.getTimestamp(), KeyValue.Type.DeleteColumn);
  }
 }
 return cell;
}

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

public static TTransaction wrap(Transaction tx) {
 return new TTransaction(tx.getTransactionId(), tx.getReadPointer(),
             Longs.asList(tx.getInvalids()), Longs.asList(tx.getInProgress()),
             tx.getFirstShortInProgress(), getTTransactionType(tx.getType()),
             tx.getWritePointer(), Longs.asList(tx.getCheckpointWritePointers()),
             getTVisibilityLevel(tx.getVisibilityLevel()));
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-0.98

} else if (tx.isVisible(kvTimestamp)) {
 if (tx.getVisibilityLevel() == Transaction.VisibilityLevel.SNAPSHOT_ALL && tx.isCurrentWrite(kvTimestamp)) {

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-0.96

} else if (tx.isVisible(kvTimestamp)) {
 if (tx.getVisibilityLevel() == Transaction.VisibilityLevel.SNAPSHOT_ALL && tx.isCurrentWrite(kvTimestamp)) {

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.1

} else if (tx.isVisible(kvTimestamp)) {
 if (tx.getVisibilityLevel() == Transaction.VisibilityLevel.SNAPSHOT_ALL && tx.isCurrentWrite(kvTimestamp)) {

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.0-cdh

} else if (tx.isVisible(kvTimestamp)) {
 if (tx.getVisibilityLevel() == Transaction.VisibilityLevel.SNAPSHOT_ALL && tx.isCurrentWrite(kvTimestamp)) {

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.0

} else if (tx.isVisible(kvTimestamp)) {
 if (tx.getVisibilityLevel() == Transaction.VisibilityLevel.SNAPSHOT_ALL && tx.isCurrentWrite(kvTimestamp)) {

相关文章