Class ReplicaOfflineMsg
- java.lang.Object
-
- org.opends.server.replication.protocol.ReplicationMsg
-
- org.opends.server.replication.protocol.UpdateMsg
-
- org.opends.server.replication.protocol.ReplicaOfflineMsg
-
- All Implemented Interfaces:
Comparable<UpdateMsg>
public class ReplicaOfflineMsg extends UpdateMsg
Class that define messages sent by a replica (DS) to the replication server (RS) to let the RS know the date at which a replica went offline.
-
-
Field Summary
-
Fields inherited from class org.opends.server.replication.protocol.UpdateMsg
assuredFlag, assuredMode, csn, protocolVersion, safeDataLevel
-
Fields inherited from class org.opends.server.replication.protocol.ReplicationMsg
MSG_TYPE_DISK_ENCODING
-
-
Constructor Summary
Constructors Constructor Description ReplicaOfflineMsg(byte[] in)Creates a message by deserializing it from the provided byte array.ReplicaOfflineMsg(CSN offlineCSN)Constructor of a replica offline message providing the offline timestamp in a CSN.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontributesToDomainState()Whether the current message can update the "ds-sync-state" attribute.byte[]getBytes(short protocolVersion)This implementation is only called during unit testing, so we are free to force the protocol version.booleanisEncodableFor(short protocolVersion)Whether this message has an encoding for a peer which negotiated the provided replication protocol version.static booleanisSupportedBy(short protocolVersion)Whether a peer which negotiated the provided replication protocol version can be sent this message at all.intsize()Return the number of bytes used by this message.StringtoString()-
Methods inherited from class org.opends.server.replication.protocol.UpdateMsg
compareTo, decodeHeader, encodeHeader, equals, getAssuredMode, getBytes, getCSN, getPayload, getSafeDataLevel, getVersion, hashCode, isAssured, setAssured, setAssuredMode, setSafeDataLevel
-
Methods inherited from class org.opends.server.replication.protocol.ReplicationMsg
generateMsg
-
-
-
-
Constructor Detail
-
ReplicaOfflineMsg
public ReplicaOfflineMsg(CSN offlineCSN)
Constructor of a replica offline message providing the offline timestamp in a CSN.- Parameters:
offlineCSN- the provided offline CSN
-
ReplicaOfflineMsg
public ReplicaOfflineMsg(byte[] in) throws DataFormatExceptionCreates a message by deserializing it from the provided byte array.- Parameters:
in- The provided byte array.- Throws:
DataFormatException- When an error occurs during decoding .
-
-
Method Detail
-
getBytes
public byte[] getBytes(short protocolVersion)
This implementation is only called during unit testing, so we are free to force the protocol version. Underlying implementations override this method in order to provide version specific encodings. Serializes the PDU using the provided replication protocol version. WARNING: should be overwritten by a PDU (sub class) we want to support older protocol version serialization for.
-
isEncodableFor
public boolean isEncodableFor(short protocolVersion)
Whether this message has an encoding for a peer which negotiated the provided replication protocol version.A message which has none is dropped by
Session.publish(ReplicationMsg)- itsReplicationMsg.getBytes(short)returnsnull- with nothing on the wire and nothing in the log, so a caller which goes on to report what the peer was told must ask this before it publishes.- Overrides:
isEncodableForin classReplicationMsg- Parameters:
protocolVersion- The protocol version negotiated with the peer.- Returns:
trueif this message can be encoded for that version,falseif it has no encoding for it at all.
-
isSupportedBy
public static boolean isSupportedBy(short protocolVersion)
Whether a peer which negotiated the provided replication protocol version can be sent this message at all.The message was introduced by
ProtocolVersion.REPLICATION_PROTOCOL_V8and has no encoding below it: an older peer is not told that the replica went offline, and cannot be. This answers for the message type, for a caller which has no instance at hand - seeisEncodableFor(short)for the one which has.- Parameters:
protocolVersion- The protocol version negotiated with the peer.- Returns:
trueif that version carries this message,falseotherwise.
-
size
public int size()
Return the number of bytes used by this message.
-
contributesToDomainState
public boolean contributesToDomainState()
Whether the current message can update the "ds-sync-state" attribute.- Overrides:
contributesToDomainStatein classUpdateMsg- Returns:
- true if current message can update the "ds-sync-state" attribute, false otherwise.
-
-