public enum TxState extends Enum<TxState>
RaftKVTransaction
states.
Transactions always progress through these states in the forward direction (i.e., in their natural order).
Enum Constant and Description |
---|
CLOSED
The transaction is closed.
|
COMMIT_READY
The transaction is ready for commit.
|
COMMIT_WAITING
The transaction is waiting for the corresponding Raft log entry to be committed.
|
COMPLETED
The transaction has committed successfully or failed, and is waiting to be cleaned up.
|
EXECUTING
The transaction is open, executing locally, and neither
RaftKVTransaction.commit()
nor RaftKVTransaction.rollback() has been invoked yet. |
Modifier and Type | Method and Description |
---|---|
static TxState |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static TxState[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final TxState EXECUTING
RaftKVTransaction.commit()
nor RaftKVTransaction.rollback()
has been invoked yet.
No network communication with any other node has occurred yet on behalf of the transaction.
public static final TxState COMMIT_READY
RaftKVTransaction.commit()
has been invoked, but the transaction has not otherwise been dealt with yet.
If we are a follower, it will be transmitted to the leader once the leader is known and his output queue becomes empty;
while we are waiting for the response from the leader, the transaction remains in this state.
If we are the leader, it will be dealt with locally as soon as we can get to it.
public static final TxState COMMIT_WAITING
The transaction has been assigned a commit term and index by the leader. We are waiting for the corresponding Raft log entry to be committed to the Raft log.
public static final TxState COMPLETED
The thread that invoked RaftKVTransaction.commit()
or RaftKVTransaction.rollback()
has not yet
woken up and returned from the invocation. The transaction's commitFuture
has been completed one way
or another.
public static final TxState CLOSED
public static TxState[] values()
for (TxState c : TxState.values()) System.out.println(c);
public static TxState valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullCopyright © 2019. All rights reserved.