public class ServerState extends Object implements Iterable<CSN>
CSN
s.
For example, it is exchanged with the replication servers at connection establishment time to communicate "which CSNs was last seen by a serverId".
Constructor and Description |
---|
ServerState()
Creates a new empty ServerState.
|
Modifier and Type | Method and 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.
|
static int |
diffChanges(ServerState ss1,
ServerState ss2)
Computes the number of changes a first server state has in advance
compared to a second server state.
|
ServerState |
duplicate()
Make a duplicate of this state.
|
CSN |
getCSN(int serverId)
Returns the
CSN contained in this server state which corresponds to
the provided server ID. |
Map<Integer,CSN> |
getServerIdToCSNMap()
Returns a copy of this ServerState's content as a Map of serverId => CSN.
|
List<CSN> |
getSnapshot()
Returns a snapshot of this object.
|
boolean |
isEmpty()
Tests if the state is empty.
|
boolean |
isSaved()
Get the saved status of this ServerState.
|
Iterator<CSN> |
iterator() |
boolean |
removeCSN(CSN expectedCSN)
Removes the mapping to the provided CSN if it is present in this
ServerState.
|
void |
setSaved(boolean b)
Set the saved status of this ServerState.
|
ArrayList<org.forgerock.opendj.ldap.ByteString> |
toASN1ArrayList()
Return an ArrayList of ANS1OctetString encoding the CSNs
contained in the ServerState.
|
String |
toString()
Return the text representation of ServerState.
|
Set<String> |
toStringSet()
Return a Set of String usable as a textual representation of
a Server state.
|
boolean |
update(CSN csn)
Forward update the Server State with a CSN.
|
boolean |
update(ServerState serverState)
Update the Server State with a Server State.
|
void |
writeTo(org.forgerock.opendj.io.Asn1Writer writer,
short protocolVersion)
Encodes this server state to the provided ASN1 writer.
|
public ServerState()
public void clear()
public boolean update(CSN csn)
csn
- The committed CSN.public boolean update(ServerState serverState)
serverState
- the server state to use for the update.public boolean removeCSN(CSN expectedCSN)
expectedCSN
- the CSN to be removedpublic Set<String> toStringSet()
public ArrayList<org.forgerock.opendj.ldap.ByteString> toASN1ArrayList()
public void writeTo(org.forgerock.opendj.io.Asn1Writer writer, short protocolVersion) throws IOException
writer
- The ASN1 writer.protocolVersion
- The replication protocol version.IOException
- If an error occurred during encoding.public List<CSN> getSnapshot()
public CSN getCSN(int serverId)
CSN
contained in this server state which corresponds to
the provided server ID.serverId
- The server ID.CSN
contained in this server state which
corresponds to the provided server ID.public Map<Integer,CSN> getServerIdToCSNMap()
public boolean cover(ServerState covered)
covered
- The ServerState that needs to be checked.public boolean cover(CSN covered)
covered
- The CSN that should be checked.public boolean isEmpty()
public ServerState duplicate()
public static int diffChanges(ServerState ss1, ServerState ss2) throws IllegalArgumentException
ss1
- The server state supposed to be newer than the second oness2
- The server state supposed to be older than the first oneIllegalArgumentException
- If one of the passed state is nullpublic void setSaved(boolean b)
b
- A boolean indicating if the State has been safely stored.public boolean isSaved()
Copyright © 2010-2017 ForgeRock AS. All Rights Reserved.