Class MultiDomainServerState

  • All Implemented Interfaces:
    Iterable<Dn>

    public 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 Detail

      • 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 Detail

      • 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.
      • isEmpty

        public boolean isEmpty()
        Tests if the state is empty.
        Returns:
        True if the state is empty.
      • 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
      • 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.