Class DurableStateLog


  • public class DurableStateLog
    extends StateLog
    • Field Detail

      • DEFAULT_DIR

        public static final java.lang.String DEFAULT_DIR
    • Constructor Detail

      • DurableStateLog

        public DurableStateLog​(int id,
                               byte[] initialState,
                               byte[] initialHash,
                               boolean isToLog,
                               boolean syncLog,
                               boolean syncCkp)
    • 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 class StateLog
        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 class StateLog
        Parameters:
        state - State associated with the last checkpoint
      • 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()