Package bftsmart.tom.server
Interface Recoverable
-
- All Known Implementing Classes:
CounterServer
,DefaultRecoverable
,DefaultSingleRecoverable
,DurabilityCoordinator
,MapServer
,RecoveryTestServer
,SimpleServiceServer
,ThroughputLatencyServer
,ThroughputLatencyServer
,YCSBServer
public interface Recoverable
Classes that implement this interface should implement a state transfer protocol. Typically, classes should both implement this interface and one of the executables.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ApplicationState
getState(int cid, boolean sendState)
This method should return a representation of the application stateStateManager
getStateManager()
Recoverers implementing this interface will have to chose among different options of state managers like DurableStateManager or StandardStateManager.void
noOp(int CID, byte[][] operations, MessageContext[] msgCtx)
This method is invoked by ServiceReplica to indicate that a consensus instance finished without delivering anything to the application (e.g., an instance only decided a single reconfiguration operation. or an instance where the client operation was not delivered because its view was outdated).void
Op(int CID, byte[] requests, MessageContext msgCtx)
This method is invoked by ServiceReplica to pass information that was decided in a particular consensus instance.void
setClientsManager(ClientsManager clientsManager)
Recoverers implement this interface to access and save replies from the ClientManager as replies need to be transfered to a recovering replica as part of its replica state (which is enriched by a replies storage object) To access the clientManager, the recoverer needs to set its referencevoid
setReplicaContext(ReplicaContext replicaContext)
Sets the replica contextint
setState(ApplicationState state)
Sets the state to the representation obtained in the state transfer protocol
-
-
-
Method Detail
-
setReplicaContext
void setReplicaContext(ReplicaContext replicaContext)
Sets the replica context- Parameters:
replicaContext
- The replica context
-
getState
ApplicationState getState(int cid, boolean sendState)
This method should return a representation of the application state- Parameters:
cid
- Consensus up to which the application should return an Application statesendState
- true if the replica should send a complete representation of the state instead of only the hash. False otherwise- Returns:
- A representation of the application state
-
setState
int setState(ApplicationState state)
Sets the state to the representation obtained in the state transfer protocol- Parameters:
state
- State obtained in the state transfer protocol- Returns:
-
getStateManager
StateManager getStateManager()
Recoverers implementing this interface will have to chose among different options of state managers like DurableStateManager or StandardStateManager. The recoverer class can also define a new strategy to manage the state and return it in this method.- Returns:
- the implementation of state manager that suplies the strategy defined
-
setClientsManager
void setClientsManager(ClientsManager clientsManager)
Recoverers implement this interface to access and save replies from the ClientManager as replies need to be transfered to a recovering replica as part of its replica state (which is enriched by a replies storage object) To access the clientManager, the recoverer needs to set its reference
-
Op
void Op(int CID, byte[] requests, MessageContext msgCtx)
This method is invoked by ServiceReplica to pass information that was decided in a particular consensus instance. This method is always invoked before the executor. However, multiple invocations for the same consensus ID may occur, so developers must take this behavior into consideration when developing their own logging and checkpointing. If there is no information to be passed to the application, noOp(...) is invoked instead.- Parameters:
CID
- the consensus instance ID associated with the requestrequests
- A request decided in CIDmsgCtx
- Message context associated with the client request and the consensus instance where it was ordered. msgCtx.getConsensusId() will be equal to CID.
-
noOp
void noOp(int CID, byte[][] operations, MessageContext[] msgCtx)
This method is invoked by ServiceReplica to indicate that a consensus instance finished without delivering anything to the application (e.g., an instance only decided a single reconfiguration operation. or an instance where the client operation was not delivered because its view was outdated). To allow the underlying state transfer protocol to execute correctly, it needs to be notified of this special case In the current protocols included, it suffices to register a NOOP operation in the logs used within the state transfer, but never deliver it to the application- Parameters:
CID
- the consensus instance where the aforementioned condition occurredoperations
- Operations decided in CIDmsgCtx
- Message context associated with the consensus instance. furthermore msgCtx.getConsensusId() will be equal to CID.
-
-