Record Class ConsensusCommand

java.lang.Object
java.lang.Record
org.j7m.middleware.api.consensus.ConsensusCommand
Record Components:
commandId - safe deterministic command id
payload - command bytes, defensively copied and redacted from string form
All Implemented Interfaces:
Serializable

public record ConsensusCommand(String commandId, byte[] payload) extends Record implements Serializable
Opaque command payload for the replicated metadata log.
See Also:
  • Constructor Details

    • ConsensusCommand

      public ConsensusCommand(String commandId, byte[] payload)
      Creates a command.
  • Method Details

    • payload

      public byte[] payload()
      Returns a defensive copy of command payload bytes.
      Returns:
      payload copy
    • toString

      public String toString()
      Specified by:
      toString in class Record
    • 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.
    • commandId

      public String commandId()
      Returns the value of the commandId record component.
      Returns:
      the value of the commandId record component