Record Class ConsistencyGroupId

java.lang.Object
java.lang.Record
com.loomcache.server.cp.ConsistencyGroupId
Record Components:
name - the human-readable name of the group (e.g., "locks", "counters", "latches"), must not be null or empty
groupId - the unique numeric identifier for this group (typically auto-assigned), must be non-negative
All Implemented Interfaces:
Serializable

public record ConsistencyGroupId(String name, long groupId) extends Record implements Serializable
Identifies a Consistency group (Consistent/Partition-tolerant group) with a name and unique ID.

Purpose: Consistency groups are logical divisions managed by the Consistency Subsystem for Raft-based strong consistency. This record uniquely identifies each group via the combination of (name + groupId).

Thread Safety: This record is immutable and thread-safe. Multiple threads can safely share instances without synchronization.

Serialization: This record is serializable for distributed storage and network transmission.

Since:
1.0
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConsistencyGroupId(String name, long groupId)
    Compact constructor for ConsistencyGroupId with validation.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    long
    Returns the value of the groupId record component.
    final int
    Returns a hash code value for this object.
    Returns the value of the name record component.
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ConsistencyGroupId

      public ConsistencyGroupId(String name, long groupId)
      Compact constructor for ConsistencyGroupId with validation.

      Ensures the group name is not null or empty, and the group ID is non-negative.

      Parameters:
      name - the group name (must not be null or empty)
      groupId - the group ID (must be non-negative)
      Throws:
      NullPointerException - if name is null
      IllegalArgumentException - if name is empty or groupId is negative
  • Method Details

    • toString

      public 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.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • groupId

      public long groupId()
      Returns the value of the groupId record component.
      Returns:
      the value of the groupId record component