Record Class Server
java.lang.Object
java.lang.Record
com.iohao.net.framework.protocol.Server
- Record Components:
id- unique server identifiername- human-readable server nametag- grouping tag (defaults to name)serverType- the type of this server (e.g., LOGIC, EXTERNAL)netId- network-level identifierip- the IP address of this serverpubName- the publication name used for Aeron channelscmdMerges- array of merged command route keys this server handlespayloadMap- extensible key-value payload storagebarSkeleton- 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
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionServer(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 aServerrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPayload(String name, byte[] data) Store a payload entry by name.Returns the value of thebarSkeletonrecord component.int[]Returns the value of thecmdMergesrecord component.booleanIndicates whether some other object is "equal to" this one.byte[]getPayload(String name) Retrieve a payload entry by name.inthashCode()Returns a hash code value for this object.intid()Returns the value of theidrecord component.ip()Returns the value of theiprecord component.name()Returns the value of thenamerecord component.intnetId()Returns the value of thenetIdrecord component.Returns the value of thepayloadMaprecord component.pubName()Returns the value of thepubNamerecord component.static Server.InternalBuilderReturns the value of theserverTyperecord component.tag()Returns the value of thetagrecord component.@NonNull StringtoString()Returns a string representation of this record class.
-
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 aServerrecord class.- Parameters:
id- the value for theidrecord componentname- the value for thenamerecord componenttag- the value for thetagrecord componentserverType- the value for theserverTyperecord componentnetId- the value for thenetIdrecord componentip- the value for theiprecord componentpubName- the value for thepubNamerecord componentcmdMerges- the value for thecmdMergesrecord componentpayloadMap- the value for thepayloadMaprecord componentbarSkeleton- the value for thebarSkeletonrecord component
-
-
Method Details
-
getPayload
Retrieve a payload entry by name.- Parameters:
name- the payload key- Returns:
- the payload byte array, or
nullif not present
-
addPayload
Store a payload entry by name.- Parameters:
name- the payload keydata- the payload byte array
-
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. -
hashCode
-
toString
-
recordBuilder
-
id
-
name
-
tag
-
serverType
Returns the value of theserverTyperecord component.- Returns:
- the value of the
serverTyperecord component
-
netId
-
ip
-
pubName
-
cmdMerges
-
payloadMap
Returns the value of thepayloadMaprecord component.- Returns:
- the value of the
payloadMaprecord component
-
barSkeleton
Returns the value of thebarSkeletonrecord component.- Returns:
- the value of the
barSkeletonrecord component
-