Package bftsmart.consensus.roles
Class Acceptor
- java.lang.Object
-
- bftsmart.consensus.roles.Acceptor
-
public final class Acceptor extends java.lang.Object
This class represents the acceptor role in the consensus protocol. This class work together with the TOMLayer class in order to supply a atomic multicast service.
-
-
Constructor Summary
Constructors Constructor Description Acceptor(ServerCommunicationSystem communication, MessageFactory factory, ServerViewController controller)
Creates a new instance of Acceptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deliver(ConsensusMessage msg)
Called by communication layer to delivery Paxos messages.MessageFactory
getFactory()
void
processMessage(ConsensusMessage msg)
Called when a Consensus message is received or when a out of context message must be processed.void
proposeReceived(Epoch epoch, ConsensusMessage msg)
Called when a PROPOSE message is received or when processing a formerly out of context propose which is know belongs to the current consensus.void
sendRequestDecision(Epoch epoch, int cid, int[] receivers, byte[] value)
Send a REQ_DECISION to othersvoid
setExecutionManager(ExecutionManager manager)
Sets the execution manager for this acceptorvoid
setTOMLayer(TOMLayer tom)
Sets the TOM layer for this acceptorboolean
verifyDecision(ConsensusMessage msg)
verifyDecision takes a FORWARDED-DECISION message and checks if the contained decision can be verified using the attached proof.
-
-
-
Constructor Detail
-
Acceptor
public Acceptor(ServerCommunicationSystem communication, MessageFactory factory, ServerViewController controller)
Creates a new instance of Acceptor.- Parameters:
communication
- Replicas communication systemfactory
- Message factory for PaW messagescontroller
- sever view controller
-
-
Method Detail
-
getFactory
public MessageFactory getFactory()
-
setExecutionManager
public void setExecutionManager(ExecutionManager manager)
Sets the execution manager for this acceptor- Parameters:
manager
- Execution manager for this acceptor
-
setTOMLayer
public void setTOMLayer(TOMLayer tom)
Sets the TOM layer for this acceptor- Parameters:
tom
- TOM layer for this acceptor
-
deliver
public final void deliver(ConsensusMessage msg)
Called by communication layer to delivery Paxos messages. This method only verifies if the message can be executed and calls process message (storing it on an out of context message buffer if this is not the case)- Parameters:
msg
- Paxos messages delivered by the communication layer
-
processMessage
public final void processMessage(ConsensusMessage msg)
Called when a Consensus message is received or when a out of context message must be processed. It processes the received message according to its type- Parameters:
msg
- The message to be processed
-
proposeReceived
public void proposeReceived(Epoch epoch, ConsensusMessage msg)
Called when a PROPOSE message is received or when processing a formerly out of context propose which is know belongs to the current consensus.- Parameters:
msg
- The PROPOSE message to by processed
-
sendRequestDecision
public void sendRequestDecision(Epoch epoch, int cid, int[] receivers, byte[] value)
Send a REQ_DECISION to others- Parameters:
epoch
- the current epochcid
- consensus idreceivers
- the replicas that are askedvalue
- epoch.propValueHash
-
verifyDecision
public boolean verifyDecision(ConsensusMessage msg)
verifyDecision takes a FORWARDED-DECISION message and checks if the contained decision can be verified using the attached proof. The proof is a set of ACCEPT messages which- Parameters:
msg
- a Consensus Message: must be a FORWARD-DECISION- Returns:
- if the FORWARD-DECISION is good
-
-