Class DiskStateLog


  • public class DiskStateLog
    extends StateLog
    • Field Detail

      • DEFAULT_DIR

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

      • DiskStateLog

        public DiskStateLog​(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.
        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 class StateLog
        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 class StateLog
        Parameters:
        cid - Consensus ID correspondent to desired state
        sendState -
        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
        Overrides:
        update in class StateLog
        Parameters:
        transState - TransferableState object containing the information which is used to updated this log