public class TransactionStore extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
TransactionStore.Change
A change in a map.
|
static interface |
TransactionStore.RollbackListener
This listener can be registered with the transaction to be notified of
every compensating change during transaction rollback.
|
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
UNDO_LOG_NAME_PREFIX
The prefix for undo log entries.
|
| 构造器和说明 |
|---|
TransactionStore(MVStore store)
Create a new transaction store.
|
TransactionStore(MVStore store,
DataType<?> dataType) |
TransactionStore(MVStore store,
MetaType<?> metaDataType,
DataType<?> dataType,
int timeoutMillis)
Create a new transaction store.
|
| 限定符和类型 | 方法和说明 |
|---|---|
Transaction |
begin()
Begin a new transaction.
|
Transaction |
begin(TransactionStore.RollbackListener listener,
int timeoutMillis,
int ownerId,
IsolationLevel isolationLevel)
Begin a new transaction.
|
void |
close()
Close the transaction store.
|
void |
endLeftoverTransactions()
Commit all transactions that are in the committed state, and
rollback all open transactions.
|
List<Transaction> |
getOpenTransactions()
Get the list of unclosed transactions that have pending writes.
|
boolean |
hasMap(String name)
Check whether a given map exists.
|
void |
init()
Initialize the store without any RollbackListener.
|
void |
init(TransactionStore.RollbackListener listener)
Initialize the store.
|
<K,V> MVMap<K,V> |
openMap(String name,
DataType<K> keyType,
DataType<V> valueType)
Open the map with the given name.
|
void |
setMaxTransactionId(int max)
Set the maximum transaction id, after which ids are re-used.
|
public TransactionStore(MVStore store)
store - the storepublic TransactionStore(MVStore store, MetaType<?> metaDataType, DataType<?> dataType, int timeoutMillis)
store - the storemetaDataType - the data type for type registry map valuesdataType - default data type for map keys and valuestimeoutMillis - lock acquisition timeout in milliseconds, 0 means no waitpublic void init()
init(RollbackListener)public void init(TransactionStore.RollbackListener listener)
listener - to notify about transaction rollbackpublic void endLeftoverTransactions()
public void setMaxTransactionId(int max)
max - the maximum idpublic boolean hasMap(String name)
name - the map namepublic List<Transaction> getOpenTransactions()
public void close()
public Transaction begin()
public Transaction begin(TransactionStore.RollbackListener listener, int timeoutMillis, int ownerId, IsolationLevel isolationLevel)
listener - to be notified in case of a rollbacktimeoutMillis - to wait for a blocking transactionownerId - of the owner (Session?) to be reported by getBlockerIdisolationLevel - of new transactionCopyright © 2022. All rights reserved.