Record Class Server

java.lang.Object
java.lang.Record
com.iohao.net.framework.protocol.Server
Record Components:
id - unique server identifier
name - human-readable server name
tag - grouping tag (defaults to name)
serverType - the type of this server (e.g., LOGIC, EXTERNAL)
netId - network-level identifier
ip - the IP address of this server
pubName - the publication name used for Aeron channels
cmdMerges - array of merged command route keys this server handles
payloadMap - extensible key-value payload storage
barSkeleton - the execution engine associated with this server

public record Server(int id, String name, String tag, ServerTypeEnum serverType, int netId, String ip, String pubName, int[] cmdMerges, Map<String,byte[]> payloadMap, BarSkeleton barSkeleton) extends Record
Immutable record representing a registered server instance in the ionet cluster.

Holds the server's identity (id, name, tag), network coordinates (ip, netId, pubName), the set of command routes it handles (cmdMerges), an extensible payload map, and a reference to its BarSkeleton execution engine. Equality and hashing are based solely on the server id.

Since:
25.1
Author:
渔民小镇
date:
2025-09-08
  • Constructor Details

    • Server

      public Server(int id, String name, String tag, ServerTypeEnum serverType, int netId, String ip, String pubName, int[] cmdMerges, Map<String,byte[]> payloadMap, BarSkeleton barSkeleton)
      Creates an instance of a Server record class.
      Parameters:
      id - the value for the id record component
      name - the value for the name record component
      tag - the value for the tag record component
      serverType - the value for the serverType record component
      netId - the value for the netId record component
      ip - the value for the ip record component
      pubName - the value for the pubName record component
      cmdMerges - the value for the cmdMerges record component
      payloadMap - the value for the payloadMap record component
      barSkeleton - the value for the barSkeleton record component
  • Method Details

    • getPayload

      public byte[] getPayload(String name)
      Retrieve a payload entry by name.
      Parameters:
      name - the payload key
      Returns:
      the payload byte array, or null if not present
    • addPayload

      public void addPayload(String name, byte[] data)
      Store a payload entry by name.
      Parameters:
      name - the payload key
      data - the payload byte array
    • equals

      public boolean equals(Object object)
      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:
      object - the object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise.
    • hashCode

      public 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
    • toString

      public @NonNull 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
    • recordBuilder

      public static Server.InternalBuilder recordBuilder()
    • id

      public int id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • tag

      public String tag()
      Returns the value of the tag record component.
      Returns:
      the value of the tag record component
    • serverType

      public ServerTypeEnum serverType()
      Returns the value of the serverType record component.
      Returns:
      the value of the serverType record component
    • netId

      public int netId()
      Returns the value of the netId record component.
      Returns:
      the value of the netId record component
    • ip

      public String ip()
      Returns the value of the ip record component.
      Returns:
      the value of the ip record component
    • pubName

      public String pubName()
      Returns the value of the pubName record component.
      Returns:
      the value of the pubName record component
    • cmdMerges

      public int[] cmdMerges()
      Returns the value of the cmdMerges record component.
      Returns:
      the value of the cmdMerges record component
    • payloadMap

      public Map<String,byte[]> payloadMap()
      Returns the value of the payloadMap record component.
      Returns:
      the value of the payloadMap record component
    • barSkeleton

      public BarSkeleton barSkeleton()
      Returns the value of the barSkeleton record component.
      Returns:
      the value of the barSkeleton record component