public interface TransactionController
extends java.lang.AutoCloseable
Dataset
s to be executed under
a transaction.
A Dataset
named as SystemTransactions would be created to store metadata of active transactions in the system.
Every transaction would have a timeout defined in seconds after which a transaction could get rolled back.Modifier and Type | Interface and Description |
---|---|
static interface |
TransactionController.ExecutionBuilder
This interface is used to add
DatasetReader s and DatasetWriter s participating in a transaction. |
static interface |
TransactionController.ReadOnlyExecutionBuilder
This interface is used to add
DatasetReader s and DatasetWriter s participating in a transaction and
then execute a given read only transaction on these participants. |
static interface |
TransactionController.ReadOnlyTransaction
Direct reference to a read-only transaction.
|
static interface |
TransactionController.ReadWriteExecutionBuilder
This interface is used to add
DatasetReader s and DatasetWriter s participating in a transaction and
then execute a given read write transaction on these participants. |
static interface |
TransactionController.ReadWriteTransaction
Direct reference to a read-write transaction.
|
static interface |
TransactionController.Transaction
Direct representation of a transaction to support external transaction control.
|
Modifier and Type | Field and Description |
---|---|
static java.time.Duration |
DEFAULT_TRANSACTION_TIMEOUT |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this and the underlying resources.
|
static TransactionController |
createTransactionController(com.terracottatech.store.manager.DatasetManager datasetManager)
Creates a
TransactionController object to execute transactions on the Dataset s managed by the given
DatasetManager . |
static TransactionController |
createTransactionController(com.terracottatech.store.manager.DatasetManager datasetManager,
com.terracottatech.store.configuration.DatasetConfigurationBuilder systemTransactionsDatasetConfigurationBuilder)
Creates a
TransactionController object to execute transactions on the Dataset s managed by the
given DatasetManager . |
default <T,K extends java.lang.Comparable<K>> |
execute(com.terracottatech.store.DatasetReader<K> reader,
TransactionalAction<com.terracottatech.store.DatasetReader<K>,T> action)
Execute a read-only transactional action against the given reader.
|
default <T,KA extends java.lang.Comparable<KA>,KB extends java.lang.Comparable<KB>> |
execute(com.terracottatech.store.DatasetReader<KA> readerA,
com.terracottatech.store.DatasetReader<KB> readerB,
TransactionalBiAction<com.terracottatech.store.DatasetReader<KA>,com.terracottatech.store.DatasetReader<KB>,T> action)
Execute a read-only transactional action against the given pair of readers.
|
default <T,K extends java.lang.Comparable<K>> |
execute(com.terracottatech.store.DatasetWriterReader<K> writerReader,
TransactionalAction<com.terracottatech.store.DatasetWriterReader<K>,T> action)
Execute a transactional action against the given writer-reader.
|
default <K extends java.lang.Comparable<K>> |
execute(com.terracottatech.store.DatasetWriterReader<K> writerReader,
TransactionalTask<com.terracottatech.store.DatasetWriterReader<K>> task)
Execute a transactional task against the given writer-reader.
|
default <T,KA extends java.lang.Comparable<KA>,KB extends java.lang.Comparable<KB>> |
execute(com.terracottatech.store.DatasetWriterReader<KA> writerReaderA,
com.terracottatech.store.DatasetWriterReader<KB> writerReaderB,
TransactionalBiAction<com.terracottatech.store.DatasetWriterReader<KA>,com.terracottatech.store.DatasetWriterReader<KB>,T> action)
Execute a transactional action against the given pair of writer-readers.
|
default <KA extends java.lang.Comparable<KA>,KB extends java.lang.Comparable<KB>> |
execute(com.terracottatech.store.DatasetWriterReader<KA> writerReaderA,
com.terracottatech.store.DatasetWriterReader<KB> writerReaderB,
TransactionalBiTask<com.terracottatech.store.DatasetWriterReader<KA>,com.terracottatech.store.DatasetWriterReader<KB>> task)
Execute a transactional task against the given pair of writer-readers.
|
TransactionController.ReadOnlyExecutionBuilder |
transact()
Creates a
TransactionController.ReadOnlyExecutionBuilder for a transaction having the timeout value as the default timeout. |
TransactionController |
withDefaultTimeOut(long timeOut,
java.util.concurrent.TimeUnit timeUnit)
Creates a
TransactionController object with the given default transaction timeout. |
static final java.time.Duration DEFAULT_TRANSACTION_TIMEOUT
default <T,K extends java.lang.Comparable<K>> T execute(com.terracottatech.store.DatasetReader<K> reader, TransactionalAction<com.terracottatech.store.DatasetReader<K>,T> action) throws java.lang.Exception
T
- result typeK
- dataset key typereader
- dataset reader to be acted uponaction
- transactional action to performjava.lang.Exception
- as thrown by the supplied actiondefault <T,K extends java.lang.Comparable<K>> T execute(com.terracottatech.store.DatasetWriterReader<K> writerReader, TransactionalAction<com.terracottatech.store.DatasetWriterReader<K>,T> action) throws java.lang.Exception
T
- result typeK
- dataset key typewriterReader
- dataset writer-reader to be acted uponaction
- transactional action to performjava.lang.Exception
- as thrown by the supplied actiondefault <K extends java.lang.Comparable<K>> void execute(com.terracottatech.store.DatasetWriterReader<K> writerReader, TransactionalTask<com.terracottatech.store.DatasetWriterReader<K>> task) throws java.lang.Exception
K
- dataset key typewriterReader
- dataset writer-reader to be acted upontask
- transactional task to performjava.lang.Exception
- as thrown by the supplied actiondefault <T,KA extends java.lang.Comparable<KA>,KB extends java.lang.Comparable<KB>> T execute(com.terracottatech.store.DatasetReader<KA> readerA, com.terracottatech.store.DatasetReader<KB> readerB, TransactionalBiAction<com.terracottatech.store.DatasetReader<KA>,com.terracottatech.store.DatasetReader<KB>,T> action) throws java.lang.Exception
T
- result typeKA
- first dataset key typeKB
- second dataset key typereaderA
- first dataset reader to be acted uponreaderB
- second dataset reader to be acted uponaction
- transactional action to performjava.lang.Exception
- as thrown by the supplied actiondefault <T,KA extends java.lang.Comparable<KA>,KB extends java.lang.Comparable<KB>> T execute(com.terracottatech.store.DatasetWriterReader<KA> writerReaderA, com.terracottatech.store.DatasetWriterReader<KB> writerReaderB, TransactionalBiAction<com.terracottatech.store.DatasetWriterReader<KA>,com.terracottatech.store.DatasetWriterReader<KB>,T> action) throws java.lang.Exception
T
- result typeKA
- first dataset key typeKB
- second dataset key typewriterReaderA
- first dataset writer-reader to be acted uponwriterReaderB
- second dataset writer-reader to be acted uponaction
- transactional action to performjava.lang.Exception
- as thrown by the supplied actiondefault <KA extends java.lang.Comparable<KA>,KB extends java.lang.Comparable<KB>> void execute(com.terracottatech.store.DatasetWriterReader<KA> writerReaderA, com.terracottatech.store.DatasetWriterReader<KB> writerReaderB, TransactionalBiTask<com.terracottatech.store.DatasetWriterReader<KA>,com.terracottatech.store.DatasetWriterReader<KB>> task) throws java.lang.Exception
KA
- first dataset key typeKB
- second dataset key typewriterReaderA
- first dataset writer-reader to be acted uponwriterReaderB
- second dataset writer-reader to be acted upontask
- transactional task to performjava.lang.Exception
- as thrown by the supplied actionTransactionController.ReadOnlyExecutionBuilder transact()
TransactionController.ReadOnlyExecutionBuilder
for a transaction having the timeout value as the default timeout.ReadOnlyExecutionBuilder
that is used to execute transactions.static TransactionController createTransactionController(com.terracottatech.store.manager.DatasetManager datasetManager, com.terracottatech.store.configuration.DatasetConfigurationBuilder systemTransactionsDatasetConfigurationBuilder) throws com.terracottatech.store.StoreException
TransactionController
object to execute transactions on the Dataset
s managed by the
given DatasetManager
. It also creates the SystemTransactions dataset with the given DatasetConfiguration
.
Note that if the SystemTransactions Dataset
already exists then nothing is done in that regards. The given
DatasetConfiguration
is not checked for compatibility.
datasetManager
- The instance of DatasetManager
whose Dataset
s would participate in a
transaction.systemTransactionsDatasetConfigurationBuilder
- The DatasetConfigurationBuilder
for SystemTransactions Dataset
.TransactionController
instance that could execute transactions on Dataset
s managed by the
given DatasetManager
.com.terracottatech.store.StoreException
- if it fails to create the SystemTransactions Dataset
.static TransactionController createTransactionController(com.terracottatech.store.manager.DatasetManager datasetManager) throws com.terracottatech.store.StoreException
TransactionController
object to execute transactions on the Dataset
s managed by the given
DatasetManager
.
Note that a StoreException
is thrown if the SystemTransactions Dataset
does
not already exist.
datasetManager
- The instance of DatasetManager
whose Dataset
s would participate in a
transaction.TransactionController
instance that could execute transactions on Dataset
s managed by the
given DatasetManager
.com.terracottatech.store.StoreException
- if the SystemTransactions Dataset
does not already exist.TransactionController withDefaultTimeOut(long timeOut, java.util.concurrent.TimeUnit timeUnit)
TransactionController
object with the given default transaction timeout.timeOut
- default timeout of a transactiontimeUnit
- the time unit of the time argumentTransactionController
with the given default transaction timeoutvoid close()
Note that starting or executing a new Transaction
using a closed TransactionController
instance
would result into a StoreTransactionRuntimeException
.
Similarly, any operation performed using the active transaction instances that were created using this
TransactionController
instance would result into a StoreTransactionRuntimeException
.
close
in interface java.lang.AutoCloseable