Package bftsmart.consensus.messages
Class MessageFactory
- java.lang.Object
-
- bftsmart.consensus.messages.MessageFactory
-
public class MessageFactory extends java.lang.ObjectThis class work as a factory of messages used in the paxos protocol.
-
-
Field Summary
Fields Modifier and Type Field Description static intACCEPTstatic intFWD_DECISIONstatic intPROPOSEstatic intREQ_DECISIONstatic intWRITE
-
Constructor Summary
Constructors Constructor Description MessageFactory(int from)Creates a message factory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConsensusMessagecreateAccept(int id, int epoch, byte[] value)Creates an ACCEPT message to be sent by this processConsensusMessagecreateForwardDecision(int id, int epoch, byte[] value)Creates a FWD_DECISION message to be sent by this processConsensusMessagecreatePropose(int id, int epoch, byte[] value)Creates a PROPOSE message to be sent by this processConsensusMessagecreateRequestDecision(int id, int epoch, byte[] value)Creates a REQUEST_DECISION message to be sent by this processConsensusMessagecreateWrite(int id, int epoch, byte[] value)Creates a WRITE message to be sent by this process
-
-
-
Field Detail
-
PROPOSE
public static final int PROPOSE
- See Also:
- Constant Field Values
-
WRITE
public static final int WRITE
- See Also:
- Constant Field Values
-
ACCEPT
public static final int ACCEPT
- See Also:
- Constant Field Values
-
REQ_DECISION
public static final int REQ_DECISION
- See Also:
- Constant Field Values
-
FWD_DECISION
public static final int FWD_DECISION
- See Also:
- Constant Field Values
-
-
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 IDepoch- Epoch numbervalue- Proposed valueproof- 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 IDepoch- Epoch numbervalue- 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 IDepoch- Epoch numbervalue- 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 IDepoch- 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 IDepoch- Epoch numbervalue- Write value- Returns:
- A consensus message of the FWD_DECISION type, with the specified id, epoch, and value
-
-