Class DiskStateLog
- java.lang.Object
-
- bftsmart.tom.server.defaultservices.StateLog
-
- bftsmart.tom.server.defaultservices.DiskStateLog
-
public class DiskStateLog extends StateLog
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_DIR
-
Constructor Summary
Constructors Constructor Description DiskStateLog(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.DefaultApplicationState
getApplicationState(int cid, boolean sendState)
Constructs a TransferableState using this log informationprotected ApplicationState
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(DefaultApplicationState transState)
Updates this log, according to the information contained in the TransferableState object-
Methods inherited from class bftsmart.tom.server.defaultservices.StateLog
getLastCheckpointCID, getLastCID, getLastReplies, getLastRepliesHash, getMessageBatch, getMessageBatches, getNumBatches, getState, getStateHash, setLastCheckpointCID, setLastCID, setLastReplies, setLastRepliesHash
-
-
-
-
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.consensusId
-msgCtx
- The message contexts related to the commands
-
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
-
getApplicationState
public DefaultApplicationState getApplicationState(int cid, boolean sendState)
Constructs a TransferableState using this log information- Overrides:
getApplicationState
in classStateLog
- Parameters:
cid
- Consensus ID correspondent to desired statesendState
-- Returns:
- TransferableState Object containing this log information
-
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(DefaultApplicationState transState)
Updates this log, according to the information contained in the TransferableState object
-
loadDurableState
protected ApplicationState loadDurableState()
-
-