Class ServerState
- java.lang.Object
-
- org.opends.server.replication.common.ServerState
-
-
Constructor Summary
Constructors Constructor Description ServerState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Empty the ServerState.boolean
cover(CSN covered)
Checks that the CSN given as a parameter is in this ServerState.boolean
cover(ServerState covered)
Check that all the CSNs in the covered serverState are also in this serverState.ServerState
duplicate()
Make a duplicate of this state.boolean
equals(Object obj)
CSN
getCSN(ReplicaId replicaId)
Returns theCSN
contained in this server state which corresponds to the provided replica ID.Map<ReplicaId,CSN>
getReplicaIdToCSNMap()
Returns a copy of this ServerState's content as a Map of replicaId to CSN.Set<CSN>
getSnapshot()
Returns a snapshot of this object.int
hashCode()
boolean
isEmpty()
Tests if the state is empty.Iterator<CSN>
iterator()
boolean
removeCSN(CSN expectedCSN)
Removes the mapping to the provided CSN if it is present in this ServerState.String
toString()
Return the text representation of ServerState.boolean
update(CSN csn)
Forward update the Server State with a CSN.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
clear
public void clear()
Empty the ServerState. After this call the Server State will be in the same state as if it was just created.
-
update
public boolean update(CSN csn)
Forward update the Server State with a CSN. The provided CSN will be put on the current object only if it is newer than the existing CSN for the same replicaId or if there is no existing CSN.- Parameters:
csn
- The committed CSN.- Returns:
- a boolean indicating if the update was meaningful.
-
removeCSN
public boolean removeCSN(CSN expectedCSN)
Removes the mapping to the provided CSN if it is present in this ServerState.- Parameters:
expectedCSN
- the CSN to be removed- Returns:
- true if the CSN could be removed, false otherwise.
-
getSnapshot
public Set<CSN> getSnapshot()
Returns a snapshot of this object.- Returns:
- an unmodifiable List representing a snapshot of this object.
-
toString
public String toString()
Return the text representation of ServerState.
-
getCSN
public CSN getCSN(ReplicaId replicaId)
Returns theCSN
contained in this server state which corresponds to the provided replica ID.- Parameters:
replicaId
- The replica ID.- Returns:
- The
CSN
contained in this server state which corresponds to the provided replica ID.
-
getReplicaIdToCSNMap
public Map<ReplicaId,CSN> getReplicaIdToCSNMap()
Returns a copy of this ServerState's content as a Map of replicaId to CSN.- Returns:
- a copy of this ServerState's content as a Map of replicaId to CSN.
-
cover
public boolean cover(ServerState covered)
Check that all the CSNs in the covered serverState are also in this serverState.- Parameters:
covered
- The ServerState that needs to be checked.- Returns:
- A boolean indicating if this ServerState covers the ServerState given in parameter.
-
cover
public boolean cover(CSN covered)
Checks that the CSN given as a parameter is in this ServerState.- Parameters:
covered
- The CSN that should be checked.- Returns:
- A boolean indicating if this ServerState contains the CSN given in parameter.
-
isEmpty
public boolean isEmpty()
Tests if the state is empty.- Returns:
- True if the state is empty.
-
duplicate
public ServerState duplicate()
Make a duplicate of this state.- Returns:
- The duplicate of this state.
-
-