public abstract class DefaultRecoverable extends java.lang.Object implements Recoverable, BatchExecutable
Constructor and Description |
---|
DefaultRecoverable() |
Modifier and Type | Method and Description |
---|---|
abstract byte[][] |
appExecuteBatch(byte[][] commands,
MessageContext[] msgCtxs) |
abstract byte[] |
appExecuteUnordered(byte[] command,
MessageContext msgCtx) |
byte[] |
computeHash(byte[] data) |
byte[][] |
executeBatch(byte[][] commands,
MessageContext[] msgCtxs)
Execute a batch of requests.
|
byte[] |
executeUnordered(byte[] command,
MessageContext msgCtx)
Method called to execute a request totally ordered.
|
abstract byte[] |
getSnapshot() |
bftsmart.statemanagement.ApplicationState |
getState(int cid,
boolean sendState)
This method should return a representation of the application state
|
bftsmart.statemanagement.StateManager |
getStateManager()
Recoverers implementing this interface will have to chose among
different options of state managers like DurableStateManager or
StandardStateManager.
|
abstract void |
installSnapshot(byte[] state) |
void |
noOp(int CID,
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.
|
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 |
saveCommands(byte[][] commands,
MessageContext[] msgCtx)
Write commands to log file
|
void |
setReplicaContext(ReplicaContext replicaContext) |
int |
setState(bftsmart.statemanagement.ApplicationState recvState)
Sets the state to the representation obtained in the state transfer protocol
|
public byte[][] executeBatch(byte[][] commands, MessageContext[] msgCtxs)
BatchExecutable
executeBatch
in interface BatchExecutable
public final byte[] computeHash(byte[] data)
public void saveCommands(byte[][] commands, MessageContext[] msgCtx)
commands
- array of commands. Each command is an array of bytesmsgCtx
- public bftsmart.statemanagement.ApplicationState getState(int cid, boolean sendState)
Recoverable
getState
in interface Recoverable
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 otherwisepublic int setState(bftsmart.statemanagement.ApplicationState recvState)
Recoverable
setState
in interface Recoverable
recvState
- State obtained in the state transfer protocolpublic void setReplicaContext(ReplicaContext replicaContext)
setReplicaContext
in interface Recoverable
public bftsmart.statemanagement.StateManager getStateManager()
Recoverable
getStateManager
in interface Recoverable
public byte[] executeUnordered(byte[] command, MessageContext msgCtx)
Executable
executeUnordered
in interface Executable
command
- the command issue by the clientmsgCtx
- information related with the commandpublic void Op(int CID, byte[] requests, MessageContext msgCtx)
Recoverable
Op
in interface Recoverable
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.public void noOp(int CID, MessageContext msgCtx)
Recoverable
noOp
in interface Recoverable
CID
- the consensus instance where the aforementioned condition occurredmsgCtx
- Message context associated with the consensus instance. furthermore
msgCtx.getConsensusId() will be equal to CID.public abstract void installSnapshot(byte[] state)
public abstract byte[] getSnapshot()
public abstract byte[][] appExecuteBatch(byte[][] commands, MessageContext[] msgCtxs)
public abstract byte[] appExecuteUnordered(byte[] command, MessageContext msgCtx)