Record Class MemberState
java.lang.Object
java.lang.Record
io.camunda.zeebe.dynamic.config.state.MemberState
- Record Components:
version- version of the state.state- current state of the memberpartitions- state of all partitions that the member is replicating
public record MemberState(long version, Instant lastUpdated, MemberState.State state, Map<Integer,PartitionState> partitions)
extends Record
Represents the state of a member in the cluster.
Version is incremented every time the state is updated. This is used to resolve conflicts when the members receive gossip updates out of order. Only a member can update its own state. This prevents any conflicting concurrent updates.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionMemberState(long version, Instant lastUpdated, MemberState.State state, Map<Integer, PartitionState> partitions) Creates an instance of aMemberStaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionaddPartition(int partitionId, PartitionState partitionState) final booleanIndicates whether some other object is "equal to" this one.getPartition(int partitionId) final inthashCode()Returns a hash code value for this object.booleanhasPartition(int partitionId) static MemberStateinitializeAsActive(Map<Integer, PartitionState> initialPartitions) Returns the value of thelastUpdatedrecord component.Returns the value of thepartitionsrecord component.removePartition(int partitionId) state()Returns the value of thestaterecord component.toActive()toLeft()final StringtoString()Returns a string representation of this record class.static MemberStateupdatePartition(int partitionId, UnaryOperator<PartitionState> partitionStateUpdater) longversion()Returns the value of theversionrecord component.
-
Constructor Details
-
MemberState
public MemberState(long version, Instant lastUpdated, MemberState.State state, Map<Integer, PartitionState> partitions) Creates an instance of aMemberStaterecord class.- Parameters:
version- the value for theversionrecord componentlastUpdated- the value for thelastUpdatedrecord componentstate- the value for thestaterecord componentpartitions- the value for thepartitionsrecord component
-
-
Method Details
-
initializeAsActive
-
uninitialized
-
toJoining
-
toActive
-
toLeaving
-
toLeft
-
addPartition
-
updatePartition
public MemberState updatePartition(int partitionId, UnaryOperator<PartitionState> partitionStateUpdater) -
removePartition
-
hasPartition
public boolean hasPartition(int partitionId) -
getPartition
-
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 '=='. -
version
public long version()Returns the value of theversionrecord component.- Returns:
- the value of the
versionrecord component
-
lastUpdated
Returns the value of thelastUpdatedrecord component.- Returns:
- the value of the
lastUpdatedrecord component
-
state
Returns the value of thestaterecord component.- Returns:
- the value of the
staterecord component
-
partitions
Returns the value of thepartitionsrecord component.- Returns:
- the value of the
partitionsrecord component
-