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 eachShardIdshould be allocated
public record DesiredBalance(long lastConvergedIndex, Map<ShardId,ShardAssignment> assignments, org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalance.ComputationFinishReason finishReason)
extends Record
The desired balance of the cluster, indicating which nodes should hold a copy of each shard.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDesiredBalance(long lastConvergedIndex, Map<ShardId, ShardAssignment> assignments) DesiredBalance(long lastConvergedIndex, Map<ShardId, ShardAssignment> assignments, org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalance.ComputationFinishReason finishReason) Creates an instance of aDesiredBalancerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theassignmentsrecord component.final booleanIndicates whether some other object is "equal to" this one.org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalance.ComputationFinishReasonReturns the value of thefinishReasonrecord component.getAssignment(ShardId shardId) static booleanfinal inthashCode()Returns a hash code value for this object.static StringhumanReadableDiff(DesiredBalance old, DesiredBalance updated) longReturns the value of thelastConvergedIndexrecord component.static intshardMovements(DesiredBalance old, DesiredBalance updated) final StringtoString()Returns a string representation of this record class.
-
Field Details
-
INITIAL
-
-
Constructor Details
-
DesiredBalance
-
DesiredBalance
public DesiredBalance(long lastConvergedIndex, Map<ShardId, ShardAssignment> assignments, org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalance.ComputationFinishReason finishReason) Creates an instance of aDesiredBalancerecord class.- Parameters:
lastConvergedIndex- the value for thelastConvergedIndexrecord componentassignments- the value for theassignmentsrecord componentfinishReason- the value for thefinishReasonrecord 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 thelastConvergedIndexrecord component.- Returns:
- the value of the
lastConvergedIndexrecord component
-
assignments
Returns the value of theassignmentsrecord component.- Returns:
- the value of the
assignmentsrecord component
-
finishReason
public org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalance.ComputationFinishReason finishReason()Returns the value of thefinishReasonrecord component.- Returns:
- the value of the
finishReasonrecord component
-