Class MultiDomainServerState

java.lang.Object
org.opends.server.replication.common.MultiDomainServerState
All Implemented Interfaces:
Iterable<Dn>

public final class MultiDomainServerState extends Object implements Iterable<Dn>
This object is used to store a list of ServerState object, one by replication domain. Globally, it is the generalization of ServerState (that applies to one domain) to a list of domains.

MultiDomainServerState is also known as "cookie" and is used with the cookie-based changelog.

  • Constructor Details

    • MultiDomainServerState

      public MultiDomainServerState()
      Creates a new empty object.
    • MultiDomainServerState

      public MultiDomainServerState(MultiDomainServerState cookie)
      Copy constructor.
      Parameters:
      cookie - the cookie to copy
    • MultiDomainServerState

      public MultiDomainServerState(String cookie) throws LdapException
      Create an object from a string representation.
      Parameters:
      cookie - The provided string representation of the state.
      Throws:
      LdapException - when the string has an invalid format
  • Method Details

    • update

      public boolean update(Dn baseDN, CSN csn)
      Update the ServerState of the provided baseDN with the replication CSN provided.
      Parameters:
      baseDN - The provided baseDN.
      csn - The provided CSN.
      Returns:
      a boolean indicating if the update was meaningful.
    • update

      public void update(Dn baseDN, ServerState serverState)
      Update the ServerState of the provided baseDN with the provided server state.
      Parameters:
      baseDN - The provided baseDN.
      serverState - The provided serverState.
    • replace

      public void replace(Dn baseDN, ServerState serverState)
      Replace the ServerState of the provided baseDN with the provided server state. The provided server state will be owned by this instance, so care must be taken by calling code to duplicate it if needed.
      Parameters:
      baseDN - The provided baseDN.
      serverState - The provided serverState.
    • getSnapshot

      public Map<Dn,Set<CSN>> getSnapshot()
      Returns a snapshot of this object.
      Returns:
      an unmodifiable Map representing a snapshot of this object.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isEmpty

      public boolean isEmpty()
      Tests if the state is empty.
      Returns:
      True if the state is empty.
    • iterator

      public Iterator<Dn> iterator()
      Specified by:
      iterator in interface Iterable<Dn>
    • getServerState

      public ServerState getServerState(Dn baseDN)
      Returns the ServerState associated to the provided replication domain's baseDN.
      Parameters:
      baseDN - the replication domain's baseDN
      Returns:
      the associated ServerState
    • getCSN

      public CSN getCSN(Dn baseDN, ReplicaId replicaId)
      Returns the CSN associated to the provided replication domain's baseDN and replicaId.
      Parameters:
      baseDN - the replication domain's baseDN
      replicaId - the replicaId
      Returns:
      the associated CSN
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • cover

      public boolean cover(Dn baseDN, CSN csn)
      Test if this object covers the provided CSN for the provided baseDN.
      Parameters:
      baseDN - The provided baseDN.
      csn - The provided CSN.
      Returns:
      true when this object covers the provided CSN for the provided baseDN.