Record Class TwoPhaseCommands.CoordDecide

java.lang.Object
java.lang.Record
com.loomcache.server.transaction.twopc.TwoPhaseCommands.CoordDecide
Record Components:
txId - transaction id (non-null)
decision - COMMIT or ABORT (non-null)
All Implemented Interfaces:
TwoPhaseCommands
Enclosing interface:
TwoPhaseCommands

public static record TwoPhaseCommands.CoordDecide(@NonNull UUID txId, @NonNull TwoPhaseCommands.Decision decision) extends Record implements TwoPhaseCommands
Durable coordinator DECIDE record, replicated through raft-0's own log BEFORE the coordinator fans TX_DECIDE_GROUP out to the participant groups. On new-leader startup, any pending TwoPhaseCommands.CoordPrepare with a matching TwoPhaseCommands.CoordDecide in the log replay gets re-broadcast as DECIDE_GROUP — honouring the coordinator's original decision rather than defaulting to ABORT and losing the TX.
  • Constructor Details

    • CoordDecide

      public CoordDecide(@NonNull UUID txId, @NonNull TwoPhaseCommands.Decision decision)
      Creates an instance of a CoordDecide record class.
      Parameters:
      txId - the value for the txId record component
      decision - the value for the decision record component
  • Method Details

    • serialize

      public byte @NonNull [] serialize()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • txId

      public @NonNull UUID txId()
      Returns the value of the txId record component.
      Returns:
      the value of the txId record component
    • decision

      public @NonNull TwoPhaseCommands.Decision decision()
      Returns the value of the decision record component.
      Returns:
      the value of the decision record component