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
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract <E extends Exception>
voidaccept
(UpdateMsgVisitor<E> visitor) Applies anUpdateMsgVisitor
to thisUpdateMsg
.int
boolean
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.getCSN()
Get the CSN from the message.short
Get the version included in the update message.int
hashCode()
abstract int
size()
Return the number of bytes used by this message.toJson()
Returns the json representation of this update message.toString()
Methods inherited from class org.opends.server.replication.protocol.ReplicationMsg
decodeMsg, isRetryable
-
Constructor Details
-
UpdateMsg
Creates a new UpdateMsg with the given information.This constructor is only used for testing.
- Parameters:
csn
- The CSN associated with the change encoded in this message.
-
-
Method Details
-
accept
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.
-
getCSN
Get the CSN from the message.- Returns:
- the CSN
-
equals
-
hashCode
public int hashCode() -
compareTo
- 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.
-
toString
-
toJson
Returns the json representation of this update message.- Returns:
- The json representation of this update message.
-