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-bitProtocolFeaturesmask
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 Summary
ConstructorsConstructorDescriptionHelloPayload(LoomVersion version, LoomVersion minCompatibleVersion, int protocolVersion, long featureBitmap) Creates an instance of aHelloPayloadrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic HelloPayloaddeserialize(byte[] bytes) Deserialize a payload from wire bytes.final booleanIndicates whether some other object is "equal to" this one.longReturns the value of thefeatureBitmaprecord component.static HelloPayloadforCurrentBuild(long features) Build a payload advertising this build's version + protocol + the given feature set.final inthashCode()Returns a hash code value for this object.Returns the value of theminCompatibleVersionrecord component.intReturns the value of theprotocolVersionrecord component.static byte[]serialize(HelloPayload payload) Serialize a payload to its wire bytes.final StringtoString()Returns a string representation of this record class.version()Returns the value of theversionrecord component.
-
Constructor Details
-
HelloPayload
public HelloPayload(LoomVersion version, LoomVersion minCompatibleVersion, int protocolVersion, long featureBitmap) Creates an instance of aHelloPayloadrecord class.- Parameters:
version- the value for theversionrecord componentminCompatibleVersion- the value for theminCompatibleVersionrecord componentprotocolVersion- the value for theprotocolVersionrecord componentfeatureBitmap- the value for thefeatureBitmaprecord component
-
-
Method Details
-
serialize
Serialize a payload to its wire bytes.- Parameters:
payload- the payload (non-null)- Returns:
- big-endian wire bytes
-
deserialize
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
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
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
version
-
minCompatibleVersion
Returns the value of theminCompatibleVersionrecord component.- Returns:
- the value of the
minCompatibleVersionrecord component
-
protocolVersion
public int protocolVersion()Returns the value of theprotocolVersionrecord component.- Returns:
- the value of the
protocolVersionrecord component
-
featureBitmap
public long featureBitmap()Returns the value of thefeatureBitmaprecord component.- Returns:
- the value of the
featureBitmaprecord component
-