Module org.elasticsearch.server
Record Class DesiredBalance
java.lang.Object
java.lang.Record
org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalance
- Record Components:
assignments
- a set of the (persistent) node IDs to which eachShardId
should be allocated
public record DesiredBalance(long lastConvergedIndex, Map<ShardId,ShardAssignment> assignments)
extends Record
The desired balance of the cluster, indicating which nodes should hold a copy of each shard.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDesiredBalance
(long lastConvergedIndex, Map<ShardId, ShardAssignment> assignments) Creates an instance of aDesiredBalance
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theassignments
record component.final boolean
Indicates whether some other object is "equal to" this one.getAssignment
(ShardId shardId) static boolean
final int
hashCode()
Returns a hash code value for this object.static String
humanReadableDiff
(DesiredBalance old, DesiredBalance updated) long
Returns the value of thelastConvergedIndex
record component.static int
shardMovements
(DesiredBalance old, DesiredBalance updated) final String
toString()
Returns a string representation of this record class.
-
Field Details
-
INITIAL
-
-
Constructor Details
-
DesiredBalance
Creates an instance of aDesiredBalance
record class.- Parameters:
lastConvergedIndex
- the value for thelastConvergedIndex
record componentassignments
- the value for theassignments
record component
-
-
Method Details
-
getAssignment
-
hasChanges
-
shardMovements
-
humanReadableDiff
-
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. -
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. -
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 '=='. -
lastConvergedIndex
public long lastConvergedIndex()Returns the value of thelastConvergedIndex
record component.- Returns:
- the value of the
lastConvergedIndex
record component
-
assignments
Returns the value of theassignments
record component.- Returns:
- the value of the
assignments
record component
-