Class MessageFactory


  • public class MessageFactory
    extends java.lang.Object
    This class work as a factory of messages used in the paxos protocol.
    • Constructor Detail

      • MessageFactory

        public MessageFactory​(int from)
        Creates a message factory
        Parameters:
        from - Replica ID of the process which sent this message
    • Method Detail

      • createPropose

        public ConsensusMessage createPropose​(int id,
                                              int epoch,
                                              byte[] value)
        Creates a PROPOSE message to be sent by this process
        Parameters:
        id - Consensus's execution ID
        epoch - Epoch number
        value - Proposed value
        proof - Proofs from other replicas
        Returns:
        A paxos message of the PROPOSE type, with the specified id, epoch, value, and proof
      • createWrite

        public ConsensusMessage createWrite​(int id,
                                            int epoch,
                                            byte[] value)
        Creates a WRITE message to be sent by this process
        Parameters:
        id - Consensus's execution ID
        epoch - Epoch number
        value - Write value
        Returns:
        A consensus message of the WRITE type, with the specified id, epoch, and value
      • createAccept

        public ConsensusMessage createAccept​(int id,
                                             int epoch,
                                             byte[] value)
        Creates an ACCEPT message to be sent by this process
        Parameters:
        id - Consensus's execution ID
        epoch - Epoch number
        value - Accepted value
        Returns:
        A consensus message of the ACCEPT type, with the specified id, epoch, and value
      • createRequestDecision

        public ConsensusMessage createRequestDecision​(int id,
                                                      int epoch,
                                                      byte[] value)
        Creates a REQUEST_DECISION message to be sent by this process
        Parameters:
        id - Consensus's execution ID
        epoch - Epoch number
        Returns:
        A consensus message of the REQ_DECISION type, with the specified id, epoch, and value
      • createForwardDecision

        public ConsensusMessage createForwardDecision​(int id,
                                                      int epoch,
                                                      byte[] value)
        Creates a FWD_DECISION message to be sent by this process
        Parameters:
        id - Consensus's execution ID
        epoch - Epoch number
        value - Write value
        Returns:
        A consensus message of the FWD_DECISION type, with the specified id, epoch, and value