Class UpdateMsg
- java.lang.Object
-
- org.opends.server.replication.protocol.ReplicationMsg
-
- org.opends.server.replication.protocol.UpdateMsg
-
- All Implemented Interfaces:
Comparable<UpdateMsg>
- Direct Known Subclasses:
LDAPUpdateMsg
,ReplicaOfflineMsg
public abstract class UpdateMsg extends ReplicationMsg implements Comparable<UpdateMsg>
Abstract class that must be extended to define a message used for sending Updates between servers.
-
-
Field Summary
-
Fields inherited from class org.opends.server.replication.protocol.ReplicationMsg
COMPACT_MASK, COMPACT_TYPE_ADD, COMPACT_TYPE_DELETE, COMPACT_TYPE_MODIFY, COMPACT_TYPE_MODIFY_DN, COMPACT_TYPE_REPLICA_OFFLINE, MSG_TYPE_DISK_ENCODING
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract <E extends Exception>
voidaccept(UpdateMsgVisitor<E> visitor)
Applies anUpdateMsgVisitor
to thisUpdateMsg
.int
compareTo(UpdateMsg msg)
boolean
equals(Object obj)
byte[]
getBytes()
Returns the encoded representation of this update message using the latest protocol version.abstract byte[]
getBytes(short protocolVersion)
Serializes the PDU using the provided replication protocol version.CSN
getCSN()
Get the CSN from the message.short
getVersion()
Get the version included in the update message.int
hashCode()
abstract int
size()
Return the number of bytes used by this message.JsonValue
toJson()
Returns the json representation of this update message.String
toString()
-
Methods inherited from class org.opends.server.replication.protocol.ReplicationMsg
decodeMsg, isRetryable
-
-
-
-
Constructor Detail
-
UpdateMsg
public UpdateMsg(CSN csn)
Creates a new UpdateMsg with the given informations.This constructor is only used for testing.
- Parameters:
csn
- The CSN associated with the change encoded in this message.
-
-
Method Detail
-
accept
public abstract <E extends Exception> void accept(UpdateMsgVisitor<E> visitor) throws E extends Exception
Applies anUpdateMsgVisitor
to thisUpdateMsg
.- Type Parameters:
E
- The type of the exception thrown by the visitor method if it fails, orNeverThrowsException
if the visitor cannot fail.- Parameters:
visitor
- The message visitor.- Throws:
E
- If the visitor failed.E extends Exception
-
getCSN
public CSN getCSN()
Get the CSN from the message.- Returns:
- the CSN
-
compareTo
public int compareTo(UpdateMsg msg)
- Specified by:
compareTo
in interfaceComparable<UpdateMsg>
-
getVersion
public short getVersion()
Get the version included in the update message. Means the replication protocol version with which this update message was instantiated.- Returns:
- The version with which this update message was instantiated.
-
size
public abstract int size()
Return the number of bytes used by this message.- Returns:
- The number of bytes used by this message.
-
getBytes
public byte[] getBytes()
Returns the encoded representation of this update message using the latest protocol version.- Returns:
- The encoded representation of this update message.
-
getBytes
public abstract byte[] getBytes(short protocolVersion)
Description copied from class:ReplicationMsg
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.- Specified by:
getBytes
in classReplicationMsg
- Parameters:
protocolVersion
- The protocol version to use for serialization. The version should normally be older than the current one.- Returns:
- The encoded PDU, or
null
if the message isn't supported in that protocol version.
-
toJson
public JsonValue toJson()
Returns the json representation of this update message.- Returns:
- The json representation of this update message.
-
-