Record Class HelloPayload

java.lang.Object
java.lang.Record
com.loomcache.common.protocol.HelloPayload
Record Components:
version - sender's semantic version (non-null)
minCompatibleVersion - the oldest peer version the sender will accept (non-null)
protocolVersion - wire protocol version (must be > 0)
featureBitmap - 64-bit ProtocolFeatures mask

public record HelloPayload(LoomVersion version, LoomVersion minCompatibleVersion, int protocolVersion, long featureBitmap) extends Record
Wire payload for the PROTOCOL_HELLO / PROTOCOL_HELLO_ACK handshake opcodes. Carries the sender's LoomVersion, the peer's advertised minimum-compatible version (so both directions of the compatibility check can run synchronously on one round trip), the wire protocol version, and a ProtocolFeatures bitmap.

BLK-2026-04-22-007 Day 1. This is the foundation for the handshake wired in Day 2+; the TcpServer / ConnectionManager integration lives in follow-up commits so this change is wire-compatibility-neutral on its own (existing connections ignore the new opcodes until both sides opt in).

Wire format (variable length, driven by DataOutput.writeUTF(String) for the two version strings):

  UTF  version              e.g. "1.0.0"
  UTF  minCompatibleVersion e.g. "1.0.0"
  int  protocolVersion      current is 2
  long featureBitmap        ProtocolFeatures wire bitmap
  • Constructor Details

    • HelloPayload

      public HelloPayload(LoomVersion version, LoomVersion minCompatibleVersion, int protocolVersion, long featureBitmap)
      Creates an instance of a HelloPayload record class.
      Parameters:
      version - the value for the version record component
      minCompatibleVersion - the value for the minCompatibleVersion record component
      protocolVersion - the value for the protocolVersion record component
      featureBitmap - the value for the featureBitmap record component
  • Method Details

    • serialize

      public static byte[] serialize(HelloPayload payload)
      Serialize a payload to its wire bytes.
      Parameters:
      payload - the payload (non-null)
      Returns:
      big-endian wire bytes
    • deserialize

      public static HelloPayload deserialize(byte[] bytes)
      Deserialize a payload from wire bytes.
      Parameters:
      bytes - the wire bytes (non-null)
      Returns:
      the parsed payload
      Throws:
      IllegalArgumentException - if the bytes are truncated or carry invalid fields
    • forCurrentBuild

      public static HelloPayload forCurrentBuild(long features)
      Build a payload advertising this build's version + protocol + the given feature set.
      Parameters:
      features - the features this build will announce (non-null, may be empty)
      Returns:
      a payload ready to 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • version

      public LoomVersion version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • minCompatibleVersion

      public LoomVersion minCompatibleVersion()
      Returns the value of the minCompatibleVersion record component.
      Returns:
      the value of the minCompatibleVersion record component
    • protocolVersion

      public int protocolVersion()
      Returns the value of the protocolVersion record component.
      Returns:
      the value of the protocolVersion record component
    • featureBitmap

      public long featureBitmap()
      Returns the value of the featureBitmap record component.
      Returns:
      the value of the featureBitmap record component