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

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

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

Transaction.isVisible介绍

[英]Returns whether or not the given version should be visible to the current transaction. A version will be visible if it was successfully committed prior to the current transaction starting, or was written by the current transaction (using either the current write pointer or the write pointer from a prior checkpoint).
[中]返回给定版本是否对当前事务可见。如果版本在当前事务启动之前已成功提交,或由当前事务写入(使用当前写入指针或来自先前检查点的写入指针),则该版本将可见。

代码示例

代码示例来源:origin: cdapio/cdap

@Override
 public boolean apply(Long version) {
  return tx.isVisible(version);
 }
});

代码示例来源:origin: co.cask.cdap/cdap-data-fabric

@Override
 public boolean apply(Long version) {
  return tx.isVisible(version);
 }
});

代码示例来源:origin: cdapio/cdap

protected static NavigableMap<byte[], byte[]> getLatestNotExcluded(
 NavigableMap<byte[], NavigableMap<Long, byte[]>> rowMap, Transaction tx) {
 // todo: for some subclasses it is ok to do changes in place...
 NavigableMap<byte[], byte[]> result = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
 for (Map.Entry<byte[], NavigableMap<Long, byte[]>> column : rowMap.entrySet()) {
  // NOTE: versions map already sorted, first comes latest version
  // todo: not cool to rely on external implementation specifics
  for (Map.Entry<Long, byte[]> versionAndValue : column.getValue().entrySet()) {
   // NOTE: we know that excluded versions are ordered
   if (tx == null || tx.isVisible(versionAndValue.getKey())) {
    result.put(column.getKey(), versionAndValue.getValue());
    break;
   }
  }
 }
 return result;
}

代码示例来源:origin: co.cask.cdap/cdap-data-fabric

protected static NavigableMap<byte[], byte[]> getLatestNotExcluded(
 NavigableMap<byte[], NavigableMap<Long, byte[]>> rowMap, Transaction tx) {
 // todo: for some subclasses it is ok to do changes in place...
 NavigableMap<byte[], byte[]> result = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);
 for (Map.Entry<byte[], NavigableMap<Long, byte[]>> column : rowMap.entrySet()) {
  // NOTE: versions map already sorted, first comes latest version
  // todo: not cool to rely on external implementation specifics
  for (Map.Entry<Long, byte[]> versionAndValue : column.getValue().entrySet()) {
   // NOTE: we know that excluded versions are ordered
   if (tx == null || tx.isVisible(versionAndValue.getKey())) {
    result.put(column.getKey(), versionAndValue.getValue());
    break;
   }
  }
 }
 return result;
}

代码示例来源:origin: caskdata/cdap

public Result filter(long txWritePtr) {
  // This transaction has been rolled back and thus skip the entry
  if (txWritePtr < 0) {
   return Result.SKIP;
  }

  // This transaction is visible, hence accept the message
  if (transaction.isVisible(txWritePtr)) {
   return Result.ACCEPT;
  }

  // This transaction is an invalid transaction, so skip the entry and proceed to the next
  if (Arrays.binarySearch(transaction.getInvalids(), txWritePtr) >= 0) {
   return Result.SKIP;
  }

  // This transaction has not yet been committed, hence hold to ensure ordering
  return Result.HOLD;
 }
}

代码示例来源:origin: co.cask.cdap/cdap-tms

public Result filter(long txWritePtr) {
  // This transaction has been rolled back and thus skip the entry
  if (txWritePtr < 0) {
   return Result.SKIP;
  }

  // This transaction is visible, hence accept the message
  if (transaction.isVisible(txWritePtr)) {
   return Result.ACCEPT;
  }

  // This transaction is an invalid transaction, so skip the entry and proceed to the next
  if (Arrays.binarySearch(transaction.getInvalids(), txWritePtr) >= 0) {
   return Result.SKIP;
  }

  // This transaction has not yet been committed, hence hold to ensure ordering
  return Result.HOLD;
 }
}

代码示例来源:origin: co.cask.cdap/cdap-data-fabric

/**
 * For a queue entry consumer state, serialized to byte array, return whether it is processed and committed.
 */
public static boolean isCommittedProcessed(byte[] stateBytes, Transaction tx) {
 long writePointer = Bytes.toLong(stateBytes, 0, Longs.BYTES);
 if (!tx.isVisible(writePointer)) {
  return false;
 }
 byte state = stateBytes[Longs.BYTES + Ints.BYTES];
 return state == ConsumerEntryState.PROCESSED.getState();
}

代码示例来源:origin: cdapio/cdap

if (tx != null && !tx.isVisible(kv.getTimestamp())) {
 continue;

代码示例来源:origin: co.cask.cdap/cdap-data-fabric

if (state == ConsumerEntryState.PROCESSED && transaction.isVisible(stateWritePointer)) {

代码示例来源:origin: co.cask.cdap/cdap-data-fabric

if (tx != null && !tx.isVisible(kv.getTimestamp())) {
 continue;

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

} else if (tx.isVisible(kvTimestamp)) {

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

} else if (tx.isVisible(kvTimestamp)) {

代码示例来源:origin: co.cask.cdap/cdap-data-fabric

if (state == ConsumerEntryState.PROCESSED && transaction.isVisible(stateWritePointer)) {

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

} else if (tx.isVisible(kvTimestamp)) {

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

} else if (tx.isVisible(kvTimestamp)) {

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

} else if (tx.isVisible(kvTimestamp)) {

相关文章