public class TransactionSession extends Session
Session
class to include transaction semantics. In RocksDb a TransactionDB
instance contains the transaction classes and methods to provide atomicity.
Transactions are linked to a TransactionDb, or OptimisticTransactionDb, both subclasses of RocksDB. Each transaction may be named,
and the name must be unique. To enforce uniqueness considering these constraints, the name
formed will be a concatenation of Transaction Id, which is a UUID, the class name, which is also
a column family or the default column family, and the Alias, or none, which is the default database path.
From the TransactionManager
we link the transaction Id's to an instance of this and associated transaction.
Constructor and Description |
---|
TransactionSession(org.rocksdb.OptimisticTransactionDB kvStore,
org.rocksdb.Options options,
java.util.ArrayList<org.rocksdb.ColumnFamilyDescriptor> columnFamilyDescriptor,
java.util.List<org.rocksdb.ColumnFamilyHandle> columnFamilyHandles) |
Modifier and Type | Method and Description |
---|---|
org.rocksdb.Transaction |
BeginTransaction()
Initiate a transaction.
|
org.rocksdb.Transaction |
BeginTransaction(long timeout) |
java.util.List<org.rocksdb.Transaction> |
getAllPreparedTransactions()
Get all prepared transactions
|
java.util.Map<java.lang.Long,org.rocksdb.TransactionDB.KeyLockInfo> |
getLockStatusData()
Get the map of lock status from TransactionDb
|
org.rocksdb.Transaction |
getTransaction(TransactionId transactionId,
java.lang.String clazz,
boolean create)
Get the Transaction object formed from id and class.
|
boolean |
isTransactionLinked(TransactionId xid,
TransactionalMap tm,
java.util.concurrent.ConcurrentHashMap<java.lang.String,com.neocoretechs.rocksack.session.TransactionManager.SessionAndTransaction> tLink)
Check the mangled name identifier of transaction id, classname, and optionally the alias,
to identify this entry in the mapping of mangled name to SessionAndTransaction
instances from the passed map.
|
boolean |
linkSessionAndTransaction(TransactionId xid,
TransactionalMap tm,
java.util.concurrent.ConcurrentHashMap<java.lang.String,com.neocoretechs.rocksack.session.TransactionManager.SessionAndTransaction> tLink)
Generate a mangled name identifier of transaction id, classname, and optionally the alias,
to identify this entry in the mapping of mangled name to SessionAndTransaction
instances.
|
java.lang.String |
toString() |
public TransactionSession(org.rocksdb.OptimisticTransactionDB kvStore, org.rocksdb.Options options, java.util.ArrayList<org.rocksdb.ColumnFamilyDescriptor> columnFamilyDescriptor, java.util.List<org.rocksdb.ColumnFamilyHandle> columnFamilyHandles)
public org.rocksdb.Transaction BeginTransaction()
public org.rocksdb.Transaction BeginTransaction(long timeout)
public org.rocksdb.Transaction getTransaction(TransactionId transactionId, java.lang.String clazz, boolean create)
transactionId
- clazz
- create
- true to create if not existingpublic boolean linkSessionAndTransaction(TransactionId xid, TransactionalMap tm, java.util.concurrent.ConcurrentHashMap<java.lang.String,com.neocoretechs.rocksack.session.TransactionManager.SessionAndTransaction> tLink) throws java.io.IOException
xid
- the TransactionIdtm
- the TransactionalMap we want to use for classname and sesssiontLink
- The map entry from TransactionManager idToNameToSessionAndTransaction from key xidjava.io.IOException
public boolean isTransactionLinked(TransactionId xid, TransactionalMap tm, java.util.concurrent.ConcurrentHashMap<java.lang.String,com.neocoretechs.rocksack.session.TransactionManager.SessionAndTransaction> tLink) throws java.io.IOException
xid
- the TransactionIdtm
- the TransactionalMap we want to use for classname and sesssiontLink
- The map entry from TransactionManager idToNameToSessionAndTransaction from key xidjava.io.IOException
public java.util.Map<java.lang.Long,org.rocksdb.TransactionDB.KeyLockInfo> getLockStatusData()
public java.util.List<org.rocksdb.Transaction> getAllPreparedTransactions()