Class MultiDomainServerState
- java.lang.Object
-
- org.opends.server.replication.common.MultiDomainServerState
-
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 Summary
Constructors Constructor Description MultiDomainServerState()
Creates a new empty object.MultiDomainServerState(String cookie)
Create an object from a string representation.MultiDomainServerState(MultiDomainServerState cookie)
Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
cover(Dn baseDN, CSN csn)
Test if this object covers the provided CSN for the provided baseDN.boolean
equals(Object obj)
CSN
getCSN(Dn baseDN, ReplicaId replicaId)
Returns the CSN associated to the provided replication domain's baseDN and replicaId.ServerState
getServerState(Dn baseDN)
Returns the ServerState associated to the provided replication domain's baseDN.Map<Dn,Set<CSN>>
getSnapshot()
Returns a snapshot of this object.int
hashCode()
boolean
isEmpty()
Tests if the state is empty.Iterator<Dn>
iterator()
void
replace(Dn baseDN, ServerState serverState)
Replace the ServerState of the provided baseDN with the provided server state.String
toString()
boolean
update(Dn baseDN, CSN csn)
Update the ServerState of the provided baseDN with the replicationCSN
provided.void
update(Dn baseDN, ServerState serverState)
Update the ServerState of the provided baseDN with the provided server state.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
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 replicationCSN
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 baseDNreplicaId
- the replicaId- Returns:
- the associated CSN
-
-