Class AckMsg


  • public class AckMsg
    extends ReplicationMsg
    AckMsg messages are used for acknowledging an update that has been sent requesting an ack: update sent in Assured Mode, either safe data or safe read sub mode. The CSN refers to the update CSN that was requested to be acknowledged. If some errors occurred during attempt to acknowledge the update in the path to final servers, errors are marked with the following fields: - hasTimeout: Some servers went in timeout when the matching update was sent. - hasWrongStatus: Some servers were in a status where we cannot ask for an ack when the matching update was sent. - hasReplayError: Some servers made an error replaying the sent matching update. - failedServers: The list of server ids that had errors for the sent matching update. Each server id of the list had one of the 3 possible errors (timeout/wrong status /replay error) AckMsg messages are sent all along the reverse path of the path followed an update message.
    • Constructor Detail

      • AckMsg

        public AckMsg​(CSN csn)
        Creates a new AckMsg from a CSN (no errors).
        Parameters:
        csn - The CSN used to build the AckMsg.
      • AckMsg

        public AckMsg​(CSN csn,
                      boolean hasTimeout,
                      boolean hasWrongStatus,
                      boolean hasReplayError,
                      List<Integer> failedServers)
        Creates a new AckMsg from a CSN (with specified error info).
        Parameters:
        csn - The CSN used to build the AckMsg.
        hasTimeout - The hasTimeout info
        hasWrongStatus - The hasWrongStatus info
        hasReplayError - The hasReplayError info
        failedServers - The list of failed servers
    • Method Detail

      • setHasTimeout

        public void setHasTimeout​(boolean hasTimeout)
        Sets the timeout marker for this message.
        Parameters:
        hasTimeout - True if some timeout occurred
      • setHasWrongStatus

        public void setHasWrongStatus​(boolean hasWrongStatus)
        Sets the wrong status marker for this message.
        Parameters:
        hasWrongStatus - True if some servers were in wrong status
      • setHasReplayError

        public void setHasReplayError​(boolean hasReplayError)
        Sets the replay error marker for this message.
        Parameters:
        hasReplayError - True if some servers had errors replaying the change
      • setFailedServers

        public void setFailedServers​(List<Integer> idList)
        Sets the list of failing servers for this message.
        Parameters:
        idList - The list of failing servers for this message.
      • getCSN

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

        public byte[] getBytes​(short protocolVersion)
        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.
      • hasTimeout

        public boolean hasTimeout()
        Tells if the matching update had timeout.
        Returns:
        true if the matching update had timeout
      • hasWrongStatus

        public boolean hasWrongStatus()
        Tells if the matching update had wrong status error.
        Returns:
        true if the matching update had wrong status error
      • hasReplayError

        public boolean hasReplayError()
        Tells if the matching update had replay error.
        Returns:
        true if the matching update had replay error
      • getFailedServers

        public List<Integer> getFailedServers()
        Get the list of failed servers.
        Returns:
        the list of failed servers
      • errorsToString

        public String errorsToString()
        Transforms the errors information of the ack into human readable string.
        Returns:
        A human readable string for errors embedded in the message.