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, a subclass 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.Modifier and Type | Method and Description |
---|---|
org.rocksdb.Transaction |
BeginTransaction() |
org.rocksdb.Transaction |
BeginTransaction(java.lang.String transactionName) |
org.rocksdb.TransactionDB |
getKVStore() |
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 org.rocksdb.TransactionDB getKVStore()
public org.rocksdb.Transaction BeginTransaction(java.lang.String transactionName) throws org.rocksdb.RocksDBException
org.rocksdb.RocksDBException
public org.rocksdb.Transaction BeginTransaction()
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