Record Class Registration
java.lang.Object
java.lang.Record
io.krabka.streams.coordination.Registration
- Record Components:
member- the member that registeredregisteredAt- the time the member registered, in milliseconds since the Unix epoch
- All Implemented Interfaces:
CoordinationValue
public record Registration(MemberId member, long registeredAt)
extends Record
implements CoordinationValue
One member of a role announces that it is available.
A member writes a registration when it joins, and it writes a tombstone on the same key when it leaves. The record carries no authority. A candidate holds no epoch when it announces itself, and it must take no epoch to do so, so the append sits outside a transaction.
The offset that the broker assigns to the record is the join sequence of the
member. Log compaction keeps the offset of every record it retains, so the succession
rules rank candidates on that offset. See RoleState.
Example
Registration joined = new Registration(MemberId.of("node-1"), clock.nowMillis());
byte[] value = CoordinationCodec.encodeValue(joined);
-
Constructor Summary
Constructors -
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.kind()Returns the kind of the key that a registration sits under.member()Returns the value of thememberrecord component.longReturns the value of theregisteredAtrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Registration
Rejects a null member.- Parameters:
member- the member that registeredregisteredAt- the time the member registered, in milliseconds since the Unix epoch
-
-
Method Details
-
kind
Returns the kind of the key that a registration sits under.- Specified by:
kindin interfaceCoordinationValue- Returns:
RecordKind.REGISTRATION
-
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. -
member
Returns the value of thememberrecord component.- Specified by:
memberin interfaceCoordinationValue- Returns:
- the value of the
memberrecord component
-
registeredAt
public long registeredAt()Returns the value of theregisteredAtrecord component.- Returns:
- the value of the
registeredAtrecord component
-