Record Class TopologyConfig
java.lang.Object
java.lang.Record
com.loomcache.server.cluster.TopologyConfig
- Record Components:
localNodeId- the local node identifierlocalRack- rack identifier for the local nodelocalZone- zone identifier for the local nodelocalRegion- region identifier for the local nodepreferLocalReads- whether to prefer local reads (default true)maxTopologyDistance- maximum topology distance to consider for routing (default 4)
-
Constructor Summary
ConstructorsConstructorDescriptionTopologyConfig(String localNodeId, String localRack, String localZone, String localRegion) Create a TopologyConfig with default values.TopologyConfig(String localNodeId, String localRack, String localZone, String localRegion, boolean preferLocalReads, int maxTopologyDistance) Creates an instance of aTopologyConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Get the local topology info for this config.final inthashCode()Returns a hash code value for this object.Returns the value of thelocalNodeIdrecord component.Returns the value of thelocalRackrecord component.Returns the value of thelocalRegionrecord component.Returns the value of thelocalZonerecord component.intReturns the value of themaxTopologyDistancerecord component.booleanReturns the value of thepreferLocalReadsrecord component.final StringtoString()Returns a string representation of this record class.withMaxTopologyDistance(int maxTopologyDistance) Create a new TopologyConfig with different max topology distance.withPreferLocalReads(boolean preferLocalReads) Create a new TopologyConfig with different routing preferences.
-
Constructor Details
-
TopologyConfig
-
TopologyConfig
public TopologyConfig(String localNodeId, String localRack, String localZone, String localRegion, boolean preferLocalReads, int maxTopologyDistance) Creates an instance of aTopologyConfigrecord class.- Parameters:
localNodeId- the value for thelocalNodeIdrecord componentlocalRack- the value for thelocalRackrecord componentlocalZone- the value for thelocalZonerecord componentlocalRegion- the value for thelocalRegionrecord componentpreferLocalReads- the value for thepreferLocalReadsrecord componentmaxTopologyDistance- the value for themaxTopologyDistancerecord component
-
-
Method Details
-
getLocalTopology
Get the local topology info for this config.- Returns:
- TopologyInfo for the local node
-
withPreferLocalReads
Create a new TopologyConfig with different routing preferences.- Parameters:
preferLocalReads- new preference for local reads- Returns:
- new TopologyConfig with updated preference
-
withMaxTopologyDistance
Create a new TopologyConfig with different max topology distance.- Parameters:
maxTopologyDistance- new max distance- Returns:
- new TopologyConfig with updated max distance
-
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. -
localNodeId
Returns the value of thelocalNodeIdrecord component.- Returns:
- the value of the
localNodeIdrecord component
-
localRack
-
localZone
-
localRegion
Returns the value of thelocalRegionrecord component.- Returns:
- the value of the
localRegionrecord component
-
preferLocalReads
public boolean preferLocalReads()Returns the value of thepreferLocalReadsrecord component.- Returns:
- the value of the
preferLocalReadsrecord component
-
maxTopologyDistance
public int maxTopologyDistance()Returns the value of themaxTopologyDistancerecord component.- Returns:
- the value of the
maxTopologyDistancerecord component
-