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.
  • Constructor Details

    • UpdateMsg

      public UpdateMsg(CSN csn)
      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

      public abstract <E extends Exception> void accept(UpdateMsgVisitor<E> visitor) throws E
      Applies an UpdateMsgVisitor to this UpdateMsg.
      Type Parameters:
      E - The type of the exception thrown by the visitor method if it fails, or NeverThrowsException if the visitor cannot fail.
      Parameters:
      visitor - The message visitor.
      Throws:
      E - If the visitor failed.
    • getCSN

      public CSN getCSN()
      Get the CSN from the message.
      Returns:
      the CSN
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(UpdateMsg msg)
      Specified by:
      compareTo in interface Comparable<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 class ReplicationMsg
      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

      public String toString()
      Overrides:
      toString in class Object
    • toJson

      public JsonValue toJson()
      Returns the json representation of this update message.
      Returns:
      The json representation of this update message.