You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tephra.apache.org by po...@apache.org on 2016/05/11 20:15:51 UTC

[51/56] [abbrv] [partial] incubator-tephra git commit: Rename package to org.apache.tephra

Rename package to org.apache.tephra


Project: http://git-wip-us.apache.org/repos/asf/incubator-tephra/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tephra/commit/9c693743
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tephra/tree/9c693743
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tephra/diff/9c693743

Branch: refs/heads/master
Commit: 9c693743e65f8a055afba4d8c866460ab1e93894
Parents: a85b013
Author: poorna <po...@cask.co>
Authored: Fri May 6 16:01:56 2016 -0700
Committer: poorna <po...@cask.co>
Committed: Fri May 6 16:01:58 2016 -0700

----------------------------------------------------------------------
 README.rst                                      |    26 +-
 bin/tephra                                      |     2 +-
 conf/logback.xml                                |     2 +-
 .../main/java/co/cask/tephra/Transaction.java   |   296 -
 .../java/co/cask/tephra/TransactionAware.java   |   112 -
 .../java/co/cask/tephra/TransactionAwares.java  |   111 -
 .../tephra/TransactionConflictException.java    |    32 -
 .../tephra/TransactionFailureException.java     |    32 -
 .../TransactionNotInProgressException.java      |    28 -
 .../java/co/cask/tephra/TransactionType.java    |    33 -
 .../java/org/apache/tephra/Transaction.java     |   296 +
 .../org/apache/tephra/TransactionAware.java     |   112 +
 .../org/apache/tephra/TransactionAwares.java    |   111 +
 .../tephra/TransactionConflictException.java    |    32 +
 .../tephra/TransactionFailureException.java     |    32 +
 .../TransactionNotInProgressException.java      |    28 +
 .../java/org/apache/tephra/TransactionType.java |    33 +
 .../tephra/AbstractTransactionAwareTable.java   |   228 -
 .../tephra/AbstractTransactionExecutor.java     |   129 -
 .../src/main/java/co/cask/tephra/ChangeId.java  |    77 -
 .../cask/tephra/DefaultTransactionExecutor.java |   147 -
 .../tephra/InvalidTruncateTimeException.java    |    29 -
 .../java/co/cask/tephra/NoRetryStrategy.java    |    33 -
 .../co/cask/tephra/RetryOnConflictStrategy.java |    41 -
 .../java/co/cask/tephra/RetryStrategies.java    |    40 -
 .../main/java/co/cask/tephra/RetryStrategy.java |    34 -
 .../java/co/cask/tephra/TransactionAdmin.java   |   158 -
 .../java/co/cask/tephra/TransactionCodec.java   |    57 -
 .../java/co/cask/tephra/TransactionContext.java |   323 -
 ...ransactionCouldNotTakeSnapshotException.java |    28 -
 .../co/cask/tephra/TransactionExecutor.java     |   141 -
 .../cask/tephra/TransactionExecutorFactory.java |    28 -
 .../java/co/cask/tephra/TransactionManager.java |  1398 ---
 .../co/cask/tephra/TransactionServiceMain.java  |   149 -
 .../co/cask/tephra/TransactionSystemClient.java |   142 -
 .../main/java/co/cask/tephra/TxConstants.java   |   343 -
 .../coprocessor/TransactionStateCache.java      |   176 -
 .../TransactionStateCacheSupplier.java          |    54 -
 .../cask/tephra/coprocessor/package-info.java   |    22 -
 .../distributed/AbstractClientProvider.java     |   218 -
 .../distributed/CloseableThriftClient.java      |    44 -
 .../co/cask/tephra/distributed/ElasticPool.java |   163 -
 .../distributed/PooledClientProvider.java       |   133 -
 .../co/cask/tephra/distributed/RetryNTimes.java |    73 -
 .../cask/tephra/distributed/RetryStrategy.java  |    42 -
 .../distributed/RetryStrategyProvider.java      |    40 -
 .../tephra/distributed/RetryWithBackoff.java    |   108 -
 .../distributed/SingleUseClientProvider.java    |    63 -
 .../distributed/ThreadLocalClientProvider.java  |    72 -
 .../distributed/ThriftClientProvider.java       |    67 -
 .../distributed/TransactionConverterUtils.java  |    91 -
 .../tephra/distributed/TransactionService.java  |   156 -
 .../distributed/TransactionServiceClient.java   |   473 -
 .../TransactionServiceThriftClient.java         |   244 -
 .../TransactionServiceThriftHandler.java        |   184 -
 .../cask/tephra/distributed/package-info.java   |    23 -
 .../tephra/distributed/thrift/TBoolean.java     |   402 -
 .../thrift/TInvalidTruncateTimeException.java   |   394 -
 .../tephra/distributed/thrift/TTransaction.java |  1364 --
 ...ransactionCouldNotTakeSnapshotException.java |   404 -
 .../TTransactionNotInProgressException.java     |   404 -
 .../distributed/thrift/TTransactionServer.java  | 11072 -----------------
 .../distributed/thrift/TTransactionType.java    |    63 -
 .../distributed/thrift/TVisibilityLevel.java    |    62 -
 .../tephra/inmemory/DetachedTxSystemClient.java |   143 -
 .../inmemory/InMemoryTransactionService.java    |   132 -
 .../tephra/inmemory/InMemoryTxSystemClient.java |   136 -
 .../tephra/inmemory/MinimalTxSystemClient.java  |   112 -
 .../co/cask/tephra/inmemory/package-info.java   |    22 -
 .../tephra/metrics/DefaultMetricsCollector.java |   117 -
 .../cask/tephra/metrics/MetricsCollector.java   |    54 -
 .../cask/tephra/metrics/TxMetricsCollector.java |    66 -
 .../main/java/co/cask/tephra/package-info.java  |    22 -
 .../tephra/persist/AbstractTransactionLog.java  |   251 -
 .../AbstractTransactionStateStorage.java        |    43 -
 .../cask/tephra/persist/CommitMarkerCodec.java  |   118 -
 .../cask/tephra/persist/HDFSTransactionLog.java |   147 -
 .../HDFSTransactionLogReaderSupplier.java       |    58 -
 .../persist/HDFSTransactionLogReaderV1.java     |    72 -
 .../persist/HDFSTransactionLogReaderV2.java     |   114 -
 .../persist/HDFSTransactionStateStorage.java    |   492 -
 .../java/co/cask/tephra/persist/HDFSUtil.java   |   212 -
 .../tephra/persist/LocalFileTransactionLog.java |   135 -
 .../LocalFileTransactionStateStorage.java       |   346 -
 .../persist/NoOpTransactionStateStorage.java    |   152 -
 .../co/cask/tephra/persist/TransactionEdit.java |   360 -
 .../tephra/persist/TransactionEditCodecs.java   |   313 -
 .../co/cask/tephra/persist/TransactionLog.java  |    40 -
 .../tephra/persist/TransactionLogReader.java    |    42 -
 .../tephra/persist/TransactionLogWriter.java    |    52 -
 .../tephra/persist/TransactionSnapshot.java     |   199 -
 .../tephra/persist/TransactionStateStorage.java |   103 -
 .../persist/TransactionVisibilityState.java     |    63 -
 .../co/cask/tephra/persist/package-info.java    |    22 -
 .../co/cask/tephra/rpc/RPCServiceHandler.java   |    28 -
 .../co/cask/tephra/rpc/ThriftRPCServer.java     |   277 -
 .../java/co/cask/tephra/rpc/package-info.java   |    21 -
 .../co/cask/tephra/runtime/ConfigModule.java    |    39 -
 .../cask/tephra/runtime/DiscoveryModules.java   |   110 -
 .../tephra/runtime/TransactionClientModule.java |    79 -
 .../runtime/TransactionDistributedModule.java   |    57 -
 .../runtime/TransactionInMemoryModule.java      |    58 -
 .../tephra/runtime/TransactionLocalModule.java  |    57 -
 .../cask/tephra/runtime/TransactionModules.java |    41 -
 .../TransactionStateStorageProvider.java        |    55 -
 .../java/co/cask/tephra/runtime/ZKModule.java   |    69 -
 .../co/cask/tephra/snapshot/BinaryDecoder.java  |   110 -
 .../co/cask/tephra/snapshot/BinaryEncoder.java  |    89 -
 .../tephra/snapshot/DefaultSnapshotCodec.java   |   208 -
 .../co/cask/tephra/snapshot/SnapshotCodec.java  |    58 -
 .../tephra/snapshot/SnapshotCodecProvider.java  |   155 -
 .../cask/tephra/snapshot/SnapshotCodecV2.java   |    82 -
 .../cask/tephra/snapshot/SnapshotCodecV3.java   |    34 -
 .../cask/tephra/snapshot/SnapshotCodecV4.java   |   100 -
 .../co/cask/tephra/snapshot/package-info.java   |    22 -
 .../cask/tephra/util/ConfigurationFactory.java  |    75 -
 .../cask/tephra/util/ConfigurationProvider.java |    32 -
 .../java/co/cask/tephra/util/HBaseVersion.java  |   207 -
 .../util/HBaseVersionSpecificFactory.java       |    74 -
 .../main/java/co/cask/tephra/util/TxUtils.java  |   152 -
 .../tephra/visibility/DefaultFenceWait.java     |    63 -
 .../co/cask/tephra/visibility/FenceWait.java    |    46 -
 .../co/cask/tephra/visibility/ReadFence.java    |    79 -
 .../cask/tephra/visibility/VisibilityFence.java |   140 -
 .../co/cask/tephra/visibility/WriteFence.java   |    87 -
 .../co/cask/tephra/zookeeper/BasicACLData.java  |    49 -
 .../tephra/zookeeper/BasicNodeChildren.java     |    67 -
 .../co/cask/tephra/zookeeper/BasicNodeData.java |    68 -
 .../tephra/zookeeper/TephraZKClientService.java |   627 -
 .../tephra/AbstractTransactionAwareTable.java   |   228 +
 .../tephra/AbstractTransactionExecutor.java     |   129 +
 .../main/java/org/apache/tephra/ChangeId.java   |    77 +
 .../tephra/DefaultTransactionExecutor.java      |   147 +
 .../tephra/InvalidTruncateTimeException.java    |    29 +
 .../java/org/apache/tephra/NoRetryStrategy.java |    33 +
 .../apache/tephra/RetryOnConflictStrategy.java  |    41 +
 .../java/org/apache/tephra/RetryStrategies.java |    40 +
 .../java/org/apache/tephra/RetryStrategy.java   |    34 +
 .../org/apache/tephra/TransactionAdmin.java     |   158 +
 .../org/apache/tephra/TransactionCodec.java     |    57 +
 .../org/apache/tephra/TransactionContext.java   |   323 +
 ...ransactionCouldNotTakeSnapshotException.java |    28 +
 .../org/apache/tephra/TransactionExecutor.java  |   141 +
 .../tephra/TransactionExecutorFactory.java      |    28 +
 .../org/apache/tephra/TransactionManager.java   |  1398 +++
 .../apache/tephra/TransactionServiceMain.java   |   149 +
 .../apache/tephra/TransactionSystemClient.java  |   142 +
 .../java/org/apache/tephra/TxConstants.java     |   343 +
 .../coprocessor/TransactionStateCache.java      |   176 +
 .../TransactionStateCacheSupplier.java          |    54 +
 .../apache/tephra/coprocessor/package-info.java |    22 +
 .../distributed/AbstractClientProvider.java     |   218 +
 .../distributed/CloseableThriftClient.java      |    44 +
 .../apache/tephra/distributed/ElasticPool.java  |   163 +
 .../distributed/PooledClientProvider.java       |   133 +
 .../apache/tephra/distributed/RetryNTimes.java  |    73 +
 .../tephra/distributed/RetryStrategy.java       |    42 +
 .../distributed/RetryStrategyProvider.java      |    40 +
 .../tephra/distributed/RetryWithBackoff.java    |   108 +
 .../distributed/SingleUseClientProvider.java    |    63 +
 .../distributed/ThreadLocalClientProvider.java  |    72 +
 .../distributed/ThriftClientProvider.java       |    67 +
 .../distributed/TransactionConverterUtils.java  |    91 +
 .../tephra/distributed/TransactionService.java  |   156 +
 .../distributed/TransactionServiceClient.java   |   473 +
 .../TransactionServiceThriftClient.java         |   244 +
 .../TransactionServiceThriftHandler.java        |   184 +
 .../apache/tephra/distributed/package-info.java |    23 +
 .../tephra/distributed/thrift/TBoolean.java     |   392 +
 .../thrift/TInvalidTruncateTimeException.java   |   394 +
 .../tephra/distributed/thrift/TTransaction.java |  1364 ++
 ...ransactionCouldNotTakeSnapshotException.java |   394 +
 .../TTransactionNotInProgressException.java     |   394 +
 .../distributed/thrift/TTransactionServer.java  | 11072 +++++++++++++++++
 .../distributed/thrift/TTransactionType.java    |    59 +
 .../distributed/thrift/TVisibilityLevel.java    |    62 +
 .../tephra/inmemory/DetachedTxSystemClient.java |   143 +
 .../inmemory/InMemoryTransactionService.java    |   132 +
 .../tephra/inmemory/InMemoryTxSystemClient.java |   136 +
 .../tephra/inmemory/MinimalTxSystemClient.java  |   112 +
 .../apache/tephra/inmemory/package-info.java    |    22 +
 .../tephra/metrics/DefaultMetricsCollector.java |   117 +
 .../apache/tephra/metrics/MetricsCollector.java |    53 +
 .../tephra/metrics/TxMetricsCollector.java      |    66 +
 .../java/org/apache/tephra/package-info.java    |    22 +
 .../tephra/persist/AbstractTransactionLog.java  |   251 +
 .../AbstractTransactionStateStorage.java        |    43 +
 .../tephra/persist/CommitMarkerCodec.java       |   118 +
 .../tephra/persist/HDFSTransactionLog.java      |   147 +
 .../HDFSTransactionLogReaderSupplier.java       |    58 +
 .../persist/HDFSTransactionLogReaderV1.java     |    72 +
 .../persist/HDFSTransactionLogReaderV2.java     |   114 +
 .../persist/HDFSTransactionStateStorage.java    |   492 +
 .../org/apache/tephra/persist/HDFSUtil.java     |   212 +
 .../tephra/persist/LocalFileTransactionLog.java |   135 +
 .../LocalFileTransactionStateStorage.java       |   346 +
 .../persist/NoOpTransactionStateStorage.java    |   152 +
 .../apache/tephra/persist/TransactionEdit.java  |   360 +
 .../tephra/persist/TransactionEditCodecs.java   |   313 +
 .../apache/tephra/persist/TransactionLog.java   |    40 +
 .../tephra/persist/TransactionLogReader.java    |    42 +
 .../tephra/persist/TransactionLogWriter.java    |    52 +
 .../tephra/persist/TransactionSnapshot.java     |   199 +
 .../tephra/persist/TransactionStateStorage.java |   103 +
 .../persist/TransactionVisibilityState.java     |    63 +
 .../org/apache/tephra/persist/package-info.java |    22 +
 .../apache/tephra/rpc/RPCServiceHandler.java    |    28 +
 .../org/apache/tephra/rpc/ThriftRPCServer.java  |   277 +
 .../org/apache/tephra/rpc/package-info.java     |    21 +
 .../org/apache/tephra/runtime/ConfigModule.java |    39 +
 .../apache/tephra/runtime/DiscoveryModules.java |   110 +
 .../tephra/runtime/TransactionClientModule.java |    79 +
 .../runtime/TransactionDistributedModule.java   |    57 +
 .../runtime/TransactionInMemoryModule.java      |    57 +
 .../tephra/runtime/TransactionLocalModule.java  |    57 +
 .../tephra/runtime/TransactionModules.java      |    41 +
 .../TransactionStateStorageProvider.java        |    55 +
 .../org/apache/tephra/runtime/ZKModule.java     |    69 +
 .../apache/tephra/snapshot/BinaryDecoder.java   |   110 +
 .../apache/tephra/snapshot/BinaryEncoder.java   |    89 +
 .../tephra/snapshot/DefaultSnapshotCodec.java   |   208 +
 .../apache/tephra/snapshot/SnapshotCodec.java   |    58 +
 .../tephra/snapshot/SnapshotCodecProvider.java  |   155 +
 .../apache/tephra/snapshot/SnapshotCodecV2.java |    83 +
 .../apache/tephra/snapshot/SnapshotCodecV3.java |    36 +
 .../apache/tephra/snapshot/SnapshotCodecV4.java |   101 +
 .../apache/tephra/snapshot/package-info.java    |    22 +
 .../tephra/util/ConfigurationFactory.java       |    75 +
 .../tephra/util/ConfigurationProvider.java      |    32 +
 .../org/apache/tephra/util/HBaseVersion.java    |   207 +
 .../util/HBaseVersionSpecificFactory.java       |    74 +
 .../java/org/apache/tephra/util/TxUtils.java    |   152 +
 .../tephra/visibility/DefaultFenceWait.java     |    63 +
 .../org/apache/tephra/visibility/FenceWait.java |    46 +
 .../org/apache/tephra/visibility/ReadFence.java |    79 +
 .../tephra/visibility/VisibilityFence.java      |   140 +
 .../apache/tephra/visibility/WriteFence.java    |    87 +
 .../apache/tephra/zookeeper/BasicACLData.java   |    49 +
 .../tephra/zookeeper/BasicNodeChildren.java     |    67 +
 .../apache/tephra/zookeeper/BasicNodeData.java  |    68 +
 .../tephra/zookeeper/TephraZKClientService.java |   626 +
 tephra-core/src/main/thrift/transaction.thrift  |     2 +-
 .../tephra/ThriftTransactionSystemTest.java     |   119 -
 .../co/cask/tephra/TransactionAdminTest.java    |   179 -
 .../co/cask/tephra/TransactionContextTest.java  |   676 -
 .../co/cask/tephra/TransactionExecutorTest.java |   590 -
 .../co/cask/tephra/TransactionManagerTest.java  |   346 -
 .../cask/tephra/TransactionServiceMainTest.java |    77 -
 .../co/cask/tephra/TransactionSystemTest.java   |   320 -
 .../java/co/cask/tephra/TransactionTest.java    |   159 -
 .../tephra/distributed/ElasticPoolTest.java     |   130 -
 .../distributed/PooledClientProviderTest.java   |   187 -
 .../ThriftTransactionServerTest.java            |   238 -
 ...AbstractTransactionVisibilityFilterTest.java |    56 -
 .../AbstractTransactionStateStorageTest.java    |   555 -
 .../tephra/persist/CommitMarkerCodecTest.java   |   168 -
 .../tephra/persist/HDFSTransactionLogTest.java  |   198 -
 .../HDFSTransactionStateStorageTest.java        |    72 -
 .../InMemoryTransactionStateStorage.java        |   200 -
 .../LocalTransactionStateStorageTest.java       |   220 -
 .../tephra/persist/TransactionEditTest.java     |   124 -
 .../cask/tephra/snapshot/SnapshotCodecTest.java |   368 -
 .../util/AbstractConfigurationProviderTest.java |    47 -
 .../co/cask/tephra/util/HBaseVersionTest.java   |   110 -
 .../cask/tephra/util/TransactionEditUtil.java   |    86 -
 .../java/co/cask/tephra/util/TxUtilsTest.java   |    35 -
 .../tephra/visibility/VisibilityFenceTest.java  |   351 -
 .../tephra/ThriftTransactionSystemTest.java     |   119 +
 .../org/apache/tephra/TransactionAdminTest.java |   179 +
 .../apache/tephra/TransactionContextTest.java   |   676 +
 .../apache/tephra/TransactionExecutorTest.java  |   590 +
 .../apache/tephra/TransactionManagerTest.java   |   346 +
 .../tephra/TransactionServiceMainTest.java      |    77 +
 .../apache/tephra/TransactionSystemTest.java    |   320 +
 .../java/org/apache/tephra/TransactionTest.java |   159 +
 .../tephra/distributed/ElasticPoolTest.java     |   130 +
 .../distributed/PooledClientProviderTest.java   |   187 +
 .../ThriftTransactionServerTest.java            |   238 +
 ...AbstractTransactionVisibilityFilterTest.java |    56 +
 .../AbstractTransactionStateStorageTest.java    |   555 +
 .../tephra/persist/CommitMarkerCodecTest.java   |   168 +
 .../tephra/persist/HDFSTransactionLogTest.java  |   198 +
 .../HDFSTransactionStateStorageTest.java        |    72 +
 .../InMemoryTransactionStateStorage.java        |   200 +
 .../LocalTransactionStateStorageTest.java       |   220 +
 .../tephra/persist/TransactionEditTest.java     |   124 +
 .../tephra/snapshot/SnapshotCodecTest.java      |   368 +
 .../util/AbstractConfigurationProviderTest.java |    47 +
 .../apache/tephra/util/HBaseVersionTest.java    |   110 +
 .../apache/tephra/util/TransactionEditUtil.java |    86 +
 .../org/apache/tephra/util/TxUtilsTest.java     |    35 +
 .../tephra/visibility/VisibilityFenceTest.java  |   351 +
 .../co/cask/tephra/examples/BalanceBooks.java   |   357 -
 .../co/cask/tephra/examples/package-info.java   |    40 -
 .../apache/tephra/examples/BalanceBooks.java    |   357 +
 .../apache/tephra/examples/package-info.java    |    40 +
 .../cask/tephra/examples/BalanceBooksTest.java  |   131 -
 .../tephra/examples/BalanceBooksTest.java       |   131 +
 .../hbase96/HBase96ConfigurationProvider.java   |    38 -
 .../tephra/hbase96/SecondaryIndexTable.java     |   170 -
 .../tephra/hbase96/TransactionAwareHTable.java  |   615 -
 .../hbase96/coprocessor/CellSkipFilter.java     |   134 -
 .../hbase96/coprocessor/TransactionFilters.java |    62 -
 .../coprocessor/TransactionProcessor.java       |   349 -
 .../TransactionVisibilityFilter.java            |   313 -
 .../hbase96/HBase96ConfigurationProvider.java   |    38 +
 .../tephra/hbase96/SecondaryIndexTable.java     |   170 +
 .../tephra/hbase96/TransactionAwareHTable.java  |   615 +
 .../hbase96/coprocessor/CellSkipFilter.java     |   134 +
 .../hbase96/coprocessor/TransactionFilters.java |    62 +
 .../coprocessor/TransactionProcessor.java       |   349 +
 .../TransactionVisibilityFilter.java            |   313 +
 .../HBase96ConfigurationProviderTest.java       |    32 -
 .../hbase96/TransactionAwareHTableTest.java     |  1555 ---
 .../hbase96/coprocessor/CellSkipFilterTest.java |   123 -
 .../coprocessor/TransactionProcessorTest.java   |   771 --
 .../TransactionVisibilityFilterTest.java        |   374 -
 .../HBase96ConfigurationProviderTest.java       |    32 +
 .../hbase96/TransactionAwareHTableTest.java     |  1555 +++
 .../hbase96/coprocessor/CellSkipFilterTest.java |   123 +
 .../coprocessor/TransactionProcessorTest.java   |   771 ++
 .../TransactionVisibilityFilterTest.java        |   374 +
 .../hbase98/HBase98ConfigurationProvider.java   |    38 -
 .../tephra/hbase98/SecondaryIndexTable.java     |   170 -
 .../tephra/hbase98/TransactionAwareHTable.java  |   642 -
 .../hbase98/coprocessor/CellSkipFilter.java     |   134 -
 .../hbase98/coprocessor/TransactionFilters.java |    62 -
 .../coprocessor/TransactionProcessor.java       |   349 -
 .../TransactionVisibilityFilter.java            |   313 -
 .../hbase98/HBase98ConfigurationProvider.java   |    38 +
 .../tephra/hbase98/SecondaryIndexTable.java     |   170 +
 .../tephra/hbase98/TransactionAwareHTable.java  |   642 +
 .../hbase98/coprocessor/CellSkipFilter.java     |   134 +
 .../hbase98/coprocessor/TransactionFilters.java |    62 +
 .../coprocessor/TransactionProcessor.java       |   349 +
 .../TransactionVisibilityFilter.java            |   313 +
 .../HBase98ConfigurationProviderTest.java       |    32 -
 .../hbase98/TransactionAwareHTableTest.java     |  1552 ---
 .../hbase98/coprocessor/CellSkipFilterTest.java |   123 -
 .../coprocessor/TransactionProcessorTest.java   |   814 --
 .../TransactionVisibilityFilterTest.java        |   373 -
 .../HBase98ConfigurationProviderTest.java       |    32 +
 .../hbase98/TransactionAwareHTableTest.java     |  1552 +++
 .../hbase98/coprocessor/CellSkipFilterTest.java |   123 +
 .../coprocessor/TransactionProcessorTest.java   |   814 ++
 .../TransactionVisibilityFilterTest.java        |   373 +
 .../HBase10ConfigurationProvider.java           |    38 -
 .../tephra/hbase10cdh/SecondaryIndexTable.java  |   170 -
 .../hbase10cdh/TransactionAwareHTable.java      |   674 -
 .../hbase10cdh/coprocessor/CellSkipFilter.java  |   138 -
 .../coprocessor/TransactionFilters.java         |    62 -
 .../coprocessor/TransactionProcessor.java       |   349 -
 .../TransactionVisibilityFilter.java            |   313 -
 .../HBase10ConfigurationProvider.java           |    38 +
 .../tephra/hbase10cdh/SecondaryIndexTable.java  |   170 +
 .../hbase10cdh/TransactionAwareHTable.java      |   674 +
 .../hbase10cdh/coprocessor/CellSkipFilter.java  |   138 +
 .../coprocessor/TransactionFilters.java         |    62 +
 .../coprocessor/TransactionProcessor.java       |   349 +
 .../TransactionVisibilityFilter.java            |   313 +
 .../HBase10ConfigurationProviderTest.java       |    32 -
 .../hbase10cdh/TransactionAwareHTableTest.java  |  1552 ---
 .../coprocessor/CellSkipFilterTest.java         |   123 -
 .../coprocessor/TransactionProcessorTest.java   |   620 -
 .../TransactionVisibilityFilterTest.java        |   373 -
 .../HBase10ConfigurationProviderTest.java       |    32 +
 .../hbase10cdh/TransactionAwareHTableTest.java  |  1552 +++
 .../coprocessor/CellSkipFilterTest.java         |   123 +
 .../coprocessor/TransactionProcessorTest.java   |   620 +
 .../TransactionVisibilityFilterTest.java        |   373 +
 .../hbase10/HBase10ConfigurationProvider.java   |    38 -
 .../tephra/hbase10/SecondaryIndexTable.java     |   170 -
 .../tephra/hbase10/TransactionAwareHTable.java  |   674 -
 .../hbase10/coprocessor/CellSkipFilter.java     |   138 -
 .../hbase10/coprocessor/TransactionFilters.java |    62 -
 .../coprocessor/TransactionProcessor.java       |   349 -
 .../TransactionVisibilityFilter.java            |   313 -
 .../hbase10/HBase10ConfigurationProvider.java   |    38 +
 .../tephra/hbase10/SecondaryIndexTable.java     |   170 +
 .../tephra/hbase10/TransactionAwareHTable.java  |   674 +
 .../hbase10/coprocessor/CellSkipFilter.java     |   138 +
 .../hbase10/coprocessor/TransactionFilters.java |    62 +
 .../coprocessor/TransactionProcessor.java       |   349 +
 .../TransactionVisibilityFilter.java            |   313 +
 .../HBase10ConfigurationProviderTest.java       |    32 -
 .../hbase10/TransactionAwareHTableTest.java     |  1552 ---
 .../hbase10/coprocessor/CellSkipFilterTest.java |   123 -
 .../coprocessor/TransactionProcessorTest.java   |   620 -
 .../TransactionVisibilityFilterTest.java        |   373 -
 .../HBase10ConfigurationProviderTest.java       |    32 +
 .../hbase10/TransactionAwareHTableTest.java     |  1552 +++
 .../hbase10/coprocessor/CellSkipFilterTest.java |   123 +
 .../coprocessor/TransactionProcessorTest.java   |   620 +
 .../TransactionVisibilityFilterTest.java        |   373 +
 .../hbase11/HBase11ConfigurationProvider.java   |    38 -
 .../tephra/hbase11/SecondaryIndexTable.java     |   178 -
 .../tephra/hbase11/TransactionAwareHTable.java  |   674 -
 .../hbase11/coprocessor/CellSkipFilter.java     |   138 -
 .../hbase11/coprocessor/TransactionFilters.java |    62 -
 .../coprocessor/TransactionProcessor.java       |   348 -
 .../TransactionVisibilityFilter.java            |   308 -
 .../hbase11/HBase11ConfigurationProvider.java   |    38 +
 .../tephra/hbase11/SecondaryIndexTable.java     |   178 +
 .../tephra/hbase11/TransactionAwareHTable.java  |   674 +
 .../hbase11/coprocessor/CellSkipFilter.java     |   138 +
 .../hbase11/coprocessor/TransactionFilters.java |    62 +
 .../coprocessor/TransactionProcessor.java       |   348 +
 .../TransactionVisibilityFilter.java            |   308 +
 .../HBase11ConfigurationProviderTest.java       |    32 -
 .../hbase11/TransactionAwareHTableTest.java     |  1546 ---
 .../hbase11/coprocessor/CellSkipFilterTest.java |   123 -
 .../coprocessor/TransactionProcessorTest.java   |   622 -
 .../TransactionVisibilityFilterTest.java        |   374 -
 .../HBase11ConfigurationProviderTest.java       |    32 +
 .../hbase11/TransactionAwareHTableTest.java     |  1546 +++
 .../hbase11/coprocessor/CellSkipFilterTest.java |   123 +
 .../coprocessor/TransactionProcessorTest.java   |   622 +
 .../TransactionVisibilityFilterTest.java        |   374 +
 418 files changed, 57024 insertions(+), 57057 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/README.rst
