Record Class GenerationId

java.lang.Object
java.lang.Record
org.opends.server.replication.common.GenerationId
Record Components:
longValue - the generation id as a long value

public record GenerationId(long longValue) extends Record
The generation id used for a replication domain. It is always positive except for some very specific values like NO_GENERATION_ID or the SENTINEL_GENERATION_ID used while connecting to an RS.
See Also:
  • Field Details

    • NO_GENERATION_ID

      public static final GenerationId NO_GENERATION_ID
      To be used when the generation id is not set.
    • EMPTY_BACKEND_GENERATION_ID

      public static final GenerationId EMPTY_BACKEND_GENERATION_ID
      This is the generation id for an empty backend.

      It corresponds to a backend entry count of zero, i.e. we encode 0 in ASCII which gives 48.

    • DUMMY_GENERATION_ID

      public static final GenerationId DUMMY_GENERATION_ID
      TO be used for unit testing.
  • Constructor Details

    • GenerationId

      public GenerationId(long longValue)
      Creates an instance of a GenerationId record class.
      Parameters:
      longValue - the value for the longValue record component
  • Method Details

    • valueOf

      public static GenerationId valueOf(long generationId)
      Returns a generation id object having the provided value.
      Parameters:
      generationId - value of the generation id
      Returns:
      a generation id object made having the provided value
    • valueOf

      public static GenerationId valueOf(ByteString generationId)
      Returns a generation id object having the provided value encoded as a ByteString.
      Parameters:
      generationId - value of the generation id encoded as a ByteString
      Returns:
      a generation id object made having the provided value encoded as a ByteString
    • isNoGenerationId

      public boolean isNoGenerationId()
      Whether this is the NO_GENERATION_ID constant.
      Returns:
      whether this is the NO_GENERATION_ID constant
    • isValid

      public boolean isValid()
      Whether this generation id is valid, i.e. positive.
      Returns:
      whether this generation id is valid, i.e. positive
    • isDifferent

      public boolean isDifferent(GenerationId other)
      Whether this generation id is different to the provided one (and both are valid).
      Parameters:
      other - the generation id to compare against
      Returns:
      whether this generation id is different to the provided one (and both are valid)
    • isSame

      public boolean isSame(GenerationId other)
      Whether this generation id is the same as the provided one (and none are NO_GENERATION_ID).
      Parameters:
      other - the generation id to compare against
      Returns:
      whether this generation id is the same as the provided one (and none are NO_GENERATION_ID)
    • isEqualToOrNoGenerationId

      public boolean isEqualToOrNoGenerationId(GenerationId other)
      Whether this generation id is NO_GENERATION_ID) or equal to the provided one.
      Parameters:
      other - the generation id to compare against
      Returns:
      whether this generation id is NO_GENERATION_ID) or equal to the provided one
    • 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. All components in this record class are compared with '=='.
      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.
    • longValue

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