java.lang.Object
java.lang.Record
org.elasticsearch.cluster.coordination.Join
- Record Components:
votingNode- The node casting a vote for a master candidate.masterCandidateNode- The master candidate node receiving the vote for election.term-lastAcceptedTerm-lastAcceptedVersion-
- All Implemented Interfaces:
Writeable
public record Join(DiscoveryNode votingNode, DiscoveryNode masterCandidateNode, long term, long lastAcceptedTerm, long lastAcceptedVersion)
extends Record
implements Writeable
Triggered by a
StartJoinRequest, instances of this class represent join votes,
and have a voting and master-candidate node. The voting node is the node that provides
the vote, and the master-candidate node is the node for which this vote is cast. A join
vote is cast to reform the cluster around a particular master-eligible node, to elect
that node as the new master in a new term.
A voting node will only cast a single vote per term. The vote includes information about
the current state of the node casting the vote, so that the candidate for the vote can
determine whether it has a more up-to-date state than the voting node.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Constructor Summary
ConstructorsConstructorDescriptionJoin(DiscoveryNode votingNode, DiscoveryNode masterCandidateNode, long term, long lastAcceptedTerm, long lastAcceptedVersion) Creates an instance of aJoinrecord class.Join(StreamInput in) -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longReturns the value of thelastAcceptedTermrecord component.longReturns the value of thelastAcceptedVersionrecord component.booleanmasterCandidateMatches(DiscoveryNode matchingNode) Returns the value of themasterCandidateNoderecord component.longterm()Returns the value of thetermrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thevotingNoderecord component.voidwriteTo(StreamOutput out) Write this into the StreamOutput.
-
Constructor Details
-
Join
public Join(DiscoveryNode votingNode, DiscoveryNode masterCandidateNode, long term, long lastAcceptedTerm, long lastAcceptedVersion) Creates an instance of aJoinrecord class.- Parameters:
votingNode- the value for thevotingNoderecord componentmasterCandidateNode- the value for themasterCandidateNoderecord componentterm- the value for thetermrecord componentlastAcceptedTerm- the value for thelastAcceptedTermrecord componentlastAcceptedVersion- the value for thelastAcceptedVersionrecord component
-
Join
- Throws:
IOException
-
-
Method Details
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
masterCandidateMatches
-
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 '=='. -
votingNode
Returns the value of thevotingNoderecord component.- Returns:
- the value of the
votingNoderecord component
-
masterCandidateNode
Returns the value of themasterCandidateNoderecord component.- Returns:
- the value of the
masterCandidateNoderecord component
-
term
public long term()Returns the value of thetermrecord component.- Returns:
- the value of the
termrecord component
-
lastAcceptedTerm
public long lastAcceptedTerm()Returns the value of thelastAcceptedTermrecord component.- Returns:
- the value of the
lastAcceptedTermrecord component
-
lastAcceptedVersion
public long lastAcceptedVersion()Returns the value of thelastAcceptedVersionrecord component.- Returns:
- the value of the
lastAcceptedVersionrecord component
-