Record Class CoordinationEntry

java.lang.Object
java.lang.Record
io.krabka.streams.coordination.CoordinationEntry
Record Components:
offset - the offset of the record in the partition of its role
key - the decoded record key
value - the decoded record value, and empty for a tombstone

public record CoordinationEntry(long offset, CoordinationKey key, Optional<CoordinationValue> value) extends Record
One decoded record of CoordinationCodec.TOPIC, with the offset it sits at.

CoordinationTransport.readRoleRecords(Role) returns these in offset order, and RoleStateBuilder folds them. The offset is the join sequence of a registration, because log compaction keeps the offset of every record it retains. The succession rules rank candidates on that offset.

The value is empty for a tombstone. A tombstone of a registration key deregisters one member, and a tombstone of a lease key clears the lease of one role.

Example

for (CoordinationEntry entry : transport.readRoleRecords(role)) {
    builder.apply(entry);
}
RoleState state = builder.build();
  • Constructor Details

    • CoordinationEntry

      public CoordinationEntry(long offset, CoordinationKey key, Optional<CoordinationValue> value)
      Rejects a null key and a null value holder.
      Parameters:
      offset - the offset of the record in the partition of its role
      key - the decoded record key
      value - the decoded record value, and empty for a tombstone
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • offset

      public long offset()
      Returns the value of the offset record component.
      Returns:
      the value of the offset record component
    • key

      public CoordinationKey key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • value

      public Optional<CoordinationValue> value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component