Package bftsmart.statemanagement
Class StateManager
- java.lang.Object
-
- bftsmart.statemanagement.StateManager
-
- Direct Known Subclasses:
DurableStateManager,StandardStateManager
public abstract class StateManager extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanappStateOnlyprotected DeliveryThreaddtprotected ExecutionManagerexecManagerprotected booleanisInitializingprotected intlastCIDprotected java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>>queriesprotected intqueryIDprotected java.util.HashMap<java.lang.Integer,java.lang.Integer>senderLeadersprotected java.util.HashMap<java.lang.Integer,CertifiedDecision>senderProofsprotected java.util.HashMap<java.lang.Integer,java.lang.Integer>senderRegenciesprotected java.util.HashMap<java.lang.Integer,ApplicationState>senderStatesprotected java.util.HashMap<java.lang.Integer,View>senderViewsprotected ApplicationStatestateprotected ServerViewControllerSVControllerprotected TOMLayertomLayerprotected intwaitingCID
-
Constructor Summary
Constructors Constructor Description StateManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidanalyzeState(int cid)voidaskCurrentConsensusId()voidcurrentConsensusIdAsked(int sender, int id)voidcurrentConsensusIdReceived(SMMessage smsg)protected booleanenoughLeaders(int leader)protected booleanenoughProofs(int cid, LCManager lc)protected booleanenoughRegencies(int regency)protected booleanenoughReplies()protected booleanenoughViews(View view)intgetLastCID()protected intgetReplies()voidinit(TOMLayer tomLayer, DeliveryThread dt)booleanisRetrievingState()java.util.Collection<ApplicationState>receivedStates()voidrequestAppState(int cid)protected abstract voidrequestState()Request the state to the other replicas.protected voidreset()Clear the collections and state hold by this object.voidsetLastCID(int cid)abstract voidSMReplyDeliver(SMMessage msg, boolean isBFT)Invoked when a replica receives a reply to its request to be sent the application state.abstract voidSMRequestDeliver(SMMessage msg, boolean isBFT)Invoked when a replica is asking to be sent the application state.abstract voidstateTimeout()To use if the state manager needs to use timeout for liveness and when such timeout expires.voidtriggerTimeout(SMMessage msg)
-
-
-
Field Detail
-
tomLayer
protected TOMLayer tomLayer
-
SVController
protected ServerViewController SVController
-
dt
protected DeliveryThread dt
-
execManager
protected ExecutionManager execManager
-
senderStates
protected java.util.HashMap<java.lang.Integer,ApplicationState> senderStates
-
senderViews
protected java.util.HashMap<java.lang.Integer,View> senderViews
-
senderRegencies
protected java.util.HashMap<java.lang.Integer,java.lang.Integer> senderRegencies
-
senderLeaders
protected java.util.HashMap<java.lang.Integer,java.lang.Integer> senderLeaders
-
senderProofs
protected java.util.HashMap<java.lang.Integer,CertifiedDecision> senderProofs
-
appStateOnly
protected boolean appStateOnly
-
waitingCID
protected int waitingCID
-
queryID
protected int queryID
-
lastCID
protected int lastCID
-
state
protected ApplicationState state
-
isInitializing
protected boolean isInitializing
-
queries
protected java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>> queries
-
-
Method Detail
-
getReplies
protected int getReplies()
-
enoughReplies
protected boolean enoughReplies()
-
enoughRegencies
protected boolean enoughRegencies(int regency)
-
enoughLeaders
protected boolean enoughLeaders(int leader)
-
enoughViews
protected boolean enoughViews(View view)
-
enoughProofs
protected boolean enoughProofs(int cid, LCManager lc)
-
reset
protected void reset()
Clear the collections and state hold by this object. Calls clear() in the States, Leaders, regencies and Views collections. Sets the state to null;
-
receivedStates
public java.util.Collection<ApplicationState> receivedStates()
-
setLastCID
public void setLastCID(int cid)
-
getLastCID
public int getLastCID()
-
requestAppState
public void requestAppState(int cid)
-
analyzeState
public void analyzeState(int cid)
-
isRetrievingState
public boolean isRetrievingState()
-
askCurrentConsensusId
public void askCurrentConsensusId()
-
currentConsensusIdAsked
public void currentConsensusIdAsked(int sender, int id)
-
currentConsensusIdReceived
public void currentConsensusIdReceived(SMMessage smsg)
-
init
public void init(TOMLayer tomLayer, DeliveryThread dt)
-
triggerTimeout
public void triggerTimeout(SMMessage msg)
-
requestState
protected abstract void requestState()
Request the state to the other replicas. It should ask for the state defined in the 'waitingCID' variable.
-
stateTimeout
public abstract void stateTimeout()
To use if the state manager needs to use timeout for liveness and when such timeout expires. To trigger the invocation, the method 'triggerTimeout' should be invoked by the class extending StateManager supplying an SMMessage of type 'TRIGGER_SM_LOCALLY'
-
SMRequestDeliver
public abstract void SMRequestDeliver(SMMessage msg, boolean isBFT)
Invoked when a replica is asking to be sent the application state.- Parameters:
msg- The message sent by the replica, of type 'SM_REQUEST'.isBFT- true if the library is set for BFT, false if CFT
-
SMReplyDeliver
public abstract void SMReplyDeliver(SMMessage msg, boolean isBFT)
Invoked when a replica receives a reply to its request to be sent the application state.- Parameters:
msg- The message sent by the replica, of type 'SM_REPLY'.isBFT- true if the library is set for BFT, false if CFT
-
-