Package bftsmart.consensus.messages
Class MessageFactory
- java.lang.Object
-
- bftsmart.consensus.messages.MessageFactory
-
public class MessageFactory extends java.lang.Object
This class work as a factory of messages used in the paxos protocol.
-
-
Field Summary
Fields Modifier and Type Field Description static int
ACCEPT
static int
FWD_DECISION
static int
PROPOSE
static int
REQ_DECISION
static int
WRITE
-
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 ConsensusMessage
createAccept(int id, int epoch, byte[] value)
Creates an ACCEPT message to be sent by this processConsensusMessage
createForwardDecision(int id, int epoch, byte[] value)
Creates a FWD_DECISION message to be sent by this processConsensusMessage
createPropose(int id, int epoch, byte[] value)
Creates a PROPOSE message to be sent by this processConsensusMessage
createRequestDecision(int id, int epoch, byte[] value)
Creates a REQUEST_DECISION message to be sent by this processConsensusMessage
createWrite(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
-
-