----------------------------------------------------------------------
diff --git a/README.rst b/README.rst
index af2bde1..e1221b4 100644
--- a/README.rst
+++ b/README.rst
@@ -142,12 +142,12 @@ For any client applications, add the following dependencies to any Apache Maven
 build system's equivalent configuration), in order to make use of Tephra classes::
 
   <dependency>
-    <groupId>co.cask.tephra</groupId>
+    <groupId>org.apache.tephra</groupId>
     <artifactId>tephra-api</artifactId>
     <version>0.7.1</version>
   </dependency>
   <dependency>
-    <groupId>co.cask.tephra</groupId>
+    <groupId>org.apache.tephra</groupId>
     <artifactId>tephra-core</artifactId>
     <version>0.7.1</version>
   </dependency>
@@ -158,7 +158,7 @@ appropriate HBase compatibility library.
 For HBase 0.96.x::
 
   <dependency>
-    <groupId>co.cask.tephra</groupId>
+    <groupId>org.apache.tephra</groupId>
     <artifactId>tephra-hbase-compat-0.96</artifactId>
     <version>0.7.1</version>
   </dependency>
@@ -166,7 +166,7 @@ For HBase 0.96.x::
 For HBase 0.98.x::
 
   <dependency>
-    <groupId>co.cask.tephra</groupId>
+    <groupId>org.apache.tephra</groupId>
     <artifactId>tephra-hbase-compat-0.98</artifactId>
     <version>0.7.1</version>
   </dependency>
