Package edu.caltech.nanodb.transactions
Class TransactionState
- java.lang.Object
-
- edu.caltech.nanodb.transactions.TransactionState
-
public class TransactionState extends java.lang.Object
This class manages the transaction state associated with every client session. The transaction state for the current session can be retrieved like this:
TransactionState txnState = SessionState.get().getTransactionState()
The transaction state should generally not be managed directly! Rather, the operations provided by the
TransactionManager
should be used.
-
-
Field Summary
Fields Modifier and Type Field Description private LogSequenceNumber
lastLSN
private boolean
loggedTxnStart
This value indicates whether the current transaction has been logged to the write-ahead log yet.static int
NO_TRANSACTION
private boolean
performedWrites
private int
transactionID
private boolean
userStartedTxn
-
Constructor Summary
Constructors Constructor Description TransactionState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
LogSequenceNumber
getLastLSN()
int
getTransactionID()
boolean
getUserStartedTxn()
boolean
hasLoggedTxnStart()
boolean
hasPerformedWrites()
boolean
isTxnInProgress()
void
setLastLSN(LogSequenceNumber lsn)
void
setLoggedTxnStart(boolean b)
void
setPerformedWrites(boolean b)
void
setTransactionID(int transactionID)
void
setUserStartedTxn(boolean b)
java.lang.String
toString()
-
-
-
Field Detail
-
NO_TRANSACTION
public static final int NO_TRANSACTION
- See Also:
- Constant Field Values
-
transactionID
private int transactionID
-
userStartedTxn
private boolean userStartedTxn
-
performedWrites
private boolean performedWrites
-
loggedTxnStart
private boolean loggedTxnStart
This value indicates whether the current transaction has been logged to the write-ahead log yet. We don't write the "Ti: start" record until the transaction performs its first write operation.
-
lastLSN
private LogSequenceNumber lastLSN
-
-
Method Detail
-
getTransactionID
public int getTransactionID()
-
setTransactionID
public void setTransactionID(int transactionID)
-
getUserStartedTxn
public boolean getUserStartedTxn()
-
setUserStartedTxn
public void setUserStartedTxn(boolean b)
-
hasPerformedWrites
public boolean hasPerformedWrites()
-
setPerformedWrites
public void setPerformedWrites(boolean b)
-
hasLoggedTxnStart
public boolean hasLoggedTxnStart()
-
setLoggedTxnStart
public void setLoggedTxnStart(boolean b)
-
getLastLSN
public LogSequenceNumber getLastLSN()
-
setLastLSN
public void setLastLSN(LogSequenceNumber lsn)
-
clear
public void clear()
-
isTxnInProgress
public boolean isTxnInProgress()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-