bftsmart.tom.server.defaultservices

## Class FileRecoverer

- java.lang.Object
- - bftsmart.tom.server.defaultservices.FileRecoverer

    public class FileRecoverer
    extends java.lang.Object

### Constructor Summary

Constructors
Constructor and Description
`FileRecoverer(int replicaId, java.lang.String defaultDir)`

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `getCkpLastConsensusId()`
`byte[]` `getCkpState(java.lang.String ckpPath)`
`byte[]` `getCkpStateHash()`
`java.lang.String` `getLatestFile(java.lang.String extention)`
`int` `getLogLastConsensusId()`
`CommandsInfo[]` `getLogState(int index, java.lang.String logPath)` Reads all log messages from the last log file created
`CommandsInfo[]` `getLogState(long pointer, int startOffset, int number, java.lang.String logPath)` Recover portions of the log for collaborative state transfer.
`void` `recoverCkpHash(java.lang.String ckpPath)`
`void` `transferCkpState(java.nio.channels.SocketChannel sChannel, java.lang.String ckpPath)`
`void` `transferLog(java.nio.channels.SocketChannel sChannel, int index, java.lang.String logPath)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### FileRecoverer

    public FileRecoverer(int replicaId,
                         java.lang.String defaultDir)

### Method Detail

#### getLogState

    public CommandsInfo[] getLogState(int index,
                                      java.lang.String logPath)

Reads all log messages from the last log file created

Returns:
  an array with batches of messages executed for each consensus

#### getLogState

    public CommandsInfo[] getLogState(long pointer,
                                      int startOffset,
                                      int number,
                                      java.lang.String logPath)

Recover portions of the log for collaborative state transfer.

Parameters:
  `start` - the index for which the commands start to be collected
  `number` - the number of commands retrieved
Returns:
  The commands for the period selected

#### getCkpState

    public byte[] getCkpState(java.lang.String ckpPath)

#### recoverCkpHash

    public void recoverCkpHash(java.lang.String ckpPath)

#### transferLog

    public void transferLog(java.nio.channels.SocketChannel sChannel,
                            int index,
                            java.lang.String logPath)

#### transferCkpState

    public void transferCkpState(java.nio.channels.SocketChannel sChannel,
                                 java.lang.String ckpPath)

#### getCkpStateHash

    public byte[] getCkpStateHash()

#### getCkpLastConsensusId

    public int getCkpLastConsensusId()

#### getLogLastConsensusId

    public int getLogLastConsensusId()

#### getLatestFile

    public java.lang.String getLatestFile(java.lang.String extention)