@@ -174,7 +174,7 @@ For HBase 0.98.x::
 For HBase 1.0.x::
 
   <dependency>
-    <groupId>co.cask.tephra</groupId>
+    <groupId>org.apache.tephra</groupId>
     <artifactId>tephra-hbase-compat-1.0</artifactId>
     <version>0.7.1</version>
   </dependency>
@@ -183,7 +183,7 @@ If you are running the CDH 5.4, 5.5, or 5.6 version of HBase 1.0.x (this version
 with Apache HBase 1.0.x)::
 
   <dependency>
-    <groupId>co.cask.tephra</groupId>
+    <groupId>org.apache.tephra</groupId>
     <artifactId>tephra-hbase-compat-1.0-cdh</artifactId>
     <version>0.7.1</version>
   </dependency>
@@ -191,7 +191,7 @@ with Apache HBase 1.0.x)::
 For HBase 1.1.x or CDH 5.7 version of HBase 1.2.x::
 
   <dependency>
-    <groupId>co.cask.tephra</groupId>
+    <groupId>org.apache.tephra</groupId>
     <artifactId>tephra-hbase-compat-1.1</artifactId>
     <version>0.7.1</version>
   </dependency>
@@ -302,35 +302,35 @@ For HBase 0.96.x::
 
   <property>
     <name>hbase.coprocessor.region.classes</name>
