Package bftsmart.tom.server.durability
Class DurableStateLog
- java.lang.Object
-
- bftsmart.tom.server.defaultservices.StateLog
-
- bftsmart.tom.server.durability.DurableStateLog
-
public class DurableStateLog extends StateLog
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_DIR
-
Constructor Summary
Constructors Constructor Description DurableStateLog(int id, byte[] initialState, byte[] initialHash, boolean isToLog, boolean syncLog, boolean syncCkp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMessageBatch(byte[][] commands, MessageContext[] msgCtx, int consensusId)
Adds a message batch to the log.CSTState
getState(CSTRequest cstRequest)
protected CSTState
loadDurableState()
void
newCheckpoint(byte[] state, byte[] stateHash, int consensusId)
Sets the state associated with the last checkpoint, and updates the consensus ID associated with itvoid
setLastCID(int cid, int checkpointPeriod, int checkpointPortion)
void
transferApplicationState(java.nio.channels.SocketChannel sChannel, int cid)
void
update(CSTState state)
Updates this log, according to the information contained in the TransferableState object-
Methods inherited from class bftsmart.tom.server.defaultservices.StateLog
getApplicationState, getLastCheckpointCID, getLastCID, getLastReplies, getLastRepliesHash, getMessageBatch, getMessageBatches, getNumBatches, getState, getStateHash, setLastCheckpointCID, setLastCID, setLastReplies, setLastRepliesHash, update
-
-
-
-
Method Detail
-
addMessageBatch
public void addMessageBatch(byte[][] commands, MessageContext[] msgCtx, int consensusId)
Adds a message batch to the log. This batches should be added to the log in the same order in which they are delivered to the application. Only the 'k' batches received after the last checkpoint are supposed to be kept- Overrides:
addMessageBatch
in classStateLog
- Parameters:
commands
- The batch of messages to be kept.msgCtx
-consensusId
- the consensus id added to the batch
-
newCheckpoint
public void newCheckpoint(byte[] state, byte[] stateHash, int consensusId)
Description copied from class:StateLog
Sets the state associated with the last checkpoint, and updates the consensus ID associated with it- Overrides:
newCheckpoint
in classStateLog
- Parameters:
state
- State associated with the last checkpoint
-
getState
public CSTState getState(CSTRequest cstRequest)
-
transferApplicationState
public void transferApplicationState(java.nio.channels.SocketChannel sChannel, int cid)
-
setLastCID
public void setLastCID(int cid, int checkpointPeriod, int checkpointPortion)
-
update
public void update(CSTState state)
Updates this log, according to the information contained in the TransferableState object- Parameters:
state
-transState
- TransferableState object containing the information which is used to updated this log
-
loadDurableState
protected CSTState loadDurableState()
-
-