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 boolean
appStateOnly
protected DeliveryThread
dt
protected ExecutionManager
execManager
protected boolean
isInitializing
protected int
lastCID
protected java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>>
queries
protected int
queryID
protected java.util.HashMap<java.lang.Integer,java.lang.Integer>
senderLeaders
protected java.util.HashMap<java.lang.Integer,CertifiedDecision>
senderProofs
protected java.util.HashMap<java.lang.Integer,java.lang.Integer>
senderRegencies
protected java.util.HashMap<java.lang.Integer,ApplicationState>
senderStates
protected java.util.HashMap<java.lang.Integer,View>
senderViews
protected ApplicationState
state
protected ServerViewController
SVController
protected TOMLayer
tomLayer
protected int
waitingCID
-
Constructor Summary
Constructors Constructor Description StateManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
analyzeState(int cid)
void
askCurrentConsensusId()
void
currentConsensusIdAsked(int sender, int id)
void
currentConsensusIdReceived(SMMessage smsg)
protected boolean
enoughLeaders(int leader)
protected boolean
enoughProofs(int cid, LCManager lc)
protected boolean
enoughRegencies(int regency)
protected boolean
enoughReplies()
protected boolean
enoughViews(View view)
int
getLastCID()
protected int
getReplies()
void
init(TOMLayer tomLayer, DeliveryThread dt)
boolean
isRetrievingState()
java.util.Collection<ApplicationState>
receivedStates()
void
requestAppState(int cid)
protected abstract void
requestState()
Request the state to the other replicas.protected void
reset()
Clear the collections and state hold by this object.void
setLastCID(int cid)
abstract void
SMReplyDeliver(SMMessage msg, boolean isBFT)
Invoked when a replica receives a reply to its request to be sent the application state.abstract void
SMRequestDeliver(SMMessage msg, boolean isBFT)
Invoked when a replica is asking to be sent the application state.abstract void
stateTimeout()
To use if the state manager needs to use timeout for liveness and when such timeout expires.void
triggerTimeout(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
-
-