Record Class ChangelogState

java.lang.Object
java.lang.Record
org.opends.server.replication.server.ChangelogState
Record Components:
domainToGenerationId - Maps domains base DNs to their generation IDs
replicas - All the replicas which have a dedicated replica DB.

The returned value is an unmodifiable set of replicas. If the set of replicas known to this RS does not change, then the returned set is always the same. This ensures equality tests on the set return true very quickly in case nothing changed. The change number indexer uses this trick to avoid spending too much comparing sets of DomainReplicaIds that rarely change.

purgedReplicasNotProperlyStopped - The replicas whose changelog has been purged and did not send a ReplicaOfflineMsg when they stopped.

@Immutable public record ChangelogState(Map<Dn,GenerationId> domainToGenerationId, Set<DomainReplicaId> replicas, Set<DomainReplicaId> purgedReplicasNotProperlyStopped) extends Record
This is the changelog state stored in the changelogStateDB. For each replication domain, it contains:
  • its generationId
  • the list of replicaIds composing it

This class is used during replication initialization to decouple the code that reads the changelogStateDB from the code that makes use of its data.

  • Constructor Details

  • Method Details

    • setDomainGenerationId

      public ChangelogState setDomainGenerationId(Dn baseDn, GenerationId generationId)
      Returns a new changelog state with the generationId associated to the supplied replication domain.
      Parameters:
      baseDn - the targeted replication domain baseDN
      generationId - the generation Id to set
      Returns:
      a new changelog state
    • removeDomain

      public ChangelogState removeDomain(Dn baseDn)
      Returns a new changelog state where supplied replication domain has been removed.
      Parameters:
      baseDn - the replication domain base DN to remove
      Returns:
      a new changelog state
    • addReplica

      public ChangelogState addReplica(DomainReplicaId replica)
      Returns a changelog state with the specified replica added if it is not already present.
      Parameters:
      replica - the replica to add
      Returns:
      a changelog state
    • removeReplica

      public ChangelogState removeReplica(DomainReplicaId replica)
      Returns a changelog state with the specified replica removed if it was present.
      Parameters:
      replica - the replica to remove
      Returns:
      a new changelog state
    • 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 Objects::equals(Object,Object).
      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.
    • domainToGenerationId

      public Map<Dn,GenerationId> domainToGenerationId()
      Returns the value of the domainToGenerationId record component.
      Returns:
      the value of the domainToGenerationId record component
    • replicas

      public Set<DomainReplicaId> replicas()
      Returns the value of the replicas record component.
      Returns:
      the value of the replicas record component
    • purgedReplicasNotProperlyStopped

      public Set<DomainReplicaId> purgedReplicasNotProperlyStopped()
      Returns the value of the purgedReplicasNotProperlyStopped record component.
      Returns:
      the value of the purgedReplicasNotProperlyStopped record component