Enum Class TxState

java.lang.Object
java.lang.Enum<TxState>
io.permazen.kv.raft.TxState
All Implemented Interfaces:
Serializable, Comparable<TxState>, Constable

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 Details

    • EXECUTING

      public static final TxState EXECUTING
      The transaction is open, executing locally, and neither RaftKVTransaction.commit() nor RaftKVTransaction.rollback() has been invoked yet.

      No network communication with any other node has occurred yet on behalf of the transaction.

    • COMMIT_READY

      public static final TxState COMMIT_READY
      The transaction is ready for commit.

      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.

    • COMMIT_WAITING

      public static final TxState COMMIT_WAITING
      The transaction is waiting for the corresponding Raft log entry to be committed.

      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.

    • COMPLETED

      public static final TxState COMPLETED
      The transaction has committed successfully or failed, and is waiting to be cleaned up.

      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.

    • CLOSED

      public static final TxState CLOSED
      The transaction is closed.
  • Method Details

    • values

      public static TxState[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TxState valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null