-    <value>co.cask.tephra.hbase96.coprocessor.TransactionProcessor</value>
+    <value>org.apache.tephra.hbase96.coprocessor.TransactionProcessor</value>
   </property>
 
 For HBase 0.98.x::
 
   <property>
     <name>hbase.coprocessor.region.classes</name>
-    <value>co.cask.tephra.hbase98.coprocessor.TransactionProcessor</value>
+    <value>org.apache.tephra.hbase98.coprocessor.TransactionProcessor</value>
   </property>
 
 For HBase 1.0.x::
 
   <property>
     <name>hbase.coprocessor.region.classes</name>
-    <value>co.cask.tephra.hbase10.coprocessor.TransactionProcessor</value>
+    <value>org.apache.tephra.hbase10.coprocessor.TransactionProcessor</value>
   </property>
 
 For the CDH 5.4, 5.5, or 5.6 version of HBase 1.0.x::
 
   <property>
     <name>hbase.coprocessor.region.classes</name>
-    <value>co.cask.tephra.hbase10cdh.coprocessor.TransactionProcessor</value>
+    <value>org.apache.tephra.hbase10cdh.coprocessor.TransactionProcessor</value>
   </property>
 
 For HBase 1.1.x or CDH 5.7 version of HBase 1.2.x::
 
   <property>
     <name>hbase.coprocessor.region.classes</name>
-    <value>co.cask.tephra.hbase11.coprocessor.TransactionProcessor</value>
+    <value>org.apache.tephra.hbase11.coprocessor.TransactionProcessor</value>
   </property>
 
 You may configure the ``TransactionProcessor`` to be loaded only on HBase tables that you will
@@ -622,7 +622,7 @@ Known Issues and Limitations
   changes, its transaction ID is added to a list of excluded transactions.  Data from invalidated
   transactions will be dropped by the ``TransactionProcessor`` coprocessor on HBase region flush
   and compaction operations.  Currently, however, transaction IDs can only be manually removed
-  from the list of excluded transaction IDs, using the ``co.cask.tephra.TransactionAdmin`` tool.
+  from the list of excluded transaction IDs, using the ``org.apache.tephra.TransactionAdmin`` tool.
 
 
 How to Contribute

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/bin/tephra
----------------------------------------------------------------------
diff --git a/bin/tephra b/bin/tephra
index 834117b..303d189 100644
--- a/bin/tephra
+++ b/bin/tephra
@@ -169,7 +169,7 @@ start() {
   echo "`date` Starting $APP service on `hostname`" >> $loglog
   echo "`ulimit -a`" >> $loglog 2>&1
 
-  export MAIN_CLASS="co.cask.tephra.TransactionServiceMain"
+  export MAIN_CLASS="org.apache.tephra.TransactionServiceMain"
   echo "Running class $MAIN_CLASS"
   echo "Command: " "$JAVA" $OPTS -cp $CLASSPATH $JAVA_HEAPMAX $MAIN_CLASS >>$loglog
   nohup nice -n $NICENESS "$JAVA" $OPTS -cp $CLASSPATH $JAVA_HEAPMAX ${MAIN_CLASS} </dev/null >>$loglog 2>&1 &

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/conf/logback.xml
----------------------------------------------------------------------
diff --git a/conf/logback.xml b/conf/logback.xml
index 6a0f5d5..0bc5998 100644
--- a/conf/logback.xml
+++ b/conf/logback.xml
@@ -30,7 +30,7 @@
     <logger name="org.apache.hadoop" level="WARN"/>
     <logger name="org.apache.hive" level="WARN"/>
     <logger name="org.quartz.core" level="WARN"/>
-    <logger name="co.cask.tephra" level="INFO"/>
+    <logger name="org.apache.tephra" level="INFO"/>
 
     <appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
       <encoder>

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-api/src/main/java/co/cask/tephra/Transaction.java
----------------------------------------------------------------------
diff --git a/tephra-api/src/main/java/co/cask/tephra/Transaction.java b/tephra-api/src/main/java/co/cask/tephra/Transaction.java
deleted file mode 100644
index 753a064..0000000
--- a/tephra-api/src/main/java/co/cask/tephra/Transaction.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package co.cask.tephra;
-
-import java.util.Arrays;
-
-/**
- * Transaction details
- */
-// NOTE: this class should have minimal dependencies as it is used in HBase CPs and other places where minimal classes
-//       are available
-public class Transaction {
-  private final long readPointer;
-  private final long txId;
-  private final long writePointer;
-  private final long[] invalids;
-  private final long[] inProgress;
-  private final long firstShortInProgress;
-  private final TransactionType type;
-  private final long[] checkpointWritePointers;
-
-  private VisibilityLevel visibilityLevel = VisibilityLevel.SNAPSHOT;
-
-  private static final long[] NO_EXCLUDES = { };
-  public static final long NO_TX_IN_PROGRESS = Long.MAX_VALUE;
-
-  public static final Transaction ALL_VISIBLE_LATEST =
-    new Transaction(Long.MAX_VALUE, Long.MAX_VALUE, NO_EXCLUDES, NO_EXCLUDES, NO_TX_IN_PROGRESS, TransactionType.SHORT);
-
-  /**
-   * Defines the possible visibility levels for read operations.
-   *
-   * <p>
-   * <ul>
-   *   <li><code>SNAPSHOT</code> - uses the transaction's read snapshot, plus includes all write pointers from the
-   *       current transaction</li>
-   *   <li><code>SNAPSHOT_EXCLUDE_CURRENT</code> - uses the transaction's read snapshot, plus includes all write
-   *       pointers from the current transaction, <strong>except</strong> the current write pointer
-   *       (see {@link #getWritePointer()})</li>
-   *   <li><code>SNAPSHOT_ALL</code> - uses the transaction's read snapshot, plus includes all write pointers from the
-   *       current transaction. This visibility level will lead to raw fetch operations, where all versions
-   *       (including deletes) visible to current transaction are returned.</li>
-   * </ul>
-   * </p>
-   *
-   * <p>The default value used is {@code SNAPSHOT}.</p>
-   *
-   * @see #setVisibility(VisibilityLevel)
-   */
-  public enum VisibilityLevel {
-    SNAPSHOT,
-    SNAPSHOT_EXCLUDE_CURRENT,
-    SNAPSHOT_ALL
-  }
-
-  /**
-   * Creates a new short transaction.
-   * @param readPointer read pointer for transaction
-   * @param txId unique identifier for the transaction
-   * @param invalids list of invalid transactions to exclude while reading
-   * @param inProgress list of in-progress transactions to exclude while reading
-   * @param firstShortInProgress earliest in-progress short transaction
-   */
-  public Transaction(long readPointer, long txId, long[] invalids, long[] inProgress,
-                     long firstShortInProgress) {
-    this(readPointer, txId, invalids, inProgress, firstShortInProgress, TransactionType.SHORT);
-  }
-
-  /**
-   * Creates a new transaction.
-   * @param readPointer read pointer for transaction
-   * @param txId unique identifier for the transaction
-   * @param invalids list of invalid transactions to exclude while reading
-   * @param inProgress list of in-progress transactions to exclude while reading
-   * @param firstShortInProgress earliest in-progress short transaction
-   * @param type transaction type
-   */
-  public Transaction(long readPointer, long txId, long[] invalids, long[] inProgress,
-                     long firstShortInProgress, TransactionType type) {
-    this(readPointer, txId, txId, invalids, inProgress, firstShortInProgress, type, new long[0],
-        VisibilityLevel.SNAPSHOT);
-  }
-
-  /**
-   * Creates a new transaction.
-   * @param readPointer read pointer for transaction
-   * @param txId unique identifier for the transaction
-   * @param writePointer the current pointer to be used for any writes.
-   *                      For new transactions, this will be the same as {@code txId}.  For checkpointed
-   *                      transactions, this will be the most recent write pointer issued.
-   * @param invalids list of invalid transactions to exclude while reading
-   * @param inProgress list of in-progress transactions to exclude while reading
-   * @param firstShortInProgress earliest in-progress short transaction
-   * @param type transaction type
-   * @param checkpointPointers the list of writer pointers added from checkpoints on the transaction
-   * @param visibilityLevel the visibility level to use for transactional reads
-   */
-  public Transaction(long readPointer, long txId, long writePointer, long[] invalids, long[] inProgress,
-                     long firstShortInProgress, TransactionType type, long[] checkpointPointers,
-                     VisibilityLevel visibilityLevel) {
-    this.readPointer = readPointer;
-    this.txId = txId;
-    this.writePointer = writePointer;
-    this.invalids = invalids;
-    this.inProgress = inProgress;
-    this.firstShortInProgress = firstShortInProgress;
-    this.type = type;
-    this.checkpointWritePointers = checkpointPointers;
-    this.visibilityLevel = visibilityLevel;
-  }
-
-  /**
-   * 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());
-  }
-
-  public long getReadPointer() {
-    return readPointer;
-  }
-
-  /**
-   * Returns the initial write pointer assigned to the transaction.  This will remain the same for the life of the
-   * transaction, and uniquely identifies it with the transaction service.  This value should be provided
-   * to identify the transaction when calling any transaction lifecycle methods on the transaction service.
-   */
-  public long getTransactionId() {
-    return txId;
-  }
-
-  /**
-   * Returns the write pointer to be used in persisting any changes.  After a checkpoint is performed, this will differ
-   * from {@link #getTransactionId()}.  This method should always be used when setting the timestamp for writes
-   * in order to ensure that the correct value is used.
-   */
-  public long getWritePointer() {
-    return writePointer;
-  }
-
-  public long[] getInvalids() {
-    return invalids;
-  }
-
-  public long[] getInProgress() {
-    return inProgress;
-  }
-
-  public long getFirstInProgress() {
-    return inProgress.length == 0 ? NO_TX_IN_PROGRESS : inProgress[0];
-  }
-
-  public TransactionType getType() {
-    return type;
-  }
-
-  /**
-   * @return transaction id {@code X} such that any of the transactions newer than {@code X} may be invisible to this<p>
-   *         NOTE: the returned tx id can be invalid.
-   */
-  public long getVisibilityUpperBound() {
-    // NOTE: in some cases when we do not provide visibility guarantee, we set readPointer to MAX value, but
-    //       at same time we don't want that to case cleanup everything as this is used for tx janitor + ttl to see
-    //       what can be cleaned up. When non-tx mode is implemented better, we should not need this check
-    return inProgress.length == 0 ? Math.min(txId - 1, readPointer) : inProgress[0] - 1;
-  }
-
-  public long getFirstShortInProgress() {
-    return firstShortInProgress;
-  }
-
-  /**
-   * Returns true if the given version corresponds to a transaction that was in-progress at the time this transaction
-   * started.
-   */
-  public boolean isInProgress(long version) {
-    return Arrays.binarySearch(inProgress, version) >= 0;
-  }
-
-  /**
-   * Returns true if the given version is present in one of the arrays of excluded versions (in-progress and
-   * invalid transactions).
-   */
-  public boolean isExcluded(long version) {
-    return Arrays.binarySearch(inProgress, version) >= 0
-      || Arrays.binarySearch(invalids, version) >= 0;
-  }
-
-  /**
-   * Returns true if the the given version corresponds to one of the checkpoint versions in the current
-   * transaction.
-   */
-  public boolean isCheckpoint(long version) {
-    return Arrays.binarySearch(checkpointWritePointers, version) >= 0;
-  }
-
-  /**
-   * 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).
-   *
-   * @param version the data version to check for visibility
-   * @return true if the version is visible, false if it should be hidden (filtered)
-   *
-   * @see #setVisibility(VisibilityLevel) to control whether the current write pointer is visible.
-   */
-  public boolean isVisible(long version) {
-    // either it was committed before or the change belongs to current tx
-    return (version <= getReadPointer() && !isExcluded(version)) ||
-        (isCurrentWrite(version) &&
-            (visibilityLevel != VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT || writePointer != version));
-  }
-
-  /**
-   * Returns whether the given version was written by the current transaction.
-   *
-   * @param version the data version
-   * @return true if version was written by current transaction, false otherwise.
-   */
-  public boolean isCurrentWrite(long version) {
-    return writePointer == version || txId == version || isCheckpoint(version);
-  }
-
-  /**
-   * Sets the visibility level for read operations.
-   */
-  public void setVisibility(VisibilityLevel level) {
-    this.visibilityLevel = level;
-  }
-
-  /**
-   * Returns the currently set visibility level.
-   */
-  public VisibilityLevel getVisibilityLevel() {
-    return visibilityLevel;
-  }
-
-  public boolean hasExcludes() {
-    return invalids.length > 0 || inProgress.length > 0;
-  }
-
-
-  public int excludesSize() {
-    return invalids.length + inProgress.length;
-  }
-
-  /**
-   * Returns any prior write pointers used in the current transaction.  A new write pointer is issued when the
-   * {@code TransactionContext.checkpoint(Transaction)} operation is called, and the prior write pointer is added
-   * to the array of checkpoint write pointers.
-`   */
-  public long[] getCheckpointWritePointers() {
-    return checkpointWritePointers;
-  }
-
-  @Override
-  public String toString() {
-    return new StringBuilder(100)
-      .append(Transaction.class.getSimpleName())
-      .append('{')
-      .append("readPointer: ").append(readPointer)
-      .append(", transactionId: ").append(txId)
-      .append(", writePointer: ").append(writePointer)
-      .append(", invalids: ").append(Arrays.toString(invalids))
-      .append(", inProgress: ").append(Arrays.toString(inProgress))
-      .append(", firstShortInProgress: ").append(firstShortInProgress)
-      .append(", type: ").append(type)
-      .append(", checkpointWritePointers: ").append(Arrays.toString(checkpointWritePointers))
-      .append(", visibilityLevel: ").append(visibilityLevel)
-      .append('}')
-      .toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-api/src/main/java/co/cask/tephra/TransactionAware.java
----------------------------------------------------------------------
diff --git a/tephra-api/src/main/java/co/cask/tephra/TransactionAware.java b/tephra-api/src/main/java/co/cask/tephra/TransactionAware.java
deleted file mode 100644
index 524d841..0000000
--- a/tephra-api/src/main/java/co/cask/tephra/TransactionAware.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package co.cask.tephra;
-
-import java.util.Collection;
-
-/**
- * Interface to be implemented by a component that interacts with transaction logic.
- * <p/>
- * The client code that uses transaction logic looks like this:
- * <pre>
- *  TransactionAware dataSet = // ...              // dataSet is one example of component that interacts with tx logic
- *
- *  Transaction tx = txClient.start();
- *  dataSet.startTx(tx);                           // notifying about new transaction
- *  dataSet.write(...);
- *  // ... do other operations on dataSet
- *  Collection<byte[]> changes = dataSet.getTxChanges();
- *  boolean rollback = true;
- *  if (txClient.canCommit(changes)) {             // checking conflicts before commit, if none, commit tx
- *    if (dataSet.commitTx()) {                    // try persisting changes
- *      if (txClient.commit(tx)) {                 // if OK, make tx visible; if not - tx stays invisible to others
- *        dataSet.postTxCommit();                  // notifying dataset about tx commit success via callback
- *        rollback = false;
- *      }
- *    }
- *  }
- *
- *  if (rollback) {                                // if there are conflicts (or cannot commit), try rollback changes
- *    if (dataSet.rollbackTx()) {                  // try undo changes
- *      txClient.abort(tx);                        // if OK, make tx visible; if not - tx stays invisible to others
- *    }
- *  }
- *
- * </pre>
- */
-// todo: use custom exception class?
-// todo: review exception handling where it is used
-// todo: add flush()? nah - flush is same as commitTx() actually
-// todo: add onCommitted() - so that e.g. hbase table can do *actual* deletes at this point
-public interface TransactionAware {
-  /**
-   * Called when new transaction has started.  This may reset any state which has been left behind by the previous
-   * transaction.
-   *
-   * @param tx transaction info
-   */
-  // todo: rename to onTxStart()
-  void startTx(Transaction tx);
-
-  /**
-   * Called when the state of the current transaction has been updated.  This should replace any reference to the
-   * current {@link Transaction} held by this {@code TransactionAware}, but should <strong>not</strong> reset
-   * any state (such as the write change sets) that is currently maintained.
-   *
-   * @param tx the updated transaction
-   */
-  void updateTx(Transaction tx);
-
-  /**
-   * @return changes made by current transaction to be used for conflicts detection before commit.
-   */
-  Collection<byte[]> getTxChanges();
-
-  /**
-   * Called before transaction has been committed.
-   * Can be used e.g. to flush changes cached in-memory to persistent store.
-   * @return true if transaction can be committed, otherwise false.
-   */
-  // todo: rename to beforeTxCommit()
-  boolean commitTx() throws Exception;
-
-  /**
-   * Called after transaction has been committed.
-   * Can be used e.g. evict entries from a cache etc. Because this is called after the transaction is committed,
-   * the success or failure of the transaction cannot depend on it. Hence this method returns nothing and it is not
-   * expected to throw exceptions.
-   * @throws RuntimeException in case of serious failure that should not be ignored.
-   */
-  void postTxCommit();
-
-  /**
-   * Called during transaction rollback (for whatever reason: conflicts, errors, etc.).
-   * @return true if all changes made during transaction were rolled back, false otherwise (e.g. if more cleanup needed
-   *         or changes cannot be undone). True also means that this transaction can be made visible to others without
-   *         breaking consistency of the data: since all changes were undone there's "nothing to see".
-   */
-  // todo: rename to onTxRollback()
-  boolean rollbackTx() throws Exception;
-
-  /**
-   * Used for error reporting.
-   */
-  // todo: use toString() instead everywhere
-  String getTransactionAwareName();
-}

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-api/src/main/java/co/cask/tephra/TransactionAwares.java
----------------------------------------------------------------------
diff --git a/tephra-api/src/main/java/co/cask/tephra/TransactionAwares.java b/tephra-api/src/main/java/co/cask/tephra/TransactionAwares.java
deleted file mode 100644
index 044efc1..0000000
--- a/tephra-api/src/main/java/co/cask/tephra/TransactionAwares.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package co.cask.tephra;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Utility class that provides handy methods for working with {@link TransactionAware} classes and their instances.
- */
-public final class TransactionAwares {
-  private TransactionAwares() {}
-
-  /**
-   * Create composite transaction aware object that delegates transaction logic to given collection of
-   * {@link TransactionAware}s
-   * @param transactionAwares collection of {@link TransactionAware}s
-   * @return instance of {@link TransactionAware}
-   */
-  public static TransactionAware of(Collection<TransactionAware> transactionAwares) {
-    // this is most common case, trying to optimize
-    if (transactionAwares.size() == 1) {
-      return transactionAwares.iterator().next();
-    }
-
-    TransactionAwareCollection result = new TransactionAwareCollection();
-    result.addAll(transactionAwares);
-
-    return result;
-  }
-
-  private static class TransactionAwareCollection extends ArrayList<TransactionAware> implements TransactionAware {
-
-    @Override
-    public void startTx(Transaction tx) {
-      for (TransactionAware txAware : this) {
-        txAware.startTx(tx);
-      }
-    }
-
-    @Override
-    public void updateTx(Transaction tx) {
-      for (TransactionAware txAware : this) {
-        txAware.updateTx(tx);
-      }
-    }
-
-    @Override
-    public Collection<byte[]> getTxChanges() {
-      List<byte[]> changes = new ArrayList<byte[]>();
-      for (TransactionAware txAware : this) {
-        changes.addAll(txAware.getTxChanges());
-      }
-
-      return changes;
-    }
-
-    @Override
-    public boolean commitTx() throws Exception {
-      boolean success = true;
-      for (TransactionAware txAware : this) {
-        success = success && txAware.commitTx();
-      }
-      return success;
-    }
-
-    @Override
-    public void postTxCommit() {
-      for (TransactionAware txAware : this) {
-        txAware.postTxCommit();
-      }
-    }
-
-    @Override
-    public boolean rollbackTx() throws Exception {
-      boolean success = true;
-      for (TransactionAware txAware : this) {
-        success = success && txAware.rollbackTx();
-      }
-      return success;
-    }
-
-    @Override
-    public String getTransactionAwareName() {
-      // todo: will go away, see comment at TransactionAware
-      StringBuilder sb = new StringBuilder("{");
-      for (TransactionAware txAware : this) {
-        sb.append(txAware.getTransactionAwareName()).append(",");
-      }
-      sb.replace(sb.length() - 1, sb.length() - 1, "}");
-      return sb.toString();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-api/src/main/java/co/cask/tephra/TransactionConflictException.java
----------------------------------------------------------------------
diff --git a/tephra-api/src/main/java/co/cask/tephra/TransactionConflictException.java b/tephra-api/src/main/java/co/cask/tephra/TransactionConflictException.java
deleted file mode 100644
index 4b0733d..0000000
--- a/tephra-api/src/main/java/co/cask/tephra/TransactionConflictException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package co.cask.tephra;
-
-/**
- * Thrown to indicate transaction conflict occurred when trying to commit a transaction.
- */
-public class TransactionConflictException extends TransactionFailureException {
-  public TransactionConflictException(String message) {
-    super(message);
-  }
-
-  public TransactionConflictException(String message, Throwable cause) {
-    super(message, cause);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-api/src/main/java/co/cask/tephra/TransactionFailureException.java
----------------------------------------------------------------------
diff --git a/tephra-api/src/main/java/co/cask/tephra/TransactionFailureException.java b/tephra-api/src/main/java/co/cask/tephra/TransactionFailureException.java
deleted file mode 100644
index 1ce3071..0000000
--- a/tephra-api/src/main/java/co/cask/tephra/TransactionFailureException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package co.cask.tephra;
-
-/**
- * Thrown to indicate execution of a transaction failed.
- */
-public class TransactionFailureException extends Exception {
-  public TransactionFailureException(String message) {
-    super(message);
-  }
-
-  public TransactionFailureException(String message, Throwable cause) {
-    super(message, cause);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-api/src/main/java/co/cask/tephra/TransactionNotInProgressException.java
----------------------------------------------------------------------
diff --git a/tephra-api/src/main/java/co/cask/tephra/TransactionNotInProgressException.java b/tephra-api/src/main/java/co/cask/tephra/TransactionNotInProgressException.java
deleted file mode 100644
index 814421a..0000000
--- a/tephra-api/src/main/java/co/cask/tephra/TransactionNotInProgressException.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package co.cask.tephra;
-
-/**
- * Thrown when transaction has timed out.
- */
-public class TransactionNotInProgressException extends TransactionFailureException {
-  public TransactionNotInProgressException(String message) {
-    super(message);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-api/src/main/java/co/cask/tephra/TransactionType.java
----------------------------------------------------------------------
diff --git a/tephra-api/src/main/java/co/cask/tephra/TransactionType.java b/tephra-api/src/main/java/co/cask/tephra/TransactionType.java
deleted file mode 100644
index 1235525..0000000
--- a/tephra-api/src/main/java/co/cask/tephra/TransactionType.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package co.cask.tephra;
-
-/**
- * Type of transaction.
- */
-public enum TransactionType {
-  /**
-   * Short transactions detect conflicts during commit.
-   */
-  SHORT,
-  /**
-   * Long running transactions do not detect conflicts during commit.
-   */
-  LONG
-}

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-api/src/main/java/org/apache/tephra/Transaction.java
----------------------------------------------------------------------
diff --git a/tephra-api/src/main/java/org/apache/tephra/Transaction.java b/tephra-api/src/main/java/org/apache/tephra/Transaction.java
new file mode 100644
index 0000000..287423a
--- /dev/null
+++ b/tephra-api/src/main/java/org/apache/tephra/Transaction.java
@@ -0,0 +1,296 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tephra;
+
+import java.util.Arrays;
+
+/**
+ * Transaction details
+ */
+// NOTE: this class should have minimal dependencies as it is used in HBase CPs and other places where minimal classes
+//       are available
+public class Transaction {
+  private final long readPointer;
+  private final long txId;
+  private final long writePointer;
+  private final long[] invalids;
+  private final long[] inProgress;
+  private final long firstShortInProgress;
+  private final TransactionType type;
+  private final long[] checkpointWritePointers;
+
+  private VisibilityLevel visibilityLevel = VisibilityLevel.SNAPSHOT;
+
+  private static final long[] NO_EXCLUDES = { };
+  public static final long NO_TX_IN_PROGRESS = Long.MAX_VALUE;
+
+  public static final Transaction ALL_VISIBLE_LATEST =
+    new Transaction(Long.MAX_VALUE, Long.MAX_VALUE, NO_EXCLUDES, NO_EXCLUDES, NO_TX_IN_PROGRESS, TransactionType.SHORT);
+
+  /**
+   * Defines the possible visibility levels for read operations.
+   *
+   * <p>
+   * <ul>
+   *   <li><code>SNAPSHOT</code> - uses the transaction's read snapshot, plus includes all write pointers from the
+   *       current transaction</li>
+   *   <li><code>SNAPSHOT_EXCLUDE_CURRENT</code> - uses the transaction's read snapshot, plus includes all write
+   *       pointers from the current transaction, <strong>except</strong> the current write pointer
+   *       (see {@link #getWritePointer()})</li>
+   *   <li><code>SNAPSHOT_ALL</code> - uses the transaction's read snapshot, plus includes all write pointers from the
+   *       current transaction. This visibility level will lead to raw fetch operations, where all versions
+   *       (including deletes) visible to current transaction are returned.</li>
+   * </ul>
+   * </p>
+   *
+   * <p>The default value used is {@code SNAPSHOT}.</p>
+   *
+   * @see #setVisibility(VisibilityLevel)
+   */
+  public enum VisibilityLevel {
+    SNAPSHOT,
+    SNAPSHOT_EXCLUDE_CURRENT,
+    SNAPSHOT_ALL
+  }
+
+  /**
+   * Creates a new short transaction.
+   * @param readPointer read pointer for transaction
+   * @param txId unique identifier for the transaction
+   * @param invalids list of invalid transactions to exclude while reading
+   * @param inProgress list of in-progress transactions to exclude while reading
+   * @param firstShortInProgress earliest in-progress short transaction
+   */
+  public Transaction(long readPointer, long txId, long[] invalids, long[] inProgress,
+                     long firstShortInProgress) {
+    this(readPointer, txId, invalids, inProgress, firstShortInProgress, TransactionType.SHORT);
+  }
+
+  /**
+   * Creates a new transaction.
+   * @param readPointer read pointer for transaction
+   * @param txId unique identifier for the transaction
+   * @param invalids list of invalid transactions to exclude while reading
+   * @param inProgress list of in-progress transactions to exclude while reading
+   * @param firstShortInProgress earliest in-progress short transaction
+   * @param type transaction type
+   */
+  public Transaction(long readPointer, long txId, long[] invalids, long[] inProgress,
+                     long firstShortInProgress, TransactionType type) {
+    this(readPointer, txId, txId, invalids, inProgress, firstShortInProgress, type, new long[0],
+        VisibilityLevel.SNAPSHOT);
+  }
+
+  /**
+   * Creates a new transaction.
+   * @param readPointer read pointer for transaction
+   * @param txId unique identifier for the transaction
+   * @param writePointer the current pointer to be used for any writes.
+   *                      For new transactions, this will be the same as {@code txId}.  For checkpointed
+   *                      transactions, this will be the most recent write pointer issued.
+   * @param invalids list of invalid transactions to exclude while reading
+   * @param inProgress list of in-progress transactions to exclude while reading
+   * @param firstShortInProgress earliest in-progress short transaction
+   * @param type transaction type
+   * @param checkpointPointers the list of writer pointers added from checkpoints on the transaction
+   * @param visibilityLevel the visibility level to use for transactional reads
+   */
+  public Transaction(long readPointer, long txId, long writePointer, long[] invalids, long[] inProgress,
+                     long firstShortInProgress, TransactionType type, long[] checkpointPointers,
+                     VisibilityLevel visibilityLevel) {
+    this.readPointer = readPointer;
+    this.txId = txId;
+    this.writePointer = writePointer;
+    this.invalids = invalids;
+    this.inProgress = inProgress;
+    this.firstShortInProgress = firstShortInProgress;
+    this.type = type;
+    this.checkpointWritePointers = checkpointPointers;
+    this.visibilityLevel = visibilityLevel;
+  }
+
+  /**
+   * 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());
+  }
+
+  public long getReadPointer() {
+    return readPointer;
+  }
+
+  /**
+   * Returns the initial write pointer assigned to the transaction.  This will remain the same for the life of the
+   * transaction, and uniquely identifies it with the transaction service.  This value should be provided
+   * to identify the transaction when calling any transaction lifecycle methods on the transaction service.
+   */
+  public long getTransactionId() {
+    return txId;
+  }
+
+  /**
+   * Returns the write pointer to be used in persisting any changes.  After a checkpoint is performed, this will differ
+   * from {@link #getTransactionId()}.  This method should always be used when setting the timestamp for writes
+   * in order to ensure that the correct value is used.
+   */
+  public long getWritePointer() {
+    return writePointer;
+  }
+
+  public long[] getInvalids() {
+    return invalids;
+  }
+
+  public long[] getInProgress() {
+    return inProgress;
+  }
+
+  public long getFirstInProgress() {
+    return inProgress.length == 0 ? NO_TX_IN_PROGRESS : inProgress[0];
+  }
+
+  public TransactionType getType() {
+    return type;
+  }
+
+  /**
+   * @return transaction id {@code X} such that any of the transactions newer than {@code X} may be invisible to this<p>
+   *         NOTE: the returned tx id can be invalid.
+   */
+  public long getVisibilityUpperBound() {
+    // NOTE: in some cases when we do not provide visibility guarantee, we set readPointer to MAX value, but
+    //       at same time we don't want that to case cleanup everything as this is used for tx janitor + ttl to see
+    //       what can be cleaned up. When non-tx mode is implemented better, we should not need this check
+    return inProgress.length == 0 ? Math.min(txId - 1, readPointer) : inProgress[0] - 1;
+  }
+
+  public long getFirstShortInProgress() {
+    return firstShortInProgress;
+  }
+
+  /**
+   * Returns true if the given version corresponds to a transaction that was in-progress at the time this transaction
+   * started.
+   */
+  public boolean isInProgress(long version) {
+    return Arrays.binarySearch(inProgress, version) >= 0;
+  }
+
+  /**
+   * Returns true if the given version is present in one of the arrays of excluded versions (in-progress and
+   * invalid transactions).
+   */
+  public boolean isExcluded(long version) {
+    return Arrays.binarySearch(inProgress, version) >= 0
+      || Arrays.binarySearch(invalids, version) >= 0;
+  }
+
+  /**
+   * Returns true if the the given version corresponds to one of the checkpoint versions in the current
+   * transaction.
+   */
+  public boolean isCheckpoint(long version) {
+    return Arrays.binarySearch(checkpointWritePointers, version) >= 0;
+  }
+
+  /**
+   * 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).
+   *
+   * @param version the data version to check for visibility
+   * @return true if the version is visible, false if it should be hidden (filtered)
+   *
+   * @see #setVisibility(VisibilityLevel) to control whether the current write pointer is visible.
+   */
+  public boolean isVisible(long version) {
+    // either it was committed before or the change belongs to current tx
+    return (version <= getReadPointer() && !isExcluded(version)) ||
+        (isCurrentWrite(version) &&
+            (visibilityLevel != VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT || writePointer != version));
+  }
+
+  /**
+   * Returns whether the given version was written by the current transaction.
+   *
+   * @param version the data version
+   * @return true if version was written by current transaction, false otherwise.
+   */
+  public boolean isCurrentWrite(long version) {
+    return writePointer == version || txId == version || isCheckpoint(version);
+  }
+
+  /**
+   * Sets the visibility level for read operations.
+   */
+  public void setVisibility(VisibilityLevel level) {
+    this.visibilityLevel = level;
+  }
+
+  /**
+   * Returns the currently set visibility level.
+   */
+  public VisibilityLevel getVisibilityLevel() {
+    return visibilityLevel;
+  }
+
+  public boolean hasExcludes() {
+    return invalids.length > 0 || inProgress.length > 0;
+  }
+
+
+  public int excludesSize() {
+    return invalids.length + inProgress.length;
+  }
+
+  /**
+   * Returns any prior write pointers used in the current transaction.  A new write pointer is issued when the
+   * {@code TransactionContext.checkpoint(Transaction)} operation is called, and the prior write pointer is added
+   * to the array of checkpoint write pointers.
+`   */
+  public long[] getCheckpointWritePointers() {
+    return checkpointWritePointers;
+  }
+
+  @Override
+  public String toString() {
+    return new StringBuilder(100)
+      .append(Transaction.class.getSimpleName())
+      .append('{')
+      .append("readPointer: ").append(readPointer)
+      .append(", transactionId: ").append(txId)
+      .append(", writePointer: ").append(writePointer)
+      .append(", invalids: ").append(Arrays.toString(invalids))
+      .append(", inProgress: ").append(Arrays.toString(inProgress))
+      .append(", firstShortInProgress: ").append(firstShortInProgress)
+      .append(", type: ").append(type)
+      .append(", checkpointWritePointers: ").append(Arrays.toString(checkpointWritePointers))
+      .append(", visibilityLevel: ").append(visibilityLevel)
+      .append('}')
+      .toString();
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-api/src/main/java/org/apache/tephra/TransactionAware.java
----------------------------------------------------------------------
diff --git a/tephra-api/src/main/java/org/apache/tephra/TransactionAware.java b/tephra-api/src/main/java/org/apache/tephra/TransactionAware.java
new file mode 100644
index 0000000..a580914
--- /dev/null
+++ b/tephra-api/src/main/java/org/apache/tephra/TransactionAware.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tephra;
+
+import java.util.Collection;
+
+/**
+ * Interface to be implemented by a component that interacts with transaction logic.
+ * <p/>
+ * The client code that uses transaction logic looks like this:
+ * <pre>
+ *  TransactionAware dataSet = // ...              // dataSet is one example of component that interacts with tx logic
+ *
+ *  Transaction tx = txClient.start();
+ *  dataSet.startTx(tx);                           // notifying about new transaction
+ *  dataSet.write(...);
+ *  // ... do other operations on dataSet
+ *  Collection<byte[]> changes = dataSet.getTxChanges();
+ *  boolean rollback = true;
+ *  if (txClient.canCommit(changes)) {             // checking conflicts before commit, if none, commit tx
+ *    if (dataSet.commitTx()) {                    // try persisting changes
+ *      if (txClient.commit(tx)) {                 // if OK, make tx visible; if not - tx stays invisible to others
+ *        dataSet.postTxCommit();                  // notifying dataset about tx commit success via callback
+ *        rollback = false;
+ *      }
+ *    }
+ *  }
+ *
+ *  if (rollback) {                                // if there are conflicts (or cannot commit), try rollback changes
+ *    if (dataSet.rollbackTx()) {                  // try undo changes
+ *      txClient.abort(tx);                        // if OK, make tx visible; if not - tx stays invisible to others
+ *    }
+ *  }
+ *
+ * </pre>
+ */
+// todo: use custom exception class?
+// todo: review exception handling where it is used
+// todo: add flush()? nah - flush is same as commitTx() actually
+// todo: add onCommitted() - so that e.g. hbase table can do *actual* deletes at this point
+public interface TransactionAware {
+  /**
+   * Called when new transaction has started.  This may reset any state which has been left behind by the previous
+   * transaction.
+   *
+   * @param tx transaction info
+   */
+  // todo: rename to onTxStart()
+  void startTx(Transaction tx);
+
+  /**
+   * Called when the state of the current transaction has been updated.  This should replace any reference to the
+   * current {@link Transaction} held by this {@code TransactionAware}, but should <strong>not</strong> reset
+   * any state (such as the write change sets) that is currently maintained.
+   *
+   * @param tx the updated transaction
+   */
+  void updateTx(Transaction tx);
+
+  /**
+   * @return changes made by current transaction to be used for conflicts detection before commit.
+   */
+  Collection<byte[]> getTxChanges();
+
+  /**
+   * Called before transaction has been committed.
+   * Can be used e.g. to flush changes cached in-memory to persistent store.
+   * @return true if transaction can be committed, otherwise false.
+   */
+  // todo: rename to beforeTxCommit()
+  boolean commitTx() throws Exception;
+
+  /**
+   * Called after transaction has been committed.
+   * Can be used e.g. evict entries from a cache etc. Because this is called after the transaction is committed,
+   * the success or failure of the transaction cannot depend on it. Hence this method returns nothing and it is not
+   * expected to throw exceptions.
+   * @throws RuntimeException in case of serious failure that should not be ignored.
+   */
+  void postTxCommit();
+
+  /**
+   * Called during transaction rollback (for whatever reason: conflicts, errors, etc.).
+   * @return true if all changes made during transaction were rolled back, false otherwise (e.g. if more cleanup needed
+   *         or changes cannot be undone). True also means that this transaction can be made visible to others without
+   *         breaking consistency of the data: since all changes were undone there's "nothing to see".
+   */
+  // todo: rename to onTxRollback()
+  boolean rollbackTx() throws Exception;
+
+  /**
+   * Used for error reporting.
+   */
+  // todo: use toString() instead everywhere
+  String getTransactionAwareName();
+}

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-api/src/main/java/org/apache/tephra/TransactionAwares.java
----------------------------------------------------------------------
diff --git a/tephra-api/src/main/java/org/apache/tephra/TransactionAwares.java b/tephra-api/src/main/java/org/apache/tephra/TransactionAwares.java
new file mode 100644
index 0000000..40059ea
--- /dev/null
+++ b/tephra-api/src/main/java/org/apache/tephra/TransactionAwares.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tephra;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Utility class that provides handy methods for working with {@link TransactionAware} classes and their instances.
+ */
+public final class TransactionAwares {
+  private TransactionAwares() {}
+
+  /**
+   * Create composite transaction aware object that delegates transaction logic to given collection of
+   * {@link TransactionAware}s
+   * @param transactionAwares collection of {@link TransactionAware}s
+   * @return instance of {@link TransactionAware}
+   */
+  public static TransactionAware of(Collection<TransactionAware> transactionAwares) {
+    // this is most common case, trying to optimize
+    if (transactionAwares.size() == 1) {
+      return transactionAwares.iterator().next();
+    }
+
+    TransactionAwareCollection result = new TransactionAwareCollection();
+    result.addAll(transactionAwares);
+
+    return result;
+  }
+
+  private static class TransactionAwareCollection extends ArrayList<TransactionAware> implements TransactionAware {
+
+    @Override
+    public void startTx(Transaction tx) {
+      for (TransactionAware txAware : this) {
+        txAware.startTx(tx);
+      }
+    }
+
+    @Override
+    public void updateTx(Transaction tx) {
+      for (TransactionAware txAware : this) {
+        txAware.updateTx(tx);
+      }
+    }
+
+    @Override
+    public Collection<byte[]> getTxChanges() {
+      List<byte[]> changes = new ArrayList<byte[]>();
+      for (TransactionAware txAware : this) {
+        changes.addAll(txAware.getTxChanges());
+      }
+
+      return changes;
+    }
+
+    @Override
+    public boolean commitTx() throws Exception {
+      boolean success = true;
+      for (TransactionAware txAware : this) {
+        success = success && txAware.commitTx();
+      }
+      return success;
+    }
+
+    @Override
+    public void postTxCommit() {
+      for (TransactionAware txAware : this) {
+        txAware.postTxCommit();
+      }
+    }
+
+    @Override
+    public boolean rollbackTx() throws Exception {
+      boolean success = true;
+      for (TransactionAware txAware : this) {
+        success = success && txAware.rollbackTx();
+      }
+      return success;
+    }
+
+    @Override
+    public String getTransactionAwareName() {
+      // todo: will go away, see comment at TransactionAware
+      StringBuilder sb = new StringBuilder("{");
+      for (TransactionAware txAware : this) {
+        sb.append(txAware.getTransactionAwareName()).append(",");
+      }
+      sb.replace(sb.length() - 1, sb.length() - 1, "}");
+      return sb.toString();
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-api/src/main/java/org/apache/tephra/TransactionConflictException.java
----------------------------------------------------------------------
diff --git a/tephra-api/src/main/java/org/apache/tephra/TransactionConflictException.java b/tephra-api/src/main/java/org/apache/tephra/TransactionConflictException.java
new file mode 100644
index 0000000..d07ed04
--- /dev/null
+++ b/tephra-api/src/main/java/org/apache/tephra/TransactionConflictException.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tephra;
+
+/**
+ * Thrown to indicate transaction conflict occurred when trying to commit a transaction.
+ */
+public class TransactionConflictException extends TransactionFailureException {
+  public TransactionConflictException(String message) {
+    super(message);
+  }
+
+  public TransactionConflictException(String message, Throwable cause) {
+    super(message, cause);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-api/src/main/java/org/apache/tephra/TransactionFailureException.java
----------------------------------------------------------------------
diff --git a/tephra-api/src/main/java/org/apache/tephra/TransactionFailureException.java b/tephra-api/src/main/java/org/apache/tephra/TransactionFailureException.java
new file mode 100644
index 0000000..88932a4
--- /dev/null
+++ b/tephra-api/src/main/java/org/apache/tephra/TransactionFailureException.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tephra;
+
+/**
+ * Thrown to indicate execution of a transaction failed.
+ */
+public class TransactionFailureException extends Exception {
+  public TransactionFailureException(String message) {
+    super(message);
+  }
+
+  public TransactionFailureException(String message, Throwable cause) {
+    super(message, cause);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-api/src/main/java/org/apache/tephra/TransactionNotInProgressException.java
----------------------------------------------------------------------
diff --git a/tephra-api/src/main/java/org/apache/tephra/TransactionNotInProgressException.java b/tephra-api/src/main/java/org/apache/tephra/TransactionNotInProgressException.java
new file mode 100644
index 0000000..9f765ec
--- /dev/null
+++ b/tephra-api/src/main/java/org/apache/tephra/TransactionNotInProgressException.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tephra;
+
+/**
+ * Thrown when transaction has timed out.
+ */
+public class TransactionNotInProgressException extends TransactionFailureException {
+  public TransactionNotInProgressException(String message) {
+    super(message);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/9c693743/tephra-api/src/main/java/org/apache/tephra/TransactionType.java
----------------------------------------------------------------------
diff --git a/tephra-api/src/main/java/org/apache/tephra/TransactionType.java b/tephra-api/src/main/java/org/apache/tephra/TransactionType.java
new file mode 100644
index 0000000..7febe49
--- /dev/null
+++ b/tephra-api/src/main/java/org/apache/tephra/TransactionType.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tephra;
+
+/**
+ * Type of transaction.
+ */
+public enum TransactionType {
+  /**
+   * Short transactions detect conflicts during commit.
+   */
+  SHORT,
+  /**
+   * Long running transactions do not detect conflicts during commit.
+   */
+  LONG